MarlinTrk  02.08
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMarlinTrack.h
Go to the documentation of this file.
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 "DDRec/Vector3D.h"
12 
13 #include <exception>
14 #include <string>
15 
16 
17 #ifdef MARLINTRK_BACKWARD_GEAR_WRAPPERS
18 #include "gearimpl/Vector3D.h"
19 #endif
20 
21 
22 
23 namespace MarlinTrk{
24 
27 
36  class IMarlinTrack {
37 
38  public:
39 
41  static const bool backward ;
42 
44  static const bool forward ;
45 
46 
47 
48  static const int modeBackward ;
49  static const int modeClosest ;
50  static const int modeForward ;
51 
52 
53  static const int success ; // no error
54  static const int error ;
55  static const int bad_intputs ;
56  static const int no_intersection ; // no intersection found
57  static const int site_discarded ; // measurement discarded by the fitter
58  static const int site_fails_chi2_cut ; // measurement discarded by the fitter due to chi2 cut
59  static const int all_sites_fail_fit ; // no single measurement added to the fit
60 
61 
63  virtual ~IMarlinTrack() {};
64 
68  virtual void setMass(double mass) = 0 ;
69 
72  virtual double getMass() = 0 ;
73 
77  virtual int addHit(EVENT::TrackerHit* hit) = 0 ;
78 
83  virtual int initialise( bool fitDirection ) = 0 ;
84 
91  virtual int initialise( const EVENT::TrackState& ts, double bfield_z, bool fitDirection ) = 0 ;
92 
93 
98  virtual int fit( double maxChi2Increment=DBL_MAX ) = 0 ;
99 
100 
104  virtual int addAndFit( EVENT::TrackerHit* hit, double& chi2increment, double maxChi2Increment=DBL_MAX ) = 0 ;
105 
106 
109  virtual int testChi2Increment( EVENT::TrackerHit* hit, double& chi2increment ) = 0 ;
110 
111 
114  virtual int smooth() = 0 ;
115 
116 
119  virtual int smooth( EVENT::TrackerHit* hit ) = 0 ;
120 
121 
122 
123  // Track State Accessesors
124 
127  virtual int getTrackState( IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
128 
129 
132  virtual int getTrackState( EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
133 
140 
147 
150  virtual int getNDF( int& ndf ) = 0 ;
151 
154  virtual int getTrackerHitAtPositiveNDF( EVENT::TrackerHit*& trkhit ) = 0 ;
155 
156  // PROPAGATORS
157 
160  virtual int propagate( const Vector3D& point, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
161 
162 
166  virtual int propagate( const Vector3D& point, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
167 
168 
171  virtual int propagateToLayer( int layerID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
172 
176  virtual int propagateToLayer( int layerID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
177 
180  virtual int propagateToDetElement( int detElementID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
181 
185  virtual int propagateToDetElement( int detEementID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
186 
187 
188 
189  // EXTRAPOLATORS
190 
193  virtual int extrapolate( const Vector3D& point, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
194 
198  virtual int extrapolate( const Vector3D& point, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ) = 0 ;
199 
202  virtual int extrapolateToLayer( int layerID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
203 
207  virtual int extrapolateToLayer( int layerID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int& detElementID, int mode=modeClosest ) = 0 ;
208 
211  virtual int extrapolateToDetElement( int detElementID, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
212 
216  virtual int extrapolateToDetElement( int detEementID, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf, int mode=modeClosest ) = 0 ;
217 
218 
219  // INTERSECTORS
220 
224  virtual int intersectionWithLayer( int layerID, Vector3D& point, int& detElementID, int mode=modeClosest ) = 0 ;
225 
229  virtual int intersectionWithLayer( int layerID, EVENT::TrackerHit* hit, Vector3D& point, int& detElementID, int mode=modeClosest ) = 0 ;
230 
231 
234  virtual int intersectionWithDetElement( int detElementID, Vector3D& point, int mode=modeClosest ) = 0 ;
235 
236 
240  virtual int intersectionWithDetElement( int detEementID, EVENT::TrackerHit* hit, Vector3D& point, int mode=modeClosest ) = 0 ;
241 
244  virtual std::string toString() ;
245 
246 
247  //-------------------------------------------------------------------------------------------------------------------------------
248 
249 #ifdef MARLINTRK_BACKWARD_GEAR_WRAPPERS
250 
251  int propagate( const gear::Vector3D& point, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ){
252  Vector3D v( point.x(), point.y(), point.z() ) ;
253  return propagate( v, ts, chi2, ndf ) ;
254  }
255  int propagate( const gear::Vector3D& point, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ){
256  Vector3D v( point.x(), point.y(), point.z() ) ;
257  return propagate( v, hit, ts, chi2, ndf ) ;
258  }
259  int extrapolate( const gear::Vector3D& point, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ){
260  Vector3D v( point.x(), point.y(), point.z() ) ;
261  return extrapolate( v, ts, chi2, ndf ) ;
262  }
263  int extrapolate( const gear::Vector3D& point, EVENT::TrackerHit* hit, IMPL::TrackStateImpl& ts, double& chi2, int& ndf ){
264  Vector3D v( point.x(), point.y(), point.z() ) ;
265  return extrapolate( v, hit, ts, chi2, ndf ) ;
266  }
267  int intersectionWithLayer( int layerID, gear::Vector3D& point, int& detElementID, int mode=modeClosest ){
268  Vector3D v( point.x(), point.y(), point.z() ) ;
269  int ret = intersectionWithLayer( layerID, v, detElementID, mode ) ;
270  point = v ;
271  return ret ;
272  }
273  int intersectionWithLayer( int layerID, EVENT::TrackerHit* hit, gear::Vector3D& point, int& detElementID, int mode=modeClosest ){
274  Vector3D v( point.x(), point.y(), point.z() ) ;
275  int ret = intersectionWithLayer( layerID, hit, v, detElementID, mode ) ;
276  point = v ;
277  return ret ;
278  }
279  int intersectionWithDetElement( int detElementID, gear::Vector3D& point, int mode=modeClosest ){
280  Vector3D v( point.x(), point.y(), point.z() ) ;
281  int ret = intersectionWithDetElement( detElementID, v, mode ) ;
282  point = v ;
283  return ret ;
284  }
285  int intersectionWithDetElement( int detElementID, EVENT::TrackerHit* hit, gear::Vector3D& point, int mode=modeClosest ){
286  Vector3D v( point.x(), point.y(), point.z() ) ;
287  int ret = intersectionWithDetElement( detElementID, hit, v, mode ) ;
288  point = v ;
289  return ret ;
290  }
291 
292 #endif
293 
294  //-------------------------------------------------------------------------------------------------------------------------------
295 
296 
297  protected:
298 
299  private:
300 
301  IMarlinTrack& operator=( const IMarlinTrack&) ; // disallow assignment operator
302 
303  } ;
304 
306  std::string errorCode( int error );
307 
308 
309 
310 
311 } // end of MarlinTrk namespace
312 
313 #endif
314 
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 intersectionWithLayer(int layerID, Vector3D &point, int &detElementID, int mode=modeClosest)=0
extrapolate the fit to numbered sensitive layer, returning intersection point in global coordinates a...
IMarlinTrack & operator=(const IMarlinTrack &)
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:41
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:44
virtual std::string toString()
Dump this track to a string for debugging - implementation dependant.
Definition: IMarlinTrack.cc:40
virtual int propagate(const 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
static const int modeClosest
Definition: IMarlinTrack.h:49
static const int bad_intputs
Definition: IMarlinTrack.h:55
dd4hep::rec::Vector3D Vector3D
the Vector3D used for the tracking interface
Definition: IMarlinTrack.h:26
virtual int extrapolate(const 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...
STL class.
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...
static const int all_sites_fail_fit
Definition: IMarlinTrack.h:59
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:36
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 addAndFit(EVENT::TrackerHit *hit, double &chi2increment, double maxChi2Increment=DBL_MAX)=0
update the current fit using the supplied hit, return code via int.
static const int site_discarded
Definition: IMarlinTrack.h:57
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.
static const int success
Definition: IMarlinTrack.h:53
static const int no_intersection
Definition: IMarlinTrack.h:56
STL class.
static const int modeBackward
Definition: IMarlinTrack.h:48
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...
static const int site_fails_chi2_cut
Definition: IMarlinTrack.h:58
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 ...
static const int modeForward
Definition: IMarlinTrack.h:50
virtual int intersectionWithDetElement(int detElementID, Vector3D &point, int mode=modeClosest)=0
extrapolate the fit to numbered sensitive detector element, returning intersection point in global co...
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&#39;tor
Definition: IMarlinTrack.h:63
static const int error
Definition: IMarlinTrack.h:54
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...