BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
THelixFitter.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: THelixFitter.h,v 1.14 2012/05/28 05:16:29 maoh Exp $
3//-----------------------------------------------------------------------------
4// Filename : THelixFitter.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to fit a TTrackBase object to a helix.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef THELIXFITTER_FLAG_
14#define THELIXFITTER_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17#ifndef TRKRECO_DEBUG
18#define TRKRECO_DEBUG
19#endif
20#endif
21#define HEP_SHORT_NAMES
22#include "CLHEP/Matrix/Vector.h"
23//#include "helix/Helix.h"
24//#include "TrkReco/Helix.h"
25#include "TrackUtil/Helix.h"
26#include "TrkReco/TMFitter.h"
27#include "TrkReco/TTrackBase.h"
28
31
32#include "CLHEP/Matrix/SymMatrix.h"
33#include "CLHEP/Vector/ThreeVector.h"
34#include "CLHEP/Vector/LorentzVector.h"
35#include "CLHEP/Geometry/Point3D.h"
36
37
38class TMLink;
39
40using CLHEP::HepVector;
41
42//...Drift time correction method...
43#define TrackFitNoCorrection 0
44#define TrackFitCorrectOnce 1
45#define TrackFitCorrectEveryIteration 2
46
47/// A class to fit a TTrackBase object to a helix.
48class THelixFitter : public TMFitter {
49
50 public:
51 /// Constructor.
52 THelixFitter(const std::string & name);
53
54 /// Destructor
55 virtual ~THelixFitter();
56
57 public:// Informations
58 /// dumps debug information.
59 void dump(const std::string & message = std::string(""),
60 const std::string & prefix = std::string("")) const;
61
62 public:// Options
63 /// sets/returns 2D flag.
64 bool fit2D(void) const;
65 bool fit2D(bool);
66
67 /// sets/returns free T0 flag.
68 bool freeT0(void) const;
69 bool freeT0(bool);
70
71 /// sets/returns correctin flag.
72 unsigned corrections(void) const;
73 unsigned corrections(unsigned);
74
75 public:// Options (obsolete)
76 /// sets/returns sag correction flag.
77 bool sag(void) const;
78 bool sag(bool);
79
80 /// sets/returns propagation-delay correction flag.
81 bool propagation(void) const;
82 bool propagation(bool);
83
84 /// sets/returns propagation-delay correction flag.
85 bool tof(void) const;
86 bool tof(bool);
87
88 /// sets/returns tanLambda correction flag.
89 bool tanl(void) const;
90 bool tanl(bool);
91
92 /// returns sum of chi2 before fit.
93 double preChi2(void) const;
94
95 /// returns sum of chi2 aftter fit.
96 double chi2(void) const;
97
98 IMagneticFieldSvc* getMagneticFieldPointer(void) const{return m_pmgnIMF;}
99 public:// Fitting
100 int fit(TTrackBase &) const;
101 int fit(TTrackBase &, double *pre_chi2, double *fitted_chi2) const;
102 int fit(TTrackBase &, float t0Offset, double *pre_chi2=NULL, double *fitted_chi2=NULL) const;
103 int fit(TTrackBase &, float & tev, float & tev_err, double *pre_chi2=NULL, double *fitted_chi2=NULL) const;
104
105 private:
106 /// main routine for fixed T0.
107 int main(TTrackBase &, float t0Offset, double *pre_chi2=NULL, double *fitted_chi2=NULL) const;
108
109 /// main routine for free T0.
110 int main(TTrackBase &, float & tev, float & tev_err, double *pre_chi2=NULL, double *fitted_chi2=NULL) const;
111
112 /// calculates drift distance and its error.
113 void drift(const TTrack &,
114 TMLink &,
115 float t0Offset,
116 double & distance,
117 double & itsError) const;
118//be cautious here
119 /// calculates drift distance and its error for free T0 case.
120 void drift(const TTrack &,
121 TMLink &,
122 float t0Offset,
123 double & distance,
124 double & itsError,
125 double & ddda) const;
126//be cautious here
127 /// calculates dXda. 'link' and 'dPhi' are inputs. Others are outputs.
128 // virtual
129 int dxda(const TMLink & link,
130 const Helix & helix,
131 double dPhi,
132 HepVector & dxda,
133 HepVector & dyda,
134 HepVector & dzda) const;
135
136 private:
137 bool _fit2D;
138 bool _freeT0;
139 unsigned _corrections;
140
141 bool _sag;
142 int _propagation;
143 bool _tof;
144 bool _tanl;
145
146 //jialk
147 double _driftTime;
148 mutable double _pre_chi2;
149 mutable double _fitted_chi2;
150 private:
151 mutable IMagneticFieldSvc* m_pmgnIMF;
152
153
154};
155
156//-----------------------------------------------------------------------------
157
158#ifdef TRKRECO_NO_INLINE
159#define inline
160#else
161#undef inline
162#define THELIXFITTER_INLINE_DEFINE_HERE
163#endif
164
165#ifdef THELIXFITTER_INLINE_DEFINE_HERE
166
167inline
168bool
170 return _fit2D;
171}
172
173inline
174bool
176 return _fit2D = a;
177}
178
179inline
180bool
181THelixFitter::sag(void) const {
182 return _sag;
183}
184
185inline
186bool
188 return _sag = a;
189}
190
191inline
192bool
194 return (bool) _propagation;
195}
196
197inline
198bool
200 if (a) _propagation = 1;
201 else _propagation = 0;
202 return propagation();
203}
204
205inline
206bool
207THelixFitter::tof(void) const {
208 return _tof;
209}
210
211inline
212bool
214 return _tof = a;
215}
216
217inline
218bool
220 return _tanl;
221}
222
223inline
224bool
226 return _tanl = a;
227}
228
229inline
230int
232 if (! _freeT0) return main(a, 0.);
233 else {
234 float tev = 0.;
235 float tevError;
236 return main(a, tev, tevError);
237 }
238}
239
240inline
241int
243 double *pre_chi2, double *fitted_chi2) const {
244 if (! _freeT0) return main(a, 0., pre_chi2, fitted_chi2);
245 else {
246 float tev = 0.;
247 float tevError;
248 return main(a, tev, tevError, pre_chi2, fitted_chi2);
249 }
250}
251
252inline
253int
254THelixFitter::fit(TTrackBase & a, float t0Offset,
255 double *pre_chi2, double *fitted_chi2) const {
256 a._fitted = false;
257 if (! _freeT0) return main(a, t0Offset, pre_chi2, fitted_chi2);
258 else {
259 float tev = t0Offset;
260 float tevError;
261 return main(a, tev, tevError, pre_chi2, fitted_chi2);
262 }
263}
264
265inline
266int
267THelixFitter::fit(TTrackBase & a, float & tev, float & tev_err,
268 double *pre_chi2, double *fitted_chi2) const {
269 a._fitted = false;
270 return main(a, tev, tev_err, pre_chi2, fitted_chi2);
271}
272
273inline
274bool
276 return _freeT0;
277}
278
279inline
280bool
282 return _freeT0 = a;
283}
284
285inline
286unsigned
288 return _corrections;
289}
290
291inline
292unsigned
294 return _corrections = a;
295}
296
297inline
298double
300 return _pre_chi2;
301}
302
303inline
304double
306 return _fitted_chi2;
307}
308
309#endif
310
311#undef inline
312
313#endif /* THELIXFITTER_FLAG_ */
A class to fit a TTrackBase object to a helix.
Definition: THelixFitter.h:48
double chi2(void) const
returns sum of chi2 aftter fit.
Definition: THelixFitter.h:305
virtual ~THelixFitter()
Destructor.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
bool freeT0(void) const
sets/returns free T0 flag.
Definition: THelixFitter.h:275
bool fit2D(void) const
sets/returns 2D flag.
Definition: THelixFitter.h:169
double preChi2(void) const
returns sum of chi2 before fit.
Definition: THelixFitter.h:299
unsigned corrections(void) const
sets/returns correctin flag.
Definition: THelixFitter.h:287
bool tof(void) const
sets/returns propagation-delay correction flag.
Definition: THelixFitter.h:207
int fit(TTrackBase &) const
Definition: THelixFitter.h:231
bool sag(void) const
sets/returns sag correction flag.
Definition: THelixFitter.h:181
IMagneticFieldSvc * getMagneticFieldPointer(void) const
Definition: THelixFitter.h:98
bool tanl(void) const
sets/returns tanLambda correction flag.
Definition: THelixFitter.h:219
bool propagation(void) const
sets/returns propagation-delay correction flag.
Definition: THelixFitter.h:193
A class to fit a TTrackBase object.
Definition: TMFitter.h:34
const std::string & name(void) const
returns name.
Definition: TMFitter.h:73
A virtual class for a track class in tracking.
Definition: TTrackBase.h:46
bool _fitted
Definition: TTrackBase.h:162
A class to represent a track in tracking.
Definition: TTrack.h:129
int main()
Definition: test_IFile.cxx:11