GENFIT  Rev:NoNumberAvailable
Track.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch & Tobias Schlüter
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
24 #ifndef genfit_Track_h
25 #define genfit_Track_h
26 
27 #include "AbsTrackRep.h"
28 #include "FitStatus.h"
29 #include "MeasurementFactory.h"
30 #include "TrackCand.h"
31 #include "TrackPoint.h"
32 
33 #include <vector>
34 #include <TObject.h>
35 #include <TVectorD.h>
36 
37 
38 namespace genfit {
39 
40 class KalmanFitStatus;
41 
46  public:
50  bool operator() (const TrackPoint* lhs, const TrackPoint* rhs) const {
51  return lhs->getSortingParameter() < rhs->getSortingParameter();
52  }
53 };
54 
55 
71 class Track : public TObject {
72 
73  public:
74 
75  Track();
76 
93  Track(const TrackCand& trackCand, const MeasurementFactory<genfit::AbsMeasurement>& factory, AbsTrackRep* rep = NULL);
94 
95  Track(AbsTrackRep* trackRep, const TVectorD& stateSeed);
96  Track(AbsTrackRep* trackRep, const TVector3& posSeed, const TVector3& momSeed);
97  Track(AbsTrackRep* trackRep, const TVectorD& stateSeed, const TMatrixDSym& covSeed);
98 
99  Track(const Track&); // copy constructor
100  Track& operator=(Track); // assignment operator
101  void swap(Track& other); // nothrow
102 
103  virtual ~Track();
104  virtual void Clear(Option_t* = "");
105 
106  void createMeasurements(const TrackCand& trackCand, const MeasurementFactory<genfit::AbsMeasurement>& factory);
107 
108  TrackPoint* getPoint(int id) const;
109  const std::vector< genfit::TrackPoint* > & getPoints() const {return trackPoints_;}
110  unsigned int getNumPoints() const {return trackPoints_.size();}
111 
112  TrackPoint* getPointWithMeasurement(int id) const;
113  const std::vector< genfit::TrackPoint* > & getPointsWithMeasurement() const {return trackPointsWithMeasurement_;}
114  unsigned int getNumPointsWithMeasurement() const {return trackPointsWithMeasurement_.size();}
115 
116  TrackPoint* getPointWithMeasurementAndFitterInfo(int id, const AbsTrackRep* rep = NULL) const;
117  TrackPoint* getPointWithFitterInfo(int id, const AbsTrackRep* rep = NULL) const;
118 
128  const MeasuredStateOnPlane& getFittedState(int id = 0, const AbsTrackRep* rep = NULL, bool biased = true) const;
129 
130  AbsTrackRep* getTrackRep(int id) const {return trackReps_.at(id);}
131  unsigned int getNumReps() const {return trackReps_.size();}
132 
134  int getIdForRep(const AbsTrackRep* rep) const;
135 
143  AbsTrackRep* getCardinalRep() const {return trackReps_.at(cardinalRep_);}
144  unsigned int getCardinalRepId() const {return cardinalRep_;}
145 
147  int getMcTrackId() const {return mcTrackId_;}
148 
150  bool hasFitStatus(const AbsTrackRep* rep = NULL) const;
152  FitStatus* getFitStatus(const AbsTrackRep* rep = NULL) const {if (rep == NULL) rep = getCardinalRep(); return fitStatuses_.at(rep);}
153 
155  bool hasKalmanFitStatus(const AbsTrackRep* rep = NULL) const;
157  KalmanFitStatus* getKalmanFitStatus(const AbsTrackRep* rep = NULL) const;
158 
159  void setFitStatus(FitStatus* fitStatus, const AbsTrackRep* rep);
160 
161  double getTimeSeed() const {return timeSeed_;}
162  void setTimeSeed(double time) {timeSeed_ = time;}
163 
164  const TVectorD& getStateSeed() const {return stateSeed_;}
165  void setStateSeed(const TVectorD& s) {stateSeed_.ResizeTo(s); stateSeed_ = s;}
166  void setStateSeed(const TVector3& pos, const TVector3& mom);
167 
168  const TMatrixDSym& getCovSeed() const {return covSeed_;}
169  void setCovSeed(const TMatrixDSym& c) {covSeed_.ResizeTo(c); covSeed_ = c;}
170 
172  void setMcTrackId(int i) {mcTrackId_ = i;}
173 
181  void insertPoint(TrackPoint* point, int id = -1);
182 
190  void insertPoints(std::vector<genfit::TrackPoint*> points, int id = -1);
191 
192  void deletePoint(int id);
193 
195  void insertMeasurement(AbsMeasurement* measurement, int id = -1);
196 
205  void mergeTrack(const Track* other, int id = -1);
206 
207  void addTrackRep(AbsTrackRep* trackRep);
208 
210  void deleteTrackRep(int id);
211 
212  void setCardinalRep(int id);
214  void determineCardinalRep();
215 
221  bool sort();
222 
225  bool udpateSeed(int id = 0, AbsTrackRep* rep = NULL, bool biased = true);
226 
228  void reverseTrackPoints();
229 
231  void reverseMomSeed() {
232  stateSeed_(3) *= -1; stateSeed_(4) *= -1; stateSeed_(5) *= -1;
233  }
234 
236  void switchPDGSigns(AbsTrackRep* rep = NULL);
237 
239 
244  void reverseTrack();
245 
246 
247  void deleteForwardInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
248  void deleteBackwardInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
249  void deleteReferenceInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
250  void deleteMeasurementInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
251  void deleteFitterInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
252 
254  double getTrackLen(AbsTrackRep* rep = NULL, int startId = 0, int endId = -1) const;
256  double getTOF(AbsTrackRep* rep = NULL, int startId = 0, int endId = -1) const;
257 
259 
265  TrackCand* constructTrackCand() const;
266 
269  void fixWeights(AbsTrackRep* rep = NULL, int startId = 0, int endId = -1);
270 
285  void prune(const Option_t* = "CFLWRMIU");
286 
287  void Print(const Option_t* = "") const;
288 
289  bool checkConsistency() const;
290 
291  private:
292 
293  void trackHasChanged();
294 
295  void fillPointsWithMeasurement();
296 
297  std::vector<AbsTrackRep*> trackReps_; // Ownership
298  unsigned int cardinalRep_; // THE selected rep, default = 0;
299 
300  std::vector<TrackPoint*> trackPoints_; // Ownership
301  std::vector<TrackPoint*> trackPointsWithMeasurement_;
302 
303  std::map< const AbsTrackRep*, FitStatus* > fitStatuses_; // Ownership over FitStatus*
304 
306  double timeSeed_;
307  TVectorD stateSeed_; // 6D: position, momentum
308  TMatrixDSym covSeed_; // 6D
309 
310 
311  public:
312  ClassDef(Track,3)
313  // Class version history:
314  // ver 3: introduces timeSeed_
315 };
316 
317 } /* End of namespace genfit */
320 #endif // genfit_Track_h
double timeSeed_
Definition: Track.h:306
const std::vector< genfit::TrackPoint * > & getPoints() const
Definition: Track.h:109
Contains the measurement and covariance in raw detector coordinates.
bool operator()(const TrackPoint *lhs, const TrackPoint *rhs) const
Definition: Track.h:50
AbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: Track.h:143
std::vector< TrackPoint * > trackPoints_
Definition: Track.h:300
std::map< const AbsTrackRep *, FitStatus * > fitStatuses_
helper
Definition: Track.h:303
void setTimeSeed(double time)
Definition: Track.h:162
unsigned int getNumPoints() const
Definition: Track.h:110
TVectorD stateSeed_
Definition: Track.h:307
Track candidate – seed values and indices.
Definition: TrackCand.h:69
double getTimeSeed() const
Definition: Track.h:161
const std::vector< genfit::TrackPoint * > & getPointsWithMeasurement() const
Definition: Track.h:113
const TMatrixDSym & getCovSeed() const
Definition: Track.h:168
unsigned int getNumPointsWithMeasurement() const
Definition: Track.h:114
StateOnPlane with additional covariance matrix.
TMatrixDSym covSeed_
Definition: Track.h:308
unsigned int cardinalRep_
Definition: Track.h:298
std::vector< TrackPoint * > trackPointsWithMeasurement_
Definition: Track.h:301
int mcTrackId_
Definition: Track.h:305
unsigned int getCardinalRepId() const
Definition: Track.h:144
void reverseMomSeed()
Flip direction of momentum seed.
Definition: Track.h:231
void setMcTrackId(int i)
Set the MCT track id, for MC simulations.
Definition: Track.h:172
AbsTrackRep * getTrackRep(int id) const
Definition: Track.h:130
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
unsigned int getNumReps() const
Definition: Track.h:131
Class where important numbers and properties of a fit can be stored.
Definition: FitStatus.h:80
double getSortingParameter() const
Definition: TrackPoint.h:88
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition: TrackPoint.h:50
Helper class for TrackPoint sorting, used in Track::sort().
Definition: Track.h:45
int getMcTrackId() const
Get the MCT track id, for MC simulations - default value = -1.
Definition: Track.h:147
void setCovSeed(const TMatrixDSym &c)
Definition: Track.h:169
std::vector< AbsTrackRep * > trackReps_
Definition: Track.h:297
FitStatus for use with AbsKalmanFitter implementations.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
void setStateSeed(const TVectorD &s)
Definition: Track.h:165
Factory object to create AbsMeasurement objects from digitized and clustered data.
Defines for I/O streams used for error and debug printing.
const TVectorD & getStateSeed() const
Definition: Track.h:164
FitStatus * getFitStatus(const AbsTrackRep *rep=NULL) const
Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.
Definition: Track.h:152