SND@LHC Software
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 */
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 TVector3 getPosSeed() const {return TVector3(state6D_(0), state6D_(1), state6D_(2));}
123
125 TVector3 getMomSeed() const {return TVector3(state6D_(3), state6D_(4), state6D_(5));}
126
128 void setCovSeed(const TMatrixDSym& cov6D) {cov6D_ = cov6D; /* always 6D, no need to resize */}
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
174 void set6DSeed(const TVectorD& state6D, const double charge);
175
178 void set6DSeedAndPdgCode(const TVectorD& state6D, const int pdgCode);
179
183 void setPosMomSeed(const TVector3& pos, const TVector3& mom, const double charge);
184
187 void setPosMomSeedAndPdgCode(const TVector3& pos, const TVector3& mom, const int pdgCode);
188
189
190 private:
191
192 // Private Data Members ------------
193 std::vector<TrackCandHit*> hits_; //->
194
196 int pdg_;
198 TVectorD state6D_;
199 TMatrixDSym cov6D_;
200 double q_;
203 public:
204
205 ClassDef(TrackCand,1)
206
207};
208
209} /* End of namespace genfit */
212#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:210
std::vector< double > getSortingParameters() const
Get sorting parameterts of all hits.
Definition TrackCand.cc:145
bool hitInTrack(int detId, int hitId) const
Is there a hit with detId and hitId in the TrackCand?
Definition TrackCand.cc:178
std::vector< int > getDetIDs() const
Get detector IDs of all hits.
Definition TrackCand.cc:137
void addHit(int detId, int hitId, int planeId=-1, double sortingParameter=0)
Definition TrackCand.cc:122
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:253
friend bool operator==(const TrackCand &lhs, const TrackCand &rhs)
== operator checks equality of TrackCandHits. Does not check for sorting parameters.
Definition TrackCand.cc:188
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:73
void sortHits()
Sort the hits that were already added to the trackCand using the sorting parameters.
Definition TrackCand.cc:217
TMatrixDSym cov6D_
Definition TrackCand.h:199
std::set< int > getUniqueDetIDs() const
Definition TrackCand.cc:153
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:128
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:241
void Print(const Option_t *="") const
Write the content of all private attributes to the terminal.
Definition TrackCand.cc:197
int getMcTrackId() const
Get the MCT track id, for MC simulations - default value = -1.
Definition TrackCand.h:119
std::vector< int > getHitIDs(int detId=-2) const
Get hit ids of from a specific detector.
Definition TrackCand.cc:127
TVector3 getMomSeed() const
get the seed value for track: mom. Identical to the last 3 components of getStateSeed
Definition TrackCand.h:125
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:112
int getPdgCode() const
Get the PDG code.
Definition TrackCand.h:139
std::vector< TrackCandHit * > hits_
Definition TrackCand.h:193
TVectorD state6D_
Definition TrackCand.h:198
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:248
unsigned int getNHits() const
Definition TrackCand.h:103
TrackCand & operator=(TrackCand other)
assignment operator
Definition TrackCand.cc:67
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:261
void setPdgCode(int pdgCode)
Set a particle hypothesis in form of a PDG code. This will also set the charge attribute.
Definition TrackCand.cc:162
void reset()
Delete and clear the TrackCandHits.
Definition TrackCand.cc:169
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:122
void setMcTrackId(int i)
Set the MCT track id, for MC simulations.
Definition TrackCand.h:151
TrackCandHit * getHit(int i) const
Definition TrackCand.cc:85
Matrix inversion tools.
Definition AbsBField.h:29