MarlinTrk  2.2.0
IMarlinTrack.h
1 #ifndef IMarlinTrack_h
2 #define IMarlinTrack_h
3 
4 #include <cfloat>
5 
6 #include "lcio.h"
7 
8 #include "EVENT/TrackerHit.h"
9 #include "IMPL/TrackStateImpl.h"
10 
11 #include "gearimpl/Vector3D.h"
12 
13 
14 #include <exception>
15 #include <string>
16 
17 namespace MarlinTrk{
18 
19 
28  class IMarlinTrack {
29 
30  public:
31 
33  static const bool backward ;
34 
36  static const bool forward ;
37 
38 
39 
40  static const int modeBackward ;
41  static const int modeClosest ;
42  static const int modeForward ;
43 
44 
45  static const int success ; // no error
46  static const int error ;
47  static const int bad_intputs ;
48  static const int no_intersection ; // no intersection found
49  static const int site_discarded ; // measurement discarded by the fitter
50  static const int site_fails_chi2_cut ; // measurement discarded by the fitter due to chi2 cut
51  static const int all_sites_fail_fit ; // no single measurement added to the fit
52 
53 
55  virtual ~IMarlinTrack() {};
56 
60  virtual void setMass(double mass) = 0 ;
61 
64  virtual double getMass() = 0 ;
65 
69  virtual int addHit(EVENT::TrackerHit* hit) = 0 ;
70 
75  virtual int initialise( bool fitDirection ) = 0 ;
76 
83  virtual int initialise( const EVENT::TrackState& ts, double bfield_z, bool fitDirection ) = 0 ;
84 
85 
90  virtual int fit( double maxChi2Increment=DBL_MAX ) = 0 ;
91 
92 
96  virtual int addAndFit( EVENT::TrackerHit* hit, double& chi2increment, double maxChi2Increment=DBL_MAX ) = 0 ;
97 
98 
101  virtual int testChi2Increment( EVENT::TrackerHit* hit, double& chi2increment ) = 0 ;
102 
103 
106  virtual int smooth() = 0 ;
107 
108 
111  virtual int smooth( EVENT::TrackerHit* hit ) = 0 ;
112 
113 
114 
115  // Track State Accessesors
116 
119  virtual int getTrackState( IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
120 
121 
124  virtual int getTrackState( EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
125 
131  virtual int getHitsInFit( std::vector<std::pair<EVENT::TrackerHit*, double> >& hits ) = 0 ;
132 
138  virtual int getOutliers( std::vector<std::pair<EVENT::TrackerHit*, double> >& hits ) = 0 ;
139 
142  virtual int getNDF( int& ndf ) = 0 ;
143 
146  virtual int getTrackerHitAtPositiveNDF( EVENT::TrackerHit*& trkhit ) = 0 ;
147 
148  // PROPAGATORS
149 
152  virtual int propagate( const gear::Vector3D& point, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
153 
154 
158  virtual int propagate( const gear::Vector3D& point, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
159 
160 
163  virtual int propagateToLayer( int layerID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
164 
168  virtual int propagateToLayer( int layerID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
169 
172  virtual int propagateToDetElement( int detElementID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
173 
177  virtual int propagateToDetElement( int detEementID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
178 
179 
180 
181  // EXTRAPOLATORS
182 
185  virtual int extrapolate( const gear::Vector3D& point, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
186 
190  virtual int extrapolate( const gear::Vector3D& point, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
191 
194  virtual int extrapolateToLayer( int layerID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
195 
199  virtual int extrapolateToLayer( int layerID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
200 
203  virtual int extrapolateToDetElement( int detElementID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
204 
208  virtual int extrapolateToDetElement( int detEementID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
209 
210 
211  // INTERSECTORS
212 
216  virtual int intersectionWithLayer( int layerID, gear::Vector3D& point, int& detElementID, int mode=modeClosest ) = 0 ;
217 
221  virtual int intersectionWithLayer( int layerID, EVENT::TrackerHit* hit, gear::Vector3D& point, int& detElementID, int mode=modeClosest ) = 0 ;
222 
223 
226  virtual int intersectionWithDetElement( int detElementID, gear::Vector3D& point, int mode=modeClosest ) = 0 ;
227 
231  virtual int intersectionWithDetElement( int detEementID, EVENT::TrackerHit* hit, gear::Vector3D& point, int mode=modeClosest ) = 0 ;
232 
233 
236  virtual std::string toString() ;
237 
238  protected:
239 
240  private:
241 
242  IMarlinTrack& operator=( const IMarlinTrack&) ; // disallow assignment operator
243 
244  } ;
245 
247  std::string errorCode( int error );
248 
249 
250 
251 
252 } // end of MarlinTrk namespace
253 
254 #endif
255 
virtual int extrapolateToDetElement(int detElementID, IMPL::TrackStateImpl &ts, double &chi2, int &ndf, int mode=modeClosest)=0
extrapolate the fit to sensitive detector element, returning TrackState, chi2 and ndf via reference ...
virtual int smooth()=0
smooth all track states
virtual int propagateToLayer(int layerID, IMPL::TrackStateImpl &ts, double &chi2, int &ndf, int &detElementID, int mode=modeClosest)=0
propagate fit to numbered sensitive layer, returning TrackState, chi2, ndf and integer ID of the inte...
virtual int getTrackState(IMPL::TrackStateImpl &ts, double &chi2, int &ndf)=0
get track state, returning TrackState, chi2 and ndf via reference
static const bool backward
boolean constant for defining backward direction - to be used for intitialise
Definition: IMarlinTrack.h:33
virtual int getNDF(int &ndf)=0
get the current number of degrees of freedom for the fit.
static const bool forward
boolean constant for defining backward direction - to be used for intitialise
Definition: IMarlinTrack.h:36
virtual std::string toString()
Dump this track to a string for debugging - implementation dependant.
Definition: IMarlinTrack.cc:40
virtual int extrapolate(const gear::Vector3D &point, IMPL::TrackStateImpl &ts, double &chi2, int &ndf)=0
extrapolate the fit to the point of closest approach to the given point, returning TrackState...
virtual int getTrackerHitAtPositiveNDF(EVENT::TrackerHit *&trkhit)=0
get TrackeHit at which fit became constrained, i.e.
virtual int extrapolateToLayer(int layerID, IMPL::TrackStateImpl &ts, double &chi2, int &ndf, int &detElementID, int mode=modeClosest)=0
extrapolate the fit to numbered sensitive layer, returning TrackState, chi2, ndf and integer ID of th...
virtual int testChi2Increment(EVENT::TrackerHit *hit, double &chi2increment)=0
obtain the chi2 increment which would result in adding the hit to the fit.
Interface for generic tracks in MarlinTrk.
Definition: IMarlinTrack.h:28
virtual int fit(double maxChi2Increment=DBL_MAX)=0
perform the fit of all current hits, returns error code ( IMarlinTrack::success if no error ) ...
virtual int getOutliers(std::vector< std::pair< EVENT::TrackerHit *, double > > &hits)=0
get the list of hits which have been rejected by from the fit due to the a chi2 increment greater tha...
virtual int propagate(const gear::Vector3D &point, IMPL::TrackStateImpl &ts, double &chi2, int &ndf)=0
propagate the fit to the point of closest approach to the given point, returning TrackState, chi2 and ndf via reference
virtual int addAndFit(EVENT::TrackerHit *hit, double &chi2increment, double maxChi2Increment=DBL_MAX)=0
update the current fit using the supplied hit, return code via int.
virtual int getHitsInFit(std::vector< std::pair< EVENT::TrackerHit *, double > > &hits)=0
get the list of hits included in the fit, together with the chi2 contributions of the hits...
virtual int addHit(EVENT::TrackerHit *hit)=0
add hit to track - the hits have to be added ordered in time ( i.e.
std::string errorCode(int error)
Helper function to convert error return code to string.
Definition: IMarlinTrack.cc:26
virtual double getMass()=0
return the of the charged particle (GeV) that is used for energy loss and multiple scattering...
virtual int propagateToDetElement(int detElementID, IMPL::TrackStateImpl &ts, double &chi2, int &ndf, int mode=modeClosest)=0
propagate the fit to sensitive detector element, returning TrackState, chi2 and ndf via reference ...
virtual int intersectionWithLayer(int layerID, gear::Vector3D &point, int &detElementID, int mode=modeClosest)=0
extrapolate the fit to numbered sensitive layer, returning intersection point in global coordinates a...
virtual void setMass(double mass)=0
set the mass of the charged particle (GeV) that is used for energy loss and multiple scattering - def...
virtual ~IMarlinTrack()
default d'tor
Definition: IMarlinTrack.h:55
virtual int intersectionWithDetElement(int detElementID, gear::Vector3D &point, int mode=modeClosest)=0
extrapolate the fit to numbered sensitive detector element, returning intersection point in global co...
virtual int initialise(bool fitDirection)=0
initialise the fit using the hits added up to this point - the fit direction has to be specified usin...