BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/KalFitWire.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// File from KalFit module
3//
4// Filename : KalFitWires.cc
5//------------------------------------------------------------------------
6// Description :
7//------------------------------------------------------------------------
8// Modif :
9//------------------------------------------------------------------------
10#ifndef _DEFINE_WIRE_H_
11#define _DEFINE_WIRE_H_
12
13#define WireHit 1
14#define WireHitInvalid 2
15#define WireHitAppended 4
16#define WireHitAppendedorInvalid 6
17#define WireNeighbor0 8
18#define WireNeighbor1 16
19#define WireNeighbor2 32
20#define WireNeighbor3 64
21#define WireNeighbor4 128
22#define WireNeighbor5 256
23
24#ifndef M_PI
25#define M_PI 3.14159265358979323846
26#endif
27
28#include "KalFitAlg/lpav/Lpav.h"
29
30//#ifndef CLHEP_POINT3D_H
31#include "CLHEP/Geometry/Point3D.h"
32#ifndef ENABLE_BACKWARDS_COMPATIBILITY
34#endif
35//#endif
36#include "KalFitAlg/KalFitLayer_Mdc.h"
37
38 using CLHEP::HepVector;
39 using CLHEP::Hep3Vector;
40 using CLHEP::HepMatrix;
41 using CLHEP::HepSymMatrix;
42
43 using namespace CLHEP;
44
45/// Description of a Wire class
46class KalFitWire{
47
48 enum { NREGION = 3 };
49 static const double A[NREGION];
50 enum { NLAYER = 50 };
51 static const double F[NLAYER];
52
53public:
54 /// constructor
55 KalFitWire(const int localID,
56 const KalFitLayer_Mdc & layer,
57 const HepPoint3D & fwd,
58 const HepPoint3D & bck,
59 KalFitWire * const vt,
60 unsigned int geoID,
61 unsigned int stereo);
62
64
65 /// destructor
67
68 /// Extractor :
69 unsigned int localId(void) const { return localId_; }
70 const KalFitLayer_Mdc & layer(void) const { return layer_; }
71 KalFitWire ** neighborPtr(void) {return neighbor_;}
72 unsigned int state(void) const { return state_; }
73 unsigned stateAND(const unsigned mask) const;
74 unsigned int geoID(void) const { return geoID_; }
75 unsigned int stereo(void) const { return stereo_; }
76
77 /// returns drift distance
78 double distance(void) const;
79
80 /// returns z_distance from the center of wire by drift distance
81 double distance_z(void) const;
82
83 void state(const unsigned int i) { state_=i; }
84 void stateOR(const unsigned mask);
85 void stateXOR(const unsigned mask);
86 void stateORXOR(const unsigned mask);
87 void sagcoef(void);
88 void ddl(const double d) { ddl_ = d; }
89 void ddr(const double d) { ddr_ = d; }
90
91 /// Geometry :
92 HepPoint3D fwd(void) const { return fwd_; }
93 HepPoint3D bck(void) const { return bck_; }
94 HepPoint3D xyPosition(void) const { return xyPosition_; }
95 double Acoef(void) const { return A_; }
96 double lzx(void) const { return lzx_; }
98
99 //
100 double x(void) const { return x_;}
101 double y(void) const { return y_;}
102
103 /// returns z for track la
104 int z(const Lpav & la, double & z) const;
105
106 double phi(void) const;
107
108 /// set drift distance
109 double distance(const double distance);
110
111private:
112 const KalFitWire * left(void) const;
113 const KalFitWire * right(void) const;
114 const KalFitWire * innerLeft(KalFitWire * const vtWire) const;
115 const KalFitWire * innerRight(KalFitWire * const vtWire) const;
116 const KalFitWire * outerLeft(KalFitWire * const vtWire) const;
117 const KalFitWire * outerRight(KalFitWire * const vtWire) const;
118
119private:
120 int localId_;
121 double A_;
122 double lzx_;
123 HepPoint3D fwd_;
124 HepPoint3D bck_;
125 const KalFitLayer_Mdc & layer_;
126 HepPoint3D xyPosition_;
127 unsigned int state_;
128 KalFitWire * neighbor_[6];
129 unsigned int geoID_;
130 unsigned int stereo_;
131 double ddl_, ddr_;
132 double distance_;
133 double x_;
134 double y_;
135 double dx_;
136 double dy_;
137
138};
139
140#ifdef KalFitWire_NO_INLINE
141#define inline
142#else
143#undef inline
144#define KalFitWire_INLINE_DEFINE_HERE
145#endif
146
147#ifdef KalFitWire_INLINE_DEFINE_HERE
148inline
149unsigned KalFitWire::stateAND(const unsigned mask) const
150{
151 return state_&mask;
152}
153
154inline
155void
156KalFitWire::stateOR(const unsigned mask)
157{
158 state_|=mask;
159}
160
161inline
162void
163KalFitWire::stateXOR(const unsigned mask)
164{
165 state_^=mask;
166}
167
168inline
169void
170KalFitWire::stateORXOR(const unsigned mask)
171{
172 state_=(state_|mask)^mask;
173}
174
175inline
176double
177KalFitWire::phi(void) const
178{
179 return M_PI*(layer_.offset()+2*localId_)/(double)layer_.superLayer().nWire();
180}
181
182inline
183double
184KalFitWire::distance(void) const
185{
186 return distance_;
187}
188
189inline
190double
191KalFitWire::distance_z(void) const
192{
193 return distance_ * fabs(layer_.tanSlant());
194}
195
196inline
197double
198KalFitWire::distance(const double distance)
199{
200 return distance_ = distance;
201}
202
203inline
204int
205KalFitWire::z(const Lpav & la, double & z) const{
206 HepVector center = la.center();
207 double rho = la.radius();
208 double dx2 = center(1) - x_;
209 double dy2 = center(2) - y_;
210 double par1 = dx_*dx_ + dy_*dy_;
211 double par2 = (dx_*dx2 + dy_*dy2)/par1;
212 double par3 = dx_*dy2 - dy_*dx2;
213 double par4 = rho*rho*par1 - par3*par3;
214 if (par4<0.) return 0;
215 par4 = sqrt(par4)/par1;
216 double delta = par2 + par4;
217 if (delta>=0. && delta<1.){
218 z = layer_.zb()+delta*(layer_.zf()-layer_.zb());
219 return 1;
220 }else{
221 delta = par2 - par4;
222 if (delta>=0. && delta<1.){
223 z = layer_.zb()+delta*(layer_.zf()-layer_.zb());
224 return 1;
225 }
226 }
227 return 0;
228}
229
230#endif
231#undef inline
232
233#endif /* _DEFINE_WIRE_H_ */
const double tanSlant(void) const
returns tangent of slant angle
const double zb(void) const
returns z of backward end-plate
const double zf(void) const
returns z of forward end-plate
const KalFitSuper_Mdc & superLayer(void) const
returns super-layer
const int offset(void) const
returns offset of numbering(local ID)
const int nWire(void) const
returns number of wires
~KalFitWire(void)
destructor
double distance_z(void) const
returns z_distance from the center of wire by drift distance
void stateORXOR(const unsigned mask)
double distance(void) const
returns drift distance
void stateXOR(const unsigned mask)
void stateOR(const unsigned mask)
KalFitWire(const int localID, const KalFitLayer_Mdc &layer, const HepPoint3D &fwd, const HepPoint3D &bck, KalFitWire *const vt, unsigned int geoID, unsigned int stereo)
constructor
double phi(void) const
double distance(const double distance)
set drift distance
void sagcoef(void)
HepPoint3D fwd(void) const
Geometry :
int z(const Lpav &la, double &z) const
returns z for track la
unsigned stateAND(const unsigned mask) const
void chk_left_and_right(void)
const KalFitLayer_Mdc & layer(void) const