CGEM BOSS 6.6.5.i
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_;
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
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.
Description of a track class (<- Helix.cc)
Definition KalFitTrack.h:36
double * pathl(void)
~KalFitTrack(void)
destructor
void chiSq(double c)
static void setMdcDigiCol(MdcDigiCol *digicol)
static int lead(void)
Magnetic field map.
void chiSq_back(double c)
double r_max(void) const
CLHEP::Hep3Vector * mom(void)
double getDriftTime(KalFitHitMdc &hitmdc, double toftime) const
static double chi2_hitf_
Cut chi2 for each hit.
KalFitTrack(const HepPoint3D &pivot, const CLHEP::HepVector &a, const CLHEP::HepSymMatrix &Ea, unsigned int m, double chiSq, unsigned int nhits)
constructor
static double dchi2cuts_anal[43]
Definition KalFitTrack.h:58
int type(void) const
unsigned int nchits(void) const
void nster(int n)
static double dchi2cuts_calib[43]
Definition KalFitTrack.h:60
ClusterRefVec getClusterRefVec()
double tof_proton(void) const
static int debug_
for debug
static int nmass(void)
double filter(double v_m, const CLHEP::HepVector &m_H, double v_d, double m_V)
int nLayerUsed()
double tof_kaon(void) const
double tof(void) const
int insist(void) const
Extractor :
double update_hits(KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
static double Bznom_
double path_rd(void) const
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
int ndf_back(void) const
int nhit_r(void) const
double path_ab(void) const
const HepPoint3D & point_last(void)
unsigned int ncath(void) const
static int nmdc_hit2_
Cut chi2 for each hit.
double getSigma(int layerId, double driftDist) const
static int tofall_
double dchi2_max(void) const
KalFitHelixSeg & HelixSeg(int i)
void addTofSM(double time)
double PathL(int layer)
Function to calculate the path length in the layer.
void p_proton(double pl)
void add_nhit_r(void)
static int resolflag_
wire resoltion flag
static int steplev_
void chgmass(int i)
static double factor_strag_
factor of energy loss straggling for electron
int trasan_id(void) const
void useLayer(int iLay)
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.
int pat2(void) const
void update_forMdc(void)
double intersect_cylinder(double r) const
Intersection with different geometry.
double chiSq_back(void) const
void nchits(int n)
void insist(int t)
double getFiTerm(void)
const CLHEP::HepSymMatrix & Ea_last(void) const
void trasan_id(int t)
void resetLayerUsed()
double getDigi() const
double getPathSM(void)
void ndf_back(int n)
vector< KalFitHitMdc > & HitsMdc(void)
void setClusterRefVec(ClusterRefVec clusterRefVec)
double pathip(void) const
void fiTerm(double fi)
void point_last(const HepPoint3D &point)
set and give out the last point of the track
static double chi2mdc_hit2_
int pat1(void) const
void HelixSegs(vector< KalFitHelixSeg > &vs)
static double chi2_hits_
int nhit_z(void) const
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.
void path_add(double path)
Update the path length estimation.
unsigned int nster(void) const
static int inner_steps_
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
static int outer_steps_
const CLHEP::HepVector & a_last(void) const
double p_proton(void) const
void p_kaon(double pl)
double update_hits_csmalign(KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
const HepPoint3D & pivot_forMdc(void) const
static int drifttime_choice_
the drifttime choice
const CLHEP::HepSymMatrix & Ea_forMdc(void) const
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
void appendHitsMdc(KalFitHitMdc h)
Functions for Mdc hits list.
void addPathSM(double path)
static double mdcGasRadlen_
double cor_tanldep(double *p, double er)
Correct the error according the current tanl value :
static double dchi2cutf_calib[43]
Definition KalFitTrack.h:59
static int resol(void)
const CLHEP::HepVector & a_forMdc(void) const
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
double intersect_zx_plane(const HepTransform3D &plane, double y) const
static void setT0(double t0)
static void setMagneticFieldSvc(IMagneticFieldSvc *)
double getTofSM(void)
static int numfcor_
NUMF treatment improved.
void add_nhit_z(void)
void order_hits(void)
double intersect_xy_plane(double z) const
void pathip(double pl)
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)
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:57
static int LR_
Use L/R decision from MdcRecHit information :
vector< KalFitHelixSeg > & HelixSegs(void)
double p_kaon(void) const
const HepPoint3D & pivot_last(void) const
returns helix parameters
KalFitHitMdc & HitMdc(int i)
static int strag_
Flag to take account of energy loss straggling :
const HepSymMatrix & Ea(void) const
returns error matrix.
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