TrackPar.h
Go to the documentation of this file.
1 //
2 // TrackPar.h
3 //
4 // Created by Tom Junk, July 2, 2018
5 //
6 // Reasoning to keep this out of gar::rec::Track -- the art data product design guide discourages
7 // the mixture of i/o and algorithms. This class contains algorithms needed to manipulate TPCClusters and tracks.
8 //
9 
10 #ifndef GARTPCTRACKPAR_H
11 #define GARTPCTRACKPAR_H
12 
14 #include "TVector3.h"
15 
16 namespace gar
17 {
18  namespace rec
19  {
20 
21  class Track;
22 
23  class TrackPar
24  {
25  public:
26 
27  TrackPar(gar::rec::Track const &t, bool reversed=false); // constructor from a Track data product
28 
29  TrackPar(const float lengthforwards, // constructor from parameters
30  const float lengthbackwards,
31  const size_t nTPCClusters,
32  const float xbeg, // x location at beginning of track in cm
33  const float *trackparbeg, // y, z, curvature, phi, lambda -- 5-parameter track (cm, cm, cm-1, radians, radians)
34  const float *covmatbeg, // covariance matrix at beginning of track -- symmetric 5x5
35  const float chisqforward, // chisquared of forwards fit
36  const float xend, // x location at end of track
37  const float *trackparend, // y, z, curvature, phi, lambda -- 5-parameter track (cm, cm, cm-1, radians, lambda)
38  const float *covmatend, // covariance matrix at beginning of track -- symmetric 5x5
39  const float chisqbackward, // chisquared of backwards fit
40  const double time); // timestamp
41 
42  TrackPar() {}; // empty constructor
43 
44  const float *getTrackParametersBegin() const;
45  const float *getTrackParametersEnd() const;
46  const float *getCovMatBeg() const;
47  const float *getCovMatEnd() const;
48 
49  float getYCentBeg() const; // center of helix using beginning track parameters
50  float getZCentBeg() const;
51  float getYCentEnd() const; // center of helix using end track parameters
52  float getZCentEnd() const;
53  bool getBegCentValid() const; // is circle center calc valid (really just curvature != 0)
54  bool getEndCentValid() const;
55 
56  size_t getNTPCClusters() const;
57  float getLengthForwards() const;
58  float getLengthBackwards() const;
59  float getChisqForwards() const;
60  float getChisqBackwards() const;
61  float getXBeg() const;
62  float getXEnd() const;
63  double getTime() const;
64  TVector3 getXYZBeg() const;
65  TVector3 getXYZEnd() const;
66 
67  void setNTPCClusters(const size_t nTPCClusters);
68  void setTrackParametersBegin(const float *tparbeg);
69  void setTrackParametersEnd(const float *tparend);
70  void setCovMatBeg(const float *covmatbeg);
71  void setCovMatEnd(const float *covmatend);
72 
73  void setLengthForwards(const float lengthforwards);
74  void setLengthBackwards(const float lengthbackwards);
75  void setChisqForwards(const float chisqforwards);
76  void setChisqBackwards(const float chisqbackwards);
77  void setXBeg(const float xbeg);
78  void setXEnd(const float xend);
79  void setTime(const double time);
80 
81  gar::rec::Track CreateTrack(); // Make a Track data product from this TrackPar instance
82  void FitAnotherTrack(TrackPar &othertrack, float &chisquared, float *xyz, float *covmat); // find the best-fit vertex with another track
83 
84  private:
85  size_t fNTPCClusters;
86  float fXBeg; // X at which the beginning track parameters are quoted
87  float fTrackParametersBegin[5]; // y, z, curvature, phi, lambda
88  float fXEnd;
89  float fTrackParametersEnd[5]; // y, z, curvature, phi, lambda
94  float fCovMatBeg[25];
95  float fCovMatEnd[25];
96  float fYCentBeg; // center of helix using beginning track parameters
97  float fZCentBeg;
98  float fYCentEnd; // center of helix using end track parameters
99  float fZCentEnd;
100  bool fBegCentValid; // flags to indicate if circle center calc is valid (really just curvature != 0)
102  double fTime; // timestamp
103 
104  void CalcCenter(); // so as not to duplicate code in the constructors
105  };
106 
107  } // rec namespace
108 } // gar namespace
109 
110 #endif
void setNTPCClusters(const size_t nTPCClusters)
Definition: TrackPar.cxx:214
void FitAnotherTrack(TrackPar &othertrack, float &chisquared, float *xyz, float *covmat)
void setLengthForwards(const float lengthforwards)
Definition: TrackPar.cxx:251
float fChisquaredBackwards
Definition: TrackPar.h:91
float fTrackParametersBegin[5]
Definition: TrackPar.h:87
rec
Definition: tracks.py:88
float getYCentBeg() const
Definition: TrackPar.cxx:142
float fCovMatBeg[25]
Definition: TrackPar.h:94
void setCovMatBeg(const float *covmatbeg)
Definition: TrackPar.cxx:235
const float * getCovMatEnd() const
Definition: TrackPar.cxx:136
float fLengthForwards
Definition: TrackPar.h:92
const float * getCovMatBeg() const
Definition: TrackPar.cxx:131
const float * getTrackParametersEnd() const
Definition: TrackPar.cxx:126
float fLengthBackwards
Definition: TrackPar.h:93
void setLengthBackwards(const float lengthbackwards)
Definition: TrackPar.cxx:256
bool getEndCentValid() const
Definition: TrackPar.cxx:167
TVector3 getXYZEnd() const
Definition: TrackPar.cxx:316
float fTrackParametersEnd[5]
Definition: TrackPar.h:89
TVector3 getXYZBeg() const
Definition: TrackPar.cxx:310
void setTrackParametersBegin(const float *tparbeg)
Definition: TrackPar.cxx:219
float fChisquaredForwards
Definition: TrackPar.h:90
float getXBeg() const
Definition: TrackPar.cxx:197
void setXEnd(const float xend)
Definition: TrackPar.cxx:276
void setTrackParametersEnd(const float *tparend)
Definition: TrackPar.cxx:227
float getYCentEnd() const
Definition: TrackPar.cxx:152
float getChisqBackwards() const
Definition: TrackPar.cxx:192
void setChisqBackwards(const float chisqbackwards)
Definition: TrackPar.cxx:266
float fCovMatEnd[25]
Definition: TrackPar.h:95
gar::rec::Track CreateTrack()
Definition: TrackPar.cxx:292
float getZCentBeg() const
Definition: TrackPar.cxx:147
double getTime() const
Definition: TrackPar.cxx:207
size_t getNTPCClusters() const
Definition: TrackPar.cxx:172
General GArSoft Utilities.
float getLengthBackwards() const
Definition: TrackPar.cxx:182
void setCovMatEnd(const float *covmatend)
Definition: TrackPar.cxx:243
bool getBegCentValid() const
Definition: TrackPar.cxx:162
float getLengthForwards() const
Definition: TrackPar.cxx:177
void setXBeg(const float xbeg)
Definition: TrackPar.cxx:271
size_t fNTPCClusters
Definition: TrackPar.h:85
float getXEnd() const
Definition: TrackPar.cxx:202
float getChisqForwards() const
Definition: TrackPar.cxx:187
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:1036
const float * getTrackParametersBegin() const
Definition: TrackPar.cxx:121
void setChisqForwards(const float chisqforwards)
Definition: TrackPar.cxx:261
void setTime(const double time)
Definition: TrackPar.cxx:281
float getZCentEnd() const
Definition: TrackPar.cxx:157