GENFIT Rev: NoNumberAvailable
Loading...
Searching...
No Matches
TrackCand.h
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
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 */
21
22#ifndef genfit_TrackCand_h
23#define genfit_TrackCand_h
24
25#include "TrackCandHit.h"
26
27#include <vector>
28#include <set>
29#include <assert.h>
30
31#include <TObject.h>
32#include <TVector3.h>
33#include <TVectorD.h>
34#include <TMatrixD.h>
35#include <TMatrixDSym.h>
36#include <TDatabasePDG.h>
37
38#include <cmath>
39
40
41namespace genfit {
42
69class TrackCand : public TObject {
70
71
72 public:
73
74
75 // Constructors/Destructors ---------
76 TrackCand();
77 ~TrackCand();
78
80 TrackCand( const TrackCand& other );
83 void swap(TrackCand& other); // nothrow
84
86 friend bool operator== (const TrackCand& lhs, const TrackCand& rhs);
87 friend bool operator!= (const TrackCand& lhs, const TrackCand& rhs) {return !(lhs == rhs);}
88
89 static bool compareTrackCandHits(const TrackCandHit* lhs, const TrackCandHit* rhs) {return (*lhs < *rhs);} // operator< defined in TrackCandHit.h
90
91 // Accessors -----------------------
92 TrackCandHit* getHit(int i) const;
93
95 void getHit(int i, int& detId, int& hitId) const;
96
98 void getHit(int i, int& detId, int& hitId, double& sortingParameter) const;
99
101 void getHitWithPlane(int i, int& detId, int& hitId, int& planeId) const;
102
103 unsigned int getNHits() const {return hits_.size();}
104
110 std::vector<int> getHitIDs(int detId = -2) const;
111
113 std::vector<int> getDetIDs() const;
115 std::vector<double> getSortingParameters() const;
116 std::set<int> getUniqueDetIDs() const;
117
119 int getMcTrackId() const {return mcTrackId_;}
120
122 double getTimeSeed() const { return time_; }
123
125 TVector3 getPosSeed() const {return TVector3(state6D_(0), state6D_(1), state6D_(2));}
126
128 TVector3 getMomSeed() const {return TVector3(state6D_(3), state6D_(4), state6D_(5));}
129
131 const TMatrixDSym& getCovSeed() const {return cov6D_;}
132
134 const TVectorD& getStateSeed() const {return state6D_;}
135
136 double getChargeSeed() const {return q_;}
137
139 int getPdgCode() const {return pdg_;}
140
142 bool hitInTrack(int detId, int hitId) const;
143
144 // Modifiers -----------------------
145
146 void addHit(int detId, int hitId, int planeId = -1, double sortingParameter = 0);
147
148 void addHit(TrackCandHit* hit) {hits_.push_back(hit);}
149
151 void setMcTrackId(int i) {mcTrackId_ = i;}
152
154 void setPdgCode(int pdgCode);
155
157 void append(const TrackCand&);
158
160 void sortHits();
161
162 void sortHits(const std::vector<unsigned int>& indices);
163
164 // Operations ----------------------
166 void reset();
167
169 void Print(const Option_t* = "") const ;
170
172 void setTimeSeed(double time) { time_ = time; }
173
175 void setCovSeed(const TMatrixDSym& cov6D) {cov6D_ = cov6D; /* always 6D, no need to resize */}
176
180 void set6DSeed(const TVectorD& state6D, const double charge);
181
184 void set6DSeedAndPdgCode(const TVectorD& state6D, const int pdgCode);
185
189 void setPosMomSeed(const TVector3& pos, const TVector3& mom, const double charge);
190
193 void setPosMomSeedAndPdgCode(const TVector3& pos, const TVector3& mom, const int pdgCode);
194
201 void setTime6DSeed(double time, const TVectorD& state6D, const double charge);
202
207 void setTime6DSeedAndPdgCode(double time, const TVectorD& state6D, const int pdgCode);
208
214 void setTimePosMomSeed(double time, const TVector3& pos, const TVector3& mom,
215 const double charge);
216
221 void setTimePosMomSeedAndPdgCode(double time, const TVector3& pos,
222 const TVector3& mom, const int pdgCode);
223
224
225 private:
226
227 // Private Data Members ------------
228 std::vector<TrackCandHit*> hits_; //->
229
231 int pdg_;
232
233 double time_;
234 TVectorD state6D_;
235 TMatrixDSym cov6D_;
236 double q_;
237
238
239 public:
240
241 ClassDef(TrackCand,2)
242 // Version history:
243 // ver 2: keep track of time in state (schema evolution rule added).
244};
245
246} /* End of namespace genfit */
248
249#endif // genfit_TrackCand_h
Hit object for use in TrackCand. Provides IDs and sorting parameters.
Track candidate – seed values and indices.
Definition TrackCand.h:69
void append(const TrackCand &)
Clone the TrackCandHit objects from the other TrackCand and append them to this TrackCand.
Definition TrackCand.cc:215
std::vector< double > getSortingParameters() const
Get sorting parameterts of all hits.
Definition TrackCand.cc:148
bool hitInTrack(int detId, int hitId) const
Is there a hit with detId and hitId in the TrackCand?
Definition TrackCand.cc:181
std::vector< int > getDetIDs() const
Get detector IDs of all hits.
Definition TrackCand.cc:140
void addHit(int detId, int hitId, int planeId=-1, double sortingParameter=0)
Definition TrackCand.cc:125
void setTime6DSeedAndPdgCode(double time, const TVectorD &state6D, const int pdgCode)
This function works the same as set6DSeed but instead of a charge hypothesis you can set a pdg code w...
Definition TrackCand.cc:279
void setTimePosMomSeedAndPdgCode(double time, const TVector3 &pos, const TVector3 &mom, const int pdgCode)
This function works the same as setPosMomSeed but instead of a charge hypothesis you can set a pdg co...
Definition TrackCand.cc:292
void setPosMomSeed(const TVector3 &pos, const TVector3 &mom, const double charge)
sets the state to seed the track fitting. State has to be a TVector3 for position and a TVector3 for ...
Definition TrackCand.cc:258
friend bool operator==(const TrackCand &lhs, const TrackCand &rhs)
== operator checks equality of TrackCandHits. Does not check for sorting parameters.
Definition TrackCand.cc:191
static bool compareTrackCandHits(const TrackCandHit *lhs, const TrackCandHit *rhs)
Definition TrackCand.h:89
const TVectorD & getStateSeed() const
Returns the 6D seed state; should be in global coordinates.
Definition TrackCand.h:134
void swap(TrackCand &other)
Definition TrackCand.cc:75
void sortHits()
Sort the hits that were already added to the trackCand using the sorting parameters.
Definition TrackCand.cc:222
TMatrixDSym cov6D_
Definition TrackCand.h:235
std::set< int > getUniqueDetIDs() const
Definition TrackCand.cc:156
friend bool operator!=(const TrackCand &lhs, const TrackCand &rhs)
Definition TrackCand.h:87
void setCovSeed(const TMatrixDSym &cov6D)
set the covariance matrix seed (6D).
Definition TrackCand.h:175
void set6DSeed(const TVectorD &state6D, const double charge)
sets the state to seed the track fitting. State has to be a TVectorD(6). First 3 elements are the sta...
Definition TrackCand.cc:246
void Print(const Option_t *="") const
Write the content of all private attributes to the terminal.
Definition TrackCand.cc:202
int getMcTrackId() const
Get the MCT track id, for MC simulations - default value = -1.
Definition TrackCand.h:119
void setTime6DSeed(double time, const TVectorD &state6D, const double charge)
sets the state to seed the track fitting and its time. State has to be a TVectorD(6)....
Definition TrackCand.cc:273
void setTimeSeed(double time)
Set the time at which the seed is defined.
Definition TrackCand.h:172
std::vector< int > getHitIDs(int detId=-2) const
Get hit ids of from a specific detector.
Definition TrackCand.cc:130
TVector3 getMomSeed() const
get the seed value for track: mom. Identical to the last 3 components of getStateSeed
Definition TrackCand.h:128
void getHitWithPlane(int i, int &detId, int &hitId, int &planeId) const
Get detector Id, hit Id and plane id for hit number i.
Definition TrackCand.cc:115
int getPdgCode() const
Get the PDG code.
Definition TrackCand.h:139
std::vector< TrackCandHit * > hits_
Definition TrackCand.h:228
TVectorD state6D_
Definition TrackCand.h:234
void set6DSeedAndPdgCode(const TVectorD &state6D, const int pdgCode)
This function works the same as set6DSeed but instead of a charge hypothesis you can set a pdg code w...
Definition TrackCand.cc:253
unsigned int getNHits() const
Definition TrackCand.h:103
double getTimeSeed() const
Get the time at which the seed state is defined.
Definition TrackCand.h:122
TrackCand & operator=(TrackCand other)
assignment operator
Definition TrackCand.cc:69
void addHit(TrackCandHit *hit)
Definition TrackCand.h:148
void setPosMomSeedAndPdgCode(const TVector3 &pos, const TVector3 &mom, const int pdgCode)
This function works the same as setPosMomSeed but instead of a charge hypothesis you can set a pdg co...
Definition TrackCand.cc:266
void setPdgCode(int pdgCode)
Set a particle hypothesis in form of a PDG code. This will also set the charge attribute.
Definition TrackCand.cc:165
void reset()
Delete and clear the TrackCandHits.
Definition TrackCand.cc:172
const TMatrixDSym & getCovSeed() const
get the covariance matrix seed (6D).
Definition TrackCand.h:131
double getChargeSeed() const
Definition TrackCand.h:136
TVector3 getPosSeed() const
get the seed value for track: pos. Identical to the first 3 components of getStateSeed
Definition TrackCand.h:125
void setTimePosMomSeed(double time, const TVector3 &pos, const TVector3 &mom, const double charge)
sets the state to seed the track fitting and its time. State has to be a TVector3 for position and a ...
Definition TrackCand.cc:285
void setMcTrackId(int i)
Set the MCT track id, for MC simulations.
Definition TrackCand.h:151
TrackCandHit * getHit(int i) const
Definition TrackCand.cc:88
Defines for I/O streams used for error and debug printing.