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