22 #include "TDatabasePDG.h"
43 for (
unsigned int i=0; i<
hits_.size(); ++i) {
52 mcTrackId_(other.mcTrackId_),
55 state6D_(other.state6D_),
61 for (
unsigned int i=0; i<other.
hits_.size(); ++i) {
84 std::swap(this->
q_, other.
q_);
100 detId =
hits_.at(i)->getDetId();
101 hitId =
hits_[i]->getHitId();
109 detId =
hits_.at(i)->getDetId();
110 hitId =
hits_[i]->getHitId();
111 sortingParameter =
hits_[i]->getSortingParameter();
119 detId =
hits_.at(i)->getDetId();
120 hitId =
hits_[i]->getHitId();
121 planeId =
hits_[i]->getPlaneId();
131 std::vector<int> result;
132 for(
unsigned int i=0; i<
hits_.size(); ++i){
133 if(detId==-2 ||
hits_[i]->getDetId() == detId) {
134 result.push_back(
hits_[i]->getHitId());
141 std::vector<int> result;
142 for(
unsigned int i=0; i<
hits_.size(); ++i){
143 result.push_back(
hits_[i]->getDetId());
149 std::vector<double> result;
150 for(
unsigned int i=0; i<
hits_.size(); ++i){
151 result.push_back(
hits_[i]->getSortingParameter());
157 std::set<int> retVal;
158 for (
unsigned int i = 0; i <
hits_.size(); ++i) {
159 retVal.insert(
hits_[i]->getDetId());
167 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(
pdg_);
168 q_ = part->Charge() / (3.);
174 for (
unsigned int i=0; i<
hits_.size(); ++i) {
183 for (
unsigned int i = 0; i <
hits_.size(); ++i){
184 if (detId ==
hits_[i]->getDetId() && hitId ==
hits_[i]->getHitId())
193 for (
unsigned int i = 0; i < lhs.
getNHits(); ++i){
203 printOut <<
"======== TrackCand::print ========\n";
205 printOut <<
"seed values for 6D state: \n";
209 for(
unsigned int i=0; i<
hits_.size(); ++i){
216 for(
unsigned int i=0; i<rhs.
getNHits(); ++i){
229 const unsigned int nHits(
getNHits());
230 if (indices.size() != nHits){
232 Exception exc(
"TrackCand::sortHits ==> Size of indices != number of hits!",__LINE__,__FILE__);
237 std::vector<TrackCandHit*> sortedHits(nHits);
238 for (
unsigned int i=0; i<nHits; ++i){
239 sortedHits[i] =
hits_[indices[i]];
247 if (
pdg_ != 0 &&
q_ != charge)
259 if (
pdg_ != 0 &&
q_ != charge)
286 const TVector3& mom,
const double charge)
293 const TVector3& mom,
const int pdgCode)
void append(const TrackCand &)
Clone the TrackCandHit objects from the other TrackCand and append them to this TrackCand.
bool operator==(const DetPlane &lhs, const DetPlane &rhs)
virtual TrackCandHit * clone() const
bool hitInTrack(int detId, int hitId) const
Is there a hit with detId and hitId in the TrackCand?
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 ...
void reset()
Delete and clear the TrackCandHits.
Hit object for use in TrackCand. Provides IDs and sorting parameters.
static bool compareTrackCandHits(const TrackCandHit *lhs, const TrackCandHit *rhs)
TrackCand & operator=(TrackCand other)
assignment operator
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 ...
Track candidate – seed values and indices.
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...
void Print(const Option_t *="") const
Write the content of all private attributes to the terminal.
unsigned int getNHits() const
void swap(TrackCand &other)
void setPdgCode(int pdgCode)
Set a particle hypothesis in form of a PDG code. This will also set the charge attribute.
std::vector< double > getSortingParameters() const
Get sorting parameterts of all hits.
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...
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...
std::set< int > getUniqueDetIDs() const
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
TrackCandHit * getHit(int i) const
std::vector< int > getHitIDs(int detId=-2) const
Get hit ids of from a specific detector.
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). First 3 elements are the staring postion second 3 elements the starting momentum. Everything in global coordinates charge is the charge hypotheses of the particle charge.
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...
std::vector< TrackCandHit * > hits_
void getHitWithPlane(int i, int &detId, int &hitId, int &planeId) const
Get detector Id, hit Id and plane id for hit number i.
void addHit(int detId, int hitId, int planeId=-1, double sortingParameter=0)
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...
std::vector< int > getDetIDs() const
Get detector IDs of all hits.
Defines for I/O streams used for error and debug printing.
void sortHits()
Sort the hits that were already added to the trackCand using the sorting parameters.