BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/KalFitAlg/KalFitAlg/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"
11#include "KalFitAlg/helix/Helix.h"
12#include "KalFitAlg/coil/Bfield.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"
17#include "KalFitAlg/KalFitHitMdc.h"
18#include "KalFitAlg/KalFitHelixSeg.h"
19#include "MdcCalibFunSvc/MdcCalibFunSvc.h"
20#include "MagneticField/IMagneticFieldSvc.h"
21#include "MagneticField/MagneticFieldSvc.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
ObjectVector< MdcDigi > MdcDigiCol
Description of a track class (<- Helix.cc)
~KalFitTrack(void)
destructor
double chi2_next(Helix &H, KalFitHitMdc &HitMdc, int csmflag)
static void setMdcDigiCol(MdcDigiCol *digicol)
static int lead(void)
Magnetic field map.
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 int nmass(void)
double filter(double v_m, const CLHEP::HepVector &m_H, double v_d, double m_V)
double update_hits(KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
static int back(void)
void update_bit(int i)
void order_wirhit(int index)
HepSymMatrix getInitMatrix(void) const
static void setInitMatrix(HepSymMatrix m)
static int nmdc_hit2_
Cut chi2 for each hit.
double getSigma(int layerId, double driftDist) const
void addTofSM(double time)
double PathL(int layer)
Function to calculate the path length in the layer.
void chgmass(int i)
static double factor_strag_
factor of energy loss straggling for electron
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.
void update_forMdc(void)
double intersect_cylinder(double r) const
Intersection with different geometry.
const CLHEP::HepSymMatrix & Ea_last(void) const
double getDigi() const
void fiTerm(double fi)
void point_last(const HepPoint3D &point)
set and give out the last point of the track
void HelixSegs(vector< KalFitHelixSeg > &vs)
double getT0(void) const
void number_wirhit(void)
static int numf_
Flag for treatment of non-uniform mag field.
void path_add(double path)
Update the path length estimation.
void appendHelixSegs(KalFitHelixSeg s)
double smoother_Mdc(KalFitHitMdc &HitMdc, CLHEP::Hep3Vector &meas, KalFitHelixSeg &seg, double &dchi2, int csmflag)
static void setMdcCalibFunSvc(const MdcCalibFunSvc *calibsvc)
const CLHEP::HepVector & a_last(void) const
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)
double cor_tanldep(double *p, double er)
Correct the error according the current tanl value :
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 intersect_zx_plane(const HepTransform3D &plane, double y) const
static void setT0(double t0)
static void setMagneticFieldSvc(IMagneticFieldSvc *)
static int numfcor_
NUMF treatment improved.
void order_hits(void)
double intersect_xy_plane(double z) const
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 int LR_
Use L/R decision from MdcRecHit information :
vector< KalFitHelixSeg > & HelixSegs(void)
const HepPoint3D & pivot_last(void) const
returns helix parameters
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