BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitWire.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// File from KalFit module
3//
4// Filename : KalFitWire.cc
5//------------------------------------------------------------------------
6// Description : Description of a Mdc Wire
7//------------------------------------------------------------------------
8// Modif :
9//------------------------------------------------------------------------
10#include "CLHEP/Geometry/Point3D.h"
11#ifndef ENABLE_BACKWARDS_COMPATIBILITY
12typedef HepGeom::Point3D<double> HepPoint3D;
13#endif
14#include "KalFitAlg/KalFitLayer_Mdc.h"
15#include "KalFitAlg/KalFitSuper_Mdc.h"
16#include "KalFitAlg/KalFitWire.h"
17
18const double KalFitWire::A[NREGION] = { 8.5265E-7, 1.1368E-6, 1.2402E-6 };
19const double KalFitWire::F[NLAYER] = {
20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21 0, 47.2, 46.6, 47.0, 46, 45, 46.7, 46, 45, 44.6, 45.9, 45.9, 45.3,
22 44.5, 44.0, 46.0, 45.6, 44.2, 43.6, 44.0, 43.5, 43.1, 42.9, 42.4, 42.7, 42.5,
23 42.2, 41, 42, 42, 42, 41.4, 42.5, 43.0, 43.2, 43.4, 43.4 };
24const double L49_2 = 220.4 * 220.4;
25
26// constructor
27KalFitWire::KalFitWire( const int localID, const KalFitLayer_Mdc& layer, const HepPoint3D& fwd,
28 const HepPoint3D& bck, KalFitWire* const vt, unsigned int geoID,
29 unsigned int stereo )
30 : localId_( localID )
31 , fwd_( fwd )
32 , bck_( bck )
33 , layer_( layer )
34 , state_( WireHitInvalid )
35 , geoID_( geoID )
36 , stereo_( stereo )
37 , ddl_( 0 )
38 , ddr_( 0 )
39 , distance_( 0 ) {
40
41 int layer_ID = layer_.layerId();
42 xyPosition_ = 0.5 * ( fwd_ + bck_ );
43 if ( !stereo_ )
44 {
45 dx_ = 0;
46 dy_ = 0;
47 x_ = xyPosition_.x();
48 y_ = xyPosition_.y();
49 }
50 else
51 {
52 dx_ = (double)fwd_.x() - (double)bck_.x();
53 dy_ = (double)fwd_.y() - (double)bck_.y();
54 x_ = bck_.x();
55 y_ = bck_.y();
56 }
57 // Wire sag coeff
58 Hep3Vector wire_;
59 wire_ = (CLHEP::Hep3Vector)fwd - (CLHEP::Hep3Vector)bck;
60 lzx_ = sqrt( wire_.z() * wire_.z() + wire_.x() * wire_.x() );
61
62 // problem with layer_ and its id inside sagcoef ?!!
63 // sagcoef();
64 if ( layer_ID < 3 ) A_ = A[0];
65 else
66 {
67 if ( layer_ID < 14 ) A_ = A[1];
68 else if ( layer_ID < 50 )
69 {
70 double f_current( F[layer_ID] );
71 double l( wire_.mag() );
72 A_ = A[2] * F[49] * F[49] * L49_2 / ( f_current * f_current * l * l );
73 }
74 else std::cout << "*** PROBLEM WIRE !!!!! " << std::endl;
75 }
76
77 // Neighbor :
78 neighbor_[0] = (KalFitWire*)innerLeft( vt );
79 neighbor_[1] = (KalFitWire*)innerRight( vt );
80
81 neighbor_[2] = (KalFitWire*)left();
82 neighbor_[3] = (KalFitWire*)right();
83
84 neighbor_[4] = (KalFitWire*)outerLeft( vt );
85 neighbor_[5] = (KalFitWire*)outerRight( vt );
86}
87
89 : localId_( 0 )
90 , fwd_( 0, 0, 0 )
91 , bck_( 0, 0, 0 )
92 , layer_( *(KalFitLayer_Mdc*)NULL )
93 , state_( WireHitInvalid )
94 , x_( 0 )
95 , y_( 0 )
96 , dx_( 0 )
97 , dy_( 0 ) {
98 // Neighbor :
99 neighbor_[0] = NULL;
100 neighbor_[1] = NULL;
101 neighbor_[2] = NULL;
102 neighbor_[3] = NULL;
103 neighbor_[4] = NULL;
104 neighbor_[5] = NULL;
105}
106
107// destructor
109
110// wire sag coefficient determination :
112
113 Hep3Vector wire_;
114 wire_ = (CLHEP::Hep3Vector)fwd_ - (CLHEP::Hep3Vector)bck_;
115 int layer_ID = layer_.layerId();
116
117 if ( layer_ID < 3 ) { A_ = A[0]; }
118 else
119 {
120 if ( layer_ID < 14 ) { A_ = A[1]; }
121 else if ( layer_ID < 50 )
122 {
123 double f_current( F[layer_ID] );
124 double l( wire_.mag() );
125 A_ = A[2] * F[49] * F[49] * L49_2 / ( f_current * f_current * l * l );
126 }
127 else { std::cout << "*** PROBLEM WIRE !!!!! " << std::endl; }
128 }
129}
130
131const KalFitWire* KalFitWire::left( void ) const {
132 const KalFitWire* tmp = this;
133 if ( !localId_ ) tmp += layer_.superLayer().nWire();
134 return --tmp;
135}
136
137const KalFitWire* KalFitWire::right( void ) const {
138 const KalFitWire* tmp = this;
139 if ( localId_ == layer_.superLayer().localMaxId() ) { tmp -= layer_.superLayer().nWire(); }
140 return ++tmp;
141}
142
143const KalFitWire* KalFitWire::innerLeft( KalFitWire* const vtWire ) const {
144
145 if ( !layer_.localLayerId() ) return vtWire;
146 const KalFitWire* tmp = this;
147 if ( layer_.offset() & 1 ) { tmp -= layer_.superLayer().nWire(); }
148 else
149 {
150 if ( localId_ ) tmp -= layer_.superLayer().nWire();
151 --tmp;
152 }
153 return tmp;
154}
155
156const KalFitWire* KalFitWire::innerRight( KalFitWire* const vtWire ) const {
157 if ( !layer_.localLayerId() ) return vtWire;
158 const KalFitWire* tmp = this;
159 if ( layer_.offset() & 1 )
160 {
161 if ( localId_ == layer_.superLayer().localMaxId() ) { tmp -= layer_.superLayer().nWire(); }
162 tmp -= ( layer_.superLayer().nWire() - 1 );
163 }
164 else { tmp -= layer_.superLayer().nWire(); }
165 return tmp;
166}
167
168const KalFitWire* KalFitWire::outerLeft( KalFitWire* const vtWire ) const {
169 if ( layer_.localLayerId() == layer_.superLayer().layerMaxId() ) return vtWire;
170 const KalFitWire* tmp = this;
171 if ( layer_.offset() & 1 ) { tmp += layer_.superLayer().nWire(); }
172 else
173 {
174 if ( !localId_ ) tmp += layer_.superLayer().nWire();
175 tmp += ( layer_.superLayer().nWire() - 1 );
176 }
177 return tmp;
178}
179
180const KalFitWire* KalFitWire::outerRight( KalFitWire* const vtWire ) const {
181 if ( layer_.localLayerId() == layer_.superLayer().layerMaxId() ) return vtWire;
182 const KalFitWire* tmp = this;
183 if ( layer_.offset() & 1 )
184 {
185 if ( localId_ ^ layer_.superLayer().localMaxId() ) { tmp += layer_.superLayer().nWire(); }
186 tmp++;
187 }
188 else { tmp += layer_.superLayer().nWire(); }
189 return tmp;
190}
191
192// Check left and right side to see if there is hit valid
194 if ( ( ( **( neighbor_ + 2 ) ).state_ & WireHit ) &&
195 ( ( **( neighbor_ + 3 ) ).state_ & WireHit ) )
196 {
197 state_ |= WireHitInvalid;
198 ( **( neighbor_ + 2 ) ).state_ |= WireHitInvalid;
199 ( **( neighbor_ + 3 ) ).state_ |= WireHitInvalid;
200 }
201}
HepGeom::Point3D< double > HepPoint3D
const double L49_2
HepGeom::Point3D< double > HepPoint3D
const KalFitSuper_Mdc & superLayer(void) const
returns super-layer
const int nWire(void) const
returns number of wires
~KalFitWire(void)
destructor
KalFitWire(const int localID, const KalFitLayer_Mdc &layer, const HepPoint3D &fwd, const HepPoint3D &bck, KalFitWire *const vt, unsigned int geoID, unsigned int stereo)
constructor
void sagcoef(void)
void chk_left_and_right(void)