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