BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitTrack.h
Go to the documentation of this file.
1#ifndef _DEFINE_KALFITTRACK_H_
2#define _DEFINE_KALFITTRACK_H_
3#ifndef DBL_MAX
4#define DBL_MAX 9999
5#endif
6#ifndef ENABLE_BACKWARDS_COMPATIBILITY
7typedef HepGeom::Transform3D HepTransform3D;
8#endif
9
10//#include "TrackUtil/Helix.h"
13#include "CLHEP/Geometry/Transform3D.h"
14#include "CLHEP/Geometry/Point3D.h"
15#include "CLHEP/Matrix/Vector.h"
16#include "CLHEP/Matrix/Matrix.h"
22#include "MdcRawEvent/MdcDigi.h"
23#include "EventModel/Event.h"
24
25//class HepTransform3D;
26class KalFitMaterial;
27
28
29using namespace KalmanFit;
30using namespace CLHEP;
31
32
33/// Description of a track class (<- Helix.cc)
34class KalFitTrack : public Helix
35{
36 int type_; // track with hits in pattern recognition (=1)
37 double mass_;
38 int trasan_id_;
39 int l_mass_;
40 int insist_;
41 double chiSq_;
42 unsigned int nchits_, nster_, ncath_, ndf_back_;
43 double chiSq_back_, pathip_, path_rd_,
44 path_ab_, tof_, dchi2_max_, r_max_;
45 double tof_kaon_, tof_proton_;
46 double p_kaon_, p_proton_;
47 double r0_;
48 double PathL_[43];
49 double pathSM_;
50 double fiTerm_;
51 double tof2_;
52
53 CLHEP::Hep3Vector mom_[43];
54 int pat1_, pat2_;
55 int layer_prec_;
56 int nhit_r_, nhit_z_;
57
58 // Information at the last hit included :
59 HepPoint3D pivot_last_;
60 CLHEP::HepVector a_last_;
61 CLHEP::HepSymMatrix Ea_last_;
62 HepPoint3D point_last_;
63
64
65 // Information at the inned hit of Mdc :
66 HepPoint3D pivot_forMdc_;
67 CLHEP::HepVector a_forMdc_;
68 CLHEP::HepSymMatrix Ea_forMdc_;
69 vector<KalFitHitMdc> HitsMdc_;
70 //it is used to for record the intermediate info. of fwd-filter and bwd-filter
71 vector<KalFitHelixSeg> HelixSegs_;
72
73 enum { NMASS = 5 };
74 static const double MASS[NMASS];
75
76 /// Flags
77 static int lead_, back_;
78 // the used svcs for this track
79 static const MdcCalibFunSvc* CalibFunSvc_;
80 static const IMagneticFieldSvc* MFSvc_;
81 static IMdcGeomSvc* iGeomSvc_;
82 static double EventT0_;
83 static HepSymMatrix initMatrix_;
84 static MdcDigiCol* mdcDigiCol_ ;
85public:
86 /// constructor
88 const CLHEP::HepVector& a,
89 const CLHEP::HepSymMatrix& Ea,
90 unsigned int m,
91 double chiSq,
92 unsigned int nhits);
93
94 /// destructor
95 ~KalFitTrack(void);
96
97 /// Intersection with different geometry
98 double intersect_cylinder(double r) const;
99 double intersect_yz_plane(const HepTransform3D& plane,
100 double x) const;
101 double intersect_zx_plane(const HepTransform3D& plane,
102 double y) const;
103 double intersect_xy_plane(double z) const;
104
105 /// Calculate multiple scattering angle
106 void msgasmdc(double path, int index);
107 void ms(double path,
108 const KalFitMaterial& m, int index);
109
110 /// Calculate total energy lost in material
111 void eloss(double path,
112 const KalFitMaterial& m, int index);
113
114 /// Kalman smoother for Mdc
115 double smoother_Mdc(KalFitHelixSeg& seg, CLHEP::Hep3Vector& meas, int& flg, int csmflag);
116 double smoother_Mdc_csmalign(KalFitHelixSeg& seg, CLHEP::Hep3Vector& meas, int& flg, int csmflag );
117 double smoother_Mdc(KalFitHitMdc& HitMdc, CLHEP::Hep3Vector& meas, KalFitHelixSeg& seg, double& dchi2, int csmflag);
118
119 /// Include the Mdc wire hits
120
121 double update_hits(KalFitHitMdc& HitMdc, int inext, CLHEP::Hep3Vector& meas, int way, double& dchi2, double& dtrack, double& dtracknew, double& dtdc, int csmflag);
122
123 double update_hits(KalFitHelixSeg& HelixSeg, int inext, CLHEP::Hep3Vector& meas, int way, double& dchi2, int csmflag);
124 double update_hits_csmalign(KalFitHelixSeg& HelixSeg, int inext, CLHEP::Hep3Vector& meas, int way, double& dchi2,int csmflag );
125 double chi2_next(Helix& H, KalFitHitMdc & HitMdc, int csmflag);
126 double chi2_next(Helix& H, KalFitHitMdc & HitMdc);
127
128
129
130 ///
131 //double approach(KalFitHitMdc& hit, bool doSagCorrection) const;
132
133 //double approach(HepPoint3D pfwd, HepPoint3D pbwd, bool doSagCorrection) const;
134
135
136 /// Record the current parameters as ..._last information :
137 void update_last(void);
138 void update_forMdc(void);
139
140 /// set and give out the last point of the track
141 void point_last(const HepPoint3D& point) { point_last_ = point;}
142 const HepPoint3D& point_last(void) { return point_last_;}
143
144
145 /// returns helix parameters
146 const HepPoint3D & pivot_last(void) const{ return pivot_last_; }
147 const CLHEP::HepVector & a_last(void) const{ return a_last_; }
148 const CLHEP::HepSymMatrix & Ea_last(void) const{ return Ea_last_; }
149
150 const HepPoint3D & pivot_forMdc(void) const{ return pivot_forMdc_;}
151 const CLHEP::HepVector & a_forMdc(void) const{ return a_forMdc_; }
152 const CLHEP::HepSymMatrix & Ea_forMdc(void) const{ return Ea_forMdc_; }
153
154 /// Update the path length estimation
155 void path_add(double path);
156
157 void addPathSM(double path);
158 double getPathSM(void) { return pathSM_;}
159
160 void addTofSM(double time);
161 double getTofSM(void) { return tof2_;}
162
163 void fiTerm(double fi);
164 double getFiTerm(void) { return fiTerm_;}
165
166 /// Update the tof estimation
167 void tof(double path);
168 ///
169 double filter(double v_m, const CLHEP::HepVector& m_H,
170 double v_d, double m_V);
171
172 /// Correct the error according the current tanl value :
173 double cor_tanldep(double* p, double er);
174
175 void update_bit(int i);
176
177 /// Extractor :
178 int insist(void) const { return insist_; }
179 int type(void) const { return type_; }
180 int trasan_id(void) const { return trasan_id_; }
181 double r0(void) const { return r0_; }
182 double mass(void) const { return mass_; }
183 double chiSq(void) const { return chiSq_; }
184 double chiSq_back(void) const { return chiSq_back_; }
185 int ndf_back(void) const { return ndf_back_; }
186 double pathip(void) const { return pathip_; }
187 double path_rd(void) const { return path_rd_; }
188 double path_ab(void) const { return path_ab_; }
189 double* pathl(void) { return PathL_; }
190 CLHEP::Hep3Vector* mom(void) { return mom_; }
191 double tof(void) const { return tof_; }
192 double tof_kaon(void) const { return tof_kaon_; }
193 double tof_proton(void) const { return tof_proton_; }
194 double p_kaon(void) const { return p_kaon_; }
195 double p_proton(void) const { return p_proton_; }
196 double dchi2_max(void) const { return dchi2_max_; }
197 double r_max(void) const { return r_max_; }
198 unsigned int nchits(void) const { return nchits_; }
199 unsigned int nster(void) const { return nster_; }
200 unsigned int ncath(void) const { return ncath_; }
201 int pat1(void) const { return pat1_; }
202 int pat2(void) const { return pat2_; }
203 int nhit_r(void) const { return nhit_r_; }
204 int nhit_z(void) const { return nhit_z_; }
205
206 /// Reinitialize (modificator)
207 void type(int t){ type_ = t;}
208 void trasan_id(int t){ trasan_id_ = t;}
209 void insist(int t){ insist_ = t;}
210
211 void pathip(double pl){ pathip_ = pl;}
212 void p_kaon(double pl){ p_kaon_ = pl;}
213 void p_proton(double pl){ p_proton_ = pl;}
214 void chiSq(double c){ chiSq_ = c; }
215 void chiSq_back(double c){ chiSq_back_ = c; }
216 void ndf_back(int n){ ndf_back_ = n; }
217 void nchits(int n){ nchits_ = n; }
218 void nster(int n){ nster_ = n; }
219
220 void add_nhit_r(void) { nhit_r_++;}
221 void add_nhit_z(void) { nhit_z_++;}
222
223 /// Function to calculate the path length in the layer
224 double PathL(int layer);
225
226 /// Functions for Mdc hits list
228 void HitsMdc(vector<KalFitHitMdc>& lh);
229 vector<KalFitHitMdc>& HitsMdc(void) { return HitsMdc_;}
230 KalFitHitMdc& HitMdc(int i) { return HitsMdc_[i];}
231
233 void HelixSegs(vector<KalFitHelixSeg>& vs);
234 vector<KalFitHelixSeg>& HelixSegs(void) { return HelixSegs_;}
235 KalFitHelixSeg& HelixSeg(int i) { return HelixSegs_[i];}
236
237 /// Modifier
238 /// Order the wire hits for mdc track
239 void order_wirhit(int index);
240 void order_hits(void);
241 void number_wirhit(void);
242
243 /// Sets pivot position in a given mag field
244 const HepPoint3D & pivot_numf(const HepPoint3D & newPivot);
245 const HepPoint3D & pivot_numf(const HepPoint3D & newPivot, double & pathl);
246
247 /// Estimation of the radius in a given mag field
248 double radius_numf(void) const;
249
250 //temporily for wire resolution, use service in future
251 double getSigma(int layerId, double driftDist ) const;
252
253 // call from calibration service
254 double getSigma(KalFitHitMdc& hitmdc, double tanlam, int lr, double dist) const;
255 double getDriftDist(KalFitHitMdc& hitmdc, double drifttime, int lr) const;
256
257 double getDriftTime(KalFitHitMdc& hitmdc , double toftime) const;
258
259 // event start time
260 static void setT0(double t0);
261 double getT0(void) const;
262
263 static void setInitMatrix(HepSymMatrix m);
264 HepSymMatrix getInitMatrix(void) const;
265
266 double getDigi() const;
267
268 //for get service
269 static void setMdcCalibFunSvc(const MdcCalibFunSvc* calibsvc);
271 static void setIMdcGeomSvc( IMdcGeomSvc* igeomsvc);
272 static void setMdcDigiCol(MdcDigiCol* digicol);
273
274 static double mdcGasRadlen_;
275
276 /// for signal propagation correction
277 static int tprop_;
278
279 /// for debug
280 static int debug_;
281 /// Cut chi2 for each hit
282 static double chi2_hitf_, chi2_hits_;
283 /// Flag for treatment of non-uniform mag field
284 static int numf_;
285 static int inner_steps_;
286 static int outer_steps_;
287
288 static double dchi2cutf_anal[43];
289
290 static double dchi2cuts_anal[43];
291
292 static double dchi2cutf_calib[43];
293
294 static double dchi2cuts_calib[43];
295
296 /// NUMF treatment improved
297 static int numfcor_;
298 // Nominal mag field
299 static double Bznom_;
300 /// Level of precision (= 1 : 5steps for all tracks; = 2: 5 steps for
301 /// very non uniform part)
302 static int steplev_;
303
304 /// Flag for TOF correction
305 static int Tof_correc_;
306
307 /// Flag to take account of energy loss straggling :
308 static int strag_;
309 /// factor of energy loss straggling for electron
310 static double factor_strag_;
311 /// Cut chi2 for each hit
312 static int nmdc_hit2_;
313 static double chi2mdc_hit2_;
314 static int tofall_;
315 /// wire resoltion flag
316 static int resolflag_;
317
318 /// Use L/R decision from MdcRecHit information :
319 static int LR_;
320 /// the drifttime choice
322 static int nmass(void);
323 static double mass(int i);
324 void chgmass(int i);
325 static void LR(int x);
326 /// Magnetic field map
327 static int lead(void);
328 static void lead(int i);
329 static int back(void);
330 static void back(int i);
331 static int resol(void);
332 static void resol(int i);
333 static int numf(void);
334 static void numf(int i);
335
337 {
338 int n=0;
339 for(int i=0; i<43; i++) n+=myLayerUsed[i];
340 return n;
341 }
342
344 for(int i=0; i<43; i++) myLayerUsed[i]=0;
345 }
346
347 void useLayer(int iLay) {
348 if(iLay>=0 && iLay<=43) myLayerUsed[iLay]=1;
349 }
350
351
352private:
353 int myLayerUsed[43];
354
355
356};
357
358#endif
359
const Int_t n
Double_t time
XmlRpcServer s
Definition: HelloServer.cpp:11
HepGeom::Transform3D HepTransform3D
Definition: KalFitTrack.h:7
ObjectVector< MdcDigi > MdcDigiCol
Definition: MdcDigi.h:39
Description of a Hit in Mdc.
Definition: KalFitHitMdc.h:17
Description of a track class (<- Helix.cc)
Definition: KalFitTrack.h:35
double * pathl(void)
Definition: KalFitTrack.h:189
~KalFitTrack(void)
destructor
void chiSq(double c)
Definition: KalFitTrack.h:214
double chi2_next(Helix &H, KalFitHitMdc &HitMdc, int csmflag)
static void setMdcDigiCol(MdcDigiCol *digicol)
static int lead(void)
Magnetic field map.
void chiSq_back(double c)
Definition: KalFitTrack.h:215
double r_max(void) const
Definition: KalFitTrack.h:197
CLHEP::Hep3Vector * mom(void)
Definition: KalFitTrack.h:190
double getDriftTime(KalFitHitMdc &hitmdc, double toftime) const
static double chi2_hitf_
Cut chi2 for each hit.
Definition: KalFitTrack.h:282
static double dchi2cuts_anal[43]
Definition: KalFitTrack.h:290
int type(void) const
Definition: KalFitTrack.h:179
unsigned int nchits(void) const
Definition: KalFitTrack.h:198
void nster(int n)
Definition: KalFitTrack.h:218
static double dchi2cuts_calib[43]
Definition: KalFitTrack.h:294
double tof_proton(void) const
Definition: KalFitTrack.h:193
static int debug_
for debug
Definition: KalFitTrack.h:280
static int nmass(void)
double filter(double v_m, const CLHEP::HepVector &m_H, double v_d, double m_V)
int nLayerUsed()
Definition: KalFitTrack.h:336
double tof_kaon(void) const
Definition: KalFitTrack.h:192
double tof(void) const
Definition: KalFitTrack.h:191
int insist(void) const
Extractor :
Definition: KalFitTrack.h:178
double update_hits(KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
static double Bznom_
Definition: KalFitTrack.h:299
double path_rd(void) const
Definition: KalFitTrack.h:187
static int back(void)
void update_bit(int i)
void order_wirhit(int index)
HepSymMatrix getInitMatrix(void) const
static void setInitMatrix(HepSymMatrix m)
double chiSq(void) const
Definition: KalFitTrack.h:183
int ndf_back(void) const
Definition: KalFitTrack.h:185
int nhit_r(void) const
Definition: KalFitTrack.h:203
double path_ab(void) const
Definition: KalFitTrack.h:188
const HepPoint3D & point_last(void)
Definition: KalFitTrack.h:142
unsigned int ncath(void) const
Definition: KalFitTrack.h:200
static int nmdc_hit2_
Cut chi2 for each hit.
Definition: KalFitTrack.h:312
double getSigma(int layerId, double driftDist) const
static int tofall_
Definition: KalFitTrack.h:314
double dchi2_max(void) const
Definition: KalFitTrack.h:196
KalFitHelixSeg & HelixSeg(int i)
Definition: KalFitTrack.h:235
void addTofSM(double time)
double PathL(int layer)
Function to calculate the path length in the layer.
void p_proton(double pl)
Definition: KalFitTrack.h:213
void add_nhit_r(void)
Definition: KalFitTrack.h:220
static int resolflag_
wire resoltion flag
Definition: KalFitTrack.h:316
static int steplev_
Definition: KalFitTrack.h:302
void chgmass(int i)
static double factor_strag_
factor of energy loss straggling for electron
Definition: KalFitTrack.h:310
int trasan_id(void) const
Definition: KalFitTrack.h:180
void useLayer(int iLay)
Definition: KalFitTrack.h:347
const HepPoint3D & pivot_numf(const HepPoint3D &newPivot)
Sets pivot position in a given mag field.
void ms(double path, const KalFitMaterial &m, int index)
static int Tof_correc_
Flag for TOF correction.
Definition: KalFitTrack.h:305
int pat2(void) const
Definition: KalFitTrack.h:202
void update_forMdc(void)
double intersect_cylinder(double r) const
Intersection with different geometry.
double chiSq_back(void) const
Definition: KalFitTrack.h:184
void nchits(int n)
Definition: KalFitTrack.h:217
void insist(int t)
Definition: KalFitTrack.h:209
double getFiTerm(void)
Definition: KalFitTrack.h:164
const CLHEP::HepSymMatrix & Ea_last(void) const
Definition: KalFitTrack.h:148
void trasan_id(int t)
Definition: KalFitTrack.h:208
void resetLayerUsed()
Definition: KalFitTrack.h:343
double getDigi() const
double getPathSM(void)
Definition: KalFitTrack.h:158
void ndf_back(int n)
Definition: KalFitTrack.h:216
vector< KalFitHitMdc > & HitsMdc(void)
Definition: KalFitTrack.h:229
double pathip(void) const
Definition: KalFitTrack.h:186
void fiTerm(double fi)
void point_last(const HepPoint3D &point)
set and give out the last point of the track
Definition: KalFitTrack.h:141
static double chi2mdc_hit2_
Definition: KalFitTrack.h:313
int pat1(void) const
Definition: KalFitTrack.h:201
void HelixSegs(vector< KalFitHelixSeg > &vs)
static double chi2_hits_
Definition: KalFitTrack.h:282
int nhit_z(void) const
Definition: KalFitTrack.h:204
double getT0(void) const
void number_wirhit(void)
static int numf_
Flag for treatment of non-uniform mag field.
Definition: KalFitTrack.h:284
void path_add(double path)
Update the path length estimation.
unsigned int nster(void) const
Definition: KalFitTrack.h:199
static int inner_steps_
Definition: KalFitTrack.h:285
void appendHelixSegs(KalFitHelixSeg s)
double smoother_Mdc(KalFitHitMdc &HitMdc, CLHEP::Hep3Vector &meas, KalFitHelixSeg &seg, double &dchi2, int csmflag)
static void setMdcCalibFunSvc(const MdcCalibFunSvc *calibsvc)
double mass(void) const
Definition: KalFitTrack.h:182
static int outer_steps_
Definition: KalFitTrack.h:286
const CLHEP::HepVector & a_last(void) const
Definition: KalFitTrack.h:147
double p_proton(void) const
Definition: KalFitTrack.h:195
void p_kaon(double pl)
Definition: KalFitTrack.h:212
double update_hits_csmalign(KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
const HepPoint3D & pivot_forMdc(void) const
Definition: KalFitTrack.h:150
static int drifttime_choice_
the drifttime choice
Definition: KalFitTrack.h:321
const CLHEP::HepSymMatrix & Ea_forMdc(void) const
Definition: KalFitTrack.h:152
double smoother_Mdc(KalFitHelixSeg &seg, CLHEP::Hep3Vector &meas, int &flg, int csmflag)
Kalman smoother for Mdc.
void msgasmdc(double path, int index)
Calculate multiple scattering angle.
static int tprop_
for signal propagation correction
Definition: KalFitTrack.h:277
void appendHitsMdc(KalFitHitMdc h)
Functions for Mdc hits list.
void addPathSM(double path)
static double mdcGasRadlen_
Definition: KalFitTrack.h:274
double cor_tanldep(double *p, double er)
Correct the error according the current tanl value :
static double dchi2cutf_calib[43]
Definition: KalFitTrack.h:292
static int resol(void)
const CLHEP::HepVector & a_forMdc(void) const
Definition: KalFitTrack.h:151
void eloss(double path, const KalFitMaterial &m, int index)
Calculate total energy lost in material.
void update_last(void)
Record the current parameters as ..._last information :
static void LR(int x)
double getDriftDist(KalFitHitMdc &hitmdc, double drifttime, int lr) const
double intersect_yz_plane(const HepTransform3D &plane, double x) const
static int numf(void)
double r0(void) const
Definition: KalFitTrack.h:181
double intersect_zx_plane(const HepTransform3D &plane, double y) const
static void setT0(double t0)
static void setMagneticFieldSvc(IMagneticFieldSvc *)
double getTofSM(void)
Definition: KalFitTrack.h:161
static int numfcor_
NUMF treatment improved.
Definition: KalFitTrack.h:297
void add_nhit_z(void)
Definition: KalFitTrack.h:221
void order_hits(void)
double intersect_xy_plane(double z) const
void pathip(double pl)
Definition: KalFitTrack.h:211
static void setIMdcGeomSvc(IMdcGeomSvc *igeomsvc)
double radius_numf(void) const
Estimation of the radius in a given mag field.
double smoother_Mdc_csmalign(KalFitHelixSeg &seg, CLHEP::Hep3Vector &meas, int &flg, int csmflag)
void type(int t)
Reinitialize (modificator)
Definition: KalFitTrack.h:207
double update_hits(KalFitHitMdc &HitMdc, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, double &dtrack, double &dtracknew, double &dtdc, int csmflag)
Include the Mdc wire hits.
static double dchi2cutf_anal[43]
Definition: KalFitTrack.h:288
static int LR_
Use L/R decision from MdcRecHit information :
Definition: KalFitTrack.h:319
vector< KalFitHelixSeg > & HelixSegs(void)
Definition: KalFitTrack.h:234
double p_kaon(void) const
Definition: KalFitTrack.h:194
const HepPoint3D & pivot_last(void) const
returns helix parameters
Definition: KalFitTrack.h:146
KalFitHitMdc & HitMdc(int i)
Definition: KalFitTrack.h:230
static int strag_
Flag to take account of energy loss straggling :
Definition: KalFitTrack.h:308
const HepSymMatrix & Ea(void) const
returns error matrix.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & pivot(void) const
returns pivot position.
IMPLICIT REAL *A H
Definition: myXsection.h:1
int t()
Definition: t.c:1