Class Reference for E1039 Core & Analysis Software
GFTrack.h
Go to the documentation of this file.
1 #ifndef _GFTRACK_H
2 #define _GFTRACK_H
3 
4 #include <vector>
5 #include <memory>
6 
7 #include <GenFit/AbsTrackRep.h>
8 #include <GenFit/MeasuredStateOnPlane.h>
9 #include <GenFit/Track.h>
10 #include <GenFit/Tools.h>
11 
12 #include <TString.h>
13 #include <TVector3.h>
14 
15 #include "SRecEvent.h"
16 #include "FastTracklet.h"
17 #include "GFMeasurement.h"
18 
19 namespace SQGenFit
20 {
21 class GFTrack
22 {
23 public:
24  GFTrack();
25  GFTrack(SRecTrack& recTrack);
26  GFTrack(Tracklet& tracklet);
27  ~GFTrack();
28 
29  void setVerbosity(unsigned int v);
30  void setMaxErrorCount(unsigned int m);
31  void setTracklet(Tracklet& tracklet, double z_reference = 590., bool wildseedcov = false);
32  void addMeasurements(std::vector<GFMeasurement*>& measurements);
33  void addMeasurement(GFMeasurement* measurement);
34 
35  double getChi2();
36  double getNDF();
37  int getCharge() { return _trkcand->getCharge(); };
39 
40  //The extrapolation is implemented for line, plane and point, but the update/filter is only implemeted
41  // for line and plane, user needs to be careful and pass correct measurement and cov to get sensible result
42  double extrapolateToLine(TVector3& endPoint1, TVector3& endPoint2, const int startPtID = 0);
43  double extrapolateToPlane(TVector3& pO, TVector3& pU, TVector3& pV, const int startPtID = 0);
44  double extrapolateToPoint(TVector3& point, bool update = false, const int startPtID = 0);
45  double updatePropState(const TVectorD& meas, const TMatrixDSym& V);
46  void getExtrapPosMomCov(TVector3& pos, TVector3& mom, TMatrixDSym& cov) { _propState->getPosMomCov(pos, mom, cov); }
47  void getExtrapPosMom(TVector3& pos, TVector3& mom) { _propState->getPosMom(pos, mom); }
48 
49  double swimToVertex(double z, TVector3* pos = nullptr, TVector3* mom = nullptr, TMatrixDSym* cov = nullptr);
50 
51  void checkConsistency() { _track->checkConsistency(); }
52 
53  void postFitUpdate(bool updateMeasurements = true);
55 
56  void print(unsigned int debugLvl = 0);
57 
58  genfit::Track* getGenFitTrack() { return _track; }
59  genfit::AbsTrackRep* getGenFitTrkRep() { return _trkrep; }
60 
61 private:
62  //Auxilary function to initialize the extrapolation/projection, should not be seen by external user
63  bool setInitialStateForExtrap(const int startPtID = 0);
64 
65  //interface with genfit operations
66  genfit::AbsTrackRep* _trkrep;
67  genfit::Track* _track;
68  std::vector<GFMeasurement*> _measurements;
69 
70  //container of the MSOP obtained from the SRecTrack
71  std::vector<genfit::MeasuredStateOnPlane> _fitstates;
72 
73  //Used for the propagation and hypothesis test
74  std::unique_ptr<genfit::MeasuredStateOnPlane> _propState;
75  std::unique_ptr<genfit::AbsMeasurement> _virtMeas;
76 
77  //Store the original track candidate information from track finding
78  Tracklet* _trkcand;
79  int _pdg;
80 
81  //Local error count to suppress eccessive error messages
82  unsigned int _errorNo;
83 
84 };
85 }
86 
87 #endif
double getNDF()
Definition: GFTrack.cxx:158
void print(unsigned int debugLvl=0)
Definition: GFTrack.cxx:446
double extrapolateToPlane(TVector3 &pO, TVector3 &pU, TVector3 &pV, const int startPtID=0)
Definition: GFTrack.cxx:214
void getExtrapPosMomCov(TVector3 &pos, TVector3 &mom, TMatrixDSym &cov)
Definition: GFTrack.h:46
void addMeasurements(std::vector< GFMeasurement * > &measurements)
Definition: GFTrack.cxx:128
void setVerbosity(unsigned int v)
Definition: GFTrack.cxx:123
void postFitUpdate(bool updateMeasurements=true)
Definition: GFTrack.cxx:403
int getNearestMeasurementID(GFMeasurement *meas)
Definition: GFTrack.cxx:170
double swimToVertex(double z, TVector3 *pos=nullptr, TVector3 *mom=nullptr, TMatrixDSym *cov=nullptr)
Definition: GFTrack.cxx:304
void addMeasurement(GFMeasurement *measurement)
Definition: GFTrack.cxx:137
SRecTrack getSRecTrack()
Definition: GFTrack.cxx:412
double extrapolateToLine(TVector3 &endPoint1, TVector3 &endPoint2, const int startPtID=0)
Definition: GFTrack.cxx:189
void getExtrapPosMom(TVector3 &pos, TVector3 &mom)
Definition: GFTrack.h:47
void setMaxErrorCount(unsigned int m)
Definition: GFTrack.cxx:118
double getChi2()
Definition: GFTrack.cxx:146
void setTracklet(Tracklet &tracklet, double z_reference=590., bool wildseedcov=false)
Definition: GFTrack.cxx:356
double extrapolateToPoint(TVector3 &point, bool update=false, const int startPtID=0)
Definition: GFTrack.cxx:236
double updatePropState(const TVectorD &meas, const TMatrixDSym &V)
Definition: GFTrack.cxx:248
genfit::Track * getGenFitTrack()
Definition: GFTrack.h:58
int getCharge()
Definition: GFTrack.h:37
genfit::AbsTrackRep * getGenFitTrkRep()
Definition: GFTrack.h:59
void checkConsistency()
Definition: GFTrack.h:51
int getCharge() const
Return the charge (+1 or -1) of this tracklet.