MarlinTPC  1.2.0
TrackFitterBase.h
1 #ifndef TRACK_FITTER_BASE_H
2 #define TRACK_FITTER_BASE_H
3 
4 #include <string>
5 #include <marlin/StringParameters.h>
6 #include <EVENT/LCRunHeader.h>
7 #include <EVENT/Track.h>
8 #include <IMPL/TrackImpl.h>
9 #include <EVENT/TrackerHit.h>
10 
11 namespace gear
12 {
13 class TPCParameters;
14 class PadRowLayout2D;
15 }//namespace gear
16 
17 namespace marlintpc
18 {
45 {
46  public:
47 
54  // These variables are static, don't forget to instantiate them in TrackFitterBase.cc
55  struct FitterTypes
56  {
57  //static const int BASE = 0;
58  static const unsigned char LIKELIHOOD = 1;
59  static const unsigned char SIMPLECHISQUARE = 2;
60  static const unsigned char SIMPLECHISQUAREPADS = 3;
61  static const unsigned char LINEARREGRESSION = 4;
62  static const unsigned char KALMAN = 5;
63  static const unsigned char SIMPLEMINIMIZER = 6;
64  static const unsigned char CHISQUARE = 7;
65  static const unsigned char SIMPLEHELIXFIT = 8;
66  };
67 
68  static const unsigned char FITFAILEDBIT = 30;
69  // static const int FITFAILED = 0x1 << FITFAILEDBIT;///< The mask to test if the fit failed
70 
75 
76  virtual ~TrackFitterBase() {}
77 
87  virtual std::string getRevision() const;
88 
90  virtual unsigned char getFitterType() const = 0;
91 
97  virtual IMPL::TrackImpl *fitTrack(EVENT::Track const * seedTrack) const = 0;
98 
111  virtual EVENT::DoubleVec calculateResiduals(EVENT::Track const * testTrack,
112  unsigned int testHitNumber,
113  EVENT::Track const * referenceTrack = NULL) const;
114 
120  virtual EVENT::DoubleVec calculateResiduals(EVENT::TrackerHit const * testHit,
121  EVENT::Track const *trackWithoutTestHit) const;
122 
123 
126  static void setTrackFitterType(unsigned char type, IMPL::TrackImpl *track);
127 
130  static unsigned char getFitterTypeFromTrack(int trackTypeWord);
131 
134  void setD0Start(double d0);
135 
138  void setPhiStart(double phi);
139 
142  void setOmegaStart(double omega);
143 
146  void setTanLambdaStart(double tanLambda);
147 
150  void setZ0Start(double z0);
151 
155  void setNoZFitFlag(bool noZFit = true);
156 
159  bool getNoZFitFlag() const;
160 
163  void fixD0(bool fix = true);
164 
167  void fixPhi(bool fix = true);
168 
171  void fixOmega(bool fix = true);
172 
175  void fixTanLambda(bool fix = true);
176 
179  void fixZ0(bool fix = true);
180 
181  protected:
182 
185  double distanceOnCircle(double phi1, double phi2) const;
186 
189  double _d0Start;
190  bool _useD0Start;
191 
194  double _phiStart;
195  bool _usePhiStart;
196 
199  double _omegaStart;
200  bool _useOmegaStart;
201 
205  bool _useTanLambdaStart;
206 
209  double _z0Start;
210  bool _useZ0Start;
211 
213  bool _noZFit;
214 
216  bool _fixD0, _fixPhi, _fixOmega, _fixTanLambda, _fixZ0;
217 };
218 
219 }// namespace marlintpc
220 
221 #endif // TRACK_FITTER_BASE_H
static const unsigned char CHISQUARE
The fitter.
Definition: TrackFitterBase.h:64
static const unsigned char LINEARREGRESSION
Linear regression for a straight line.
Definition: TrackFitterBase.h:61
virtual EVENT::DoubleVec calculateResiduals(EVENT::Track const *testTrack, unsigned int testHitNumber, EVENT::Track const *referenceTrack=NULL) const
Return the distance of the hit testHitNumber of the testTrack to the point of closest approach on the...
Definition: TrackFitterBase.cc:33
void fixZ0(bool fix=true)
Fix or release z0.
Definition: TrackFitterBase.cc:317
static const unsigned char SIMPLEHELIXFIT
Simple Helix Fit from V.Karimaeki: "Effective circle fitting for particle trajectories".
Definition: TrackFitterBase.h:65
void setD0Start(double d0)
Set a d0 start value for the fit.
Definition: TrackFitterBase.cc:257
double distanceOnCircle(double phi1, double phi2) const
Calculate the angular distance on a circle.
Definition: TrackFitterBase.cc:234
static const unsigned char SIMPLECHISQUARE
Simple without geometry information.
Definition: TrackFitterBase.h:59
void fixOmega(bool fix=true)
Fix or release omega.
Definition: TrackFitterBase.cc:307
bool _noZFit
flag whether to perform a 2D or a 3D fit
Definition: TrackFitterBase.h:213
void setPhiStart(double phi)
Set a phi start value for the fit.
Definition: TrackFitterBase.cc:263
Defines constants to determine which fitter type was used to perform the fit and calculate the residu...
Definition: TrackFitterBase.h:55
static void setTrackFitterType(unsigned char type, IMPL::TrackImpl *track)
Convenience function to set bits 16-23 to be the track type.
Definition: TrackFitterBase.cc:243
bool getNoZFitFlag() const
Get the noZFit flag.
Definition: TrackFitterBase.cc:292
void setNoZFitFlag(bool noZFit=true)
Switch to turn off the fitting in z.
Definition: TrackFitterBase.cc:287
double _tanLambdaStart
The start value for the fit and a flag whether to apply tanLambdaStart or the value from the seed tra...
Definition: TrackFitterBase.h:204
void setTanLambdaStart(double tanLambda)
Set a tanLambda start value for the fit.
Definition: TrackFitterBase.cc:275
virtual IMPL::TrackImpl * fitTrack(EVENT::Track const *seedTrack) const =0
The function which does the actual fitting.
The TrackFitterBase is a virtual class from which the actual track fitters are derived.
Definition: TrackFitterBase.h:44
double _z0Start
The start value for the fit and a flag whether to apply z0Start or the value from the seed track...
Definition: TrackFitterBase.h:209
static unsigned char getFitterTypeFromTrack(int trackTypeWord)
Convenicene function to get the tracker type out of the trackType word.
Definition: TrackFitterBase.cc:252
static const unsigned char FITFAILEDBIT
Bit 30 in the TrackType word is fit failed.
Definition: TrackFitterBase.h:68
virtual std::string getRevision() const
Get the revision of the actual fitter implementation.
Definition: TrackFitterBase.cc:228
void fixD0(bool fix=true)
Fix or release d0.
Definition: TrackFitterBase.cc:297
void setZ0Start(double z0)
Set a z0 start value for the fit.
Definition: TrackFitterBase.cc:281
double _phiStart
The start value for the fit and a flag whether to apply phiStart or the value from the seed track...
Definition: TrackFitterBase.h:194
static const unsigned char SIMPLEMINIMIZER
Fitter which does not need parameters.
Definition: TrackFitterBase.h:63
TrackFitterBase()
The Constructor.
Definition: TrackFitterBase.cc:27
void setOmegaStart(double omega)
Set a omega start value for the fit.
Definition: TrackFitterBase.cc:269
static const unsigned char LIKELIHOOD
Global likelihood method.
Definition: TrackFitterBase.h:58
void fixTanLambda(bool fix=true)
Fix or release tanLambda.
Definition: TrackFitterBase.cc:312
bool _fixD0
flags whether to fix a fit parameter
Definition: TrackFitterBase.h:216
static const unsigned char SIMPLECHISQUAREPADS
Simple using pad geometry information.
Definition: TrackFitterBase.h:60
virtual unsigned char getFitterType() const =0
Information what fitter implementation this is.
void fixPhi(bool fix=true)
Fix or release phi.
Definition: TrackFitterBase.cc:302
double _d0Start
The start value for the fit and a flag whether to apply d0Start or the value from the seed track...
Definition: TrackFitterBase.h:189
static const unsigned char KALMAN
Kalman filtering of the track.
Definition: TrackFitterBase.h:62
double _omegaStart
The start value for the fit and a flag whether to apply omegaStart or the value from the seed track...
Definition: TrackFitterBase.h:199