22#include "TDatabasePDG.h"
42 for (
unsigned int i=0; i<
hits_.size(); ++i) {
51 mcTrackId_(other.mcTrackId_),
53 state6D_(other.state6D_),
59 for (
unsigned int i=0; i<other.
hits_.size(); ++i) {
81 std::swap(this->
q_, other.
q_);
97 detId =
hits_.at(i)->getDetId();
98 hitId =
hits_[i]->getHitId();
106 detId =
hits_.at(i)->getDetId();
107 hitId =
hits_[i]->getHitId();
108 sortingParameter =
hits_[i]->getSortingParameter();
116 detId =
hits_.at(i)->getDetId();
117 hitId =
hits_[i]->getHitId();
118 planeId =
hits_[i]->getPlaneId();
128 std::vector<int> result;
129 for(
unsigned int i=0; i<
hits_.size(); ++i){
130 if(detId==-2 ||
hits_[i]->getDetId() == detId) {
131 result.push_back(
hits_[i]->getHitId());
138 std::vector<int> result;
139 for(
unsigned int i=0; i<
hits_.size(); ++i){
140 result.push_back(
hits_[i]->getDetId());
146 std::vector<double> result;
147 for(
unsigned int i=0; i<
hits_.size(); ++i){
148 result.push_back(
hits_[i]->getSortingParameter());
154 std::set<int> retVal;
155 for (
unsigned int i = 0; i <
hits_.size(); ++i) {
156 retVal.insert(
hits_[i]->getDetId());
164 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(
pdg_);
165 q_ = part->Charge() / (3.);
171 for (
unsigned int i=0; i<
hits_.size(); ++i) {
180 for (
unsigned int i = 0; i <
hits_.size(); ++i){
181 if (detId ==
hits_[i]->getDetId() && hitId ==
hits_[i]->getHitId())
190 for (
unsigned int i = 0; i < lhs.
getNHits(); ++i){
198 std::cout <<
"======== TrackCand::print ========\n";
199 std::cout <<
"mcTrackId=" <<
mcTrackId_ <<
"\n";
200 std::cout <<
"seed values for 6D state: \n";
202 std::cout <<
"q" <<
q_ <<
"\n";
203 std::cout <<
"PDG code= " <<
pdg_ <<
"\n";
204 for(
unsigned int i=0; i<
hits_.size(); ++i){
211 for(
unsigned int i=0; i<rhs.
getNHits(); ++i){
224 const unsigned int nHits(
getNHits());
225 if (indices.size() != nHits){
227 Exception exc(
"TrackCand::sortHits ==> Size of indices != number of hits!",__LINE__,__FILE__);
232 std::vector<TrackCandHit*> sortedHits(nHits);
233 for (
unsigned int i=0; i<nHits; ++i){
234 sortedHits[i] =
hits_[indices[i]];
242 if (
pdg_ != 0 &&
q_ != charge)
254 if (
pdg_ != 0 &&
q_ != charge)
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Hit object for use in TrackCand. Provides IDs and sorting parameters.
virtual TrackCandHit * clone() const
Track candidate – seed values and indices.
void append(const TrackCand &)
Clone the TrackCandHit objects from the other TrackCand and append them to this TrackCand.
std::vector< double > getSortingParameters() const
Get sorting parameterts of all hits.
bool hitInTrack(int detId, int hitId) const
Is there a hit with detId and hitId in the TrackCand?
std::vector< int > getDetIDs() const
Get detector IDs of all hits.
void addHit(int detId, int hitId, int planeId=-1, double sortingParameter=0)
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 ...
static bool compareTrackCandHits(const TrackCandHit *lhs, const TrackCandHit *rhs)
void swap(TrackCand &other)
void sortHits()
Sort the hits that were already added to the trackCand using the sorting parameters.
std::set< int > getUniqueDetIDs() const
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...
void Print(const Option_t *="") const
Write the content of all private attributes to the terminal.
std::vector< int > getHitIDs(int detId=-2) const
Get hit ids of from a specific detector.
void getHitWithPlane(int i, int &detId, int &hitId, int &planeId) const
Get detector Id, hit Id and plane id for hit number i.
std::vector< TrackCandHit * > 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...
unsigned int getNHits() const
TrackCand & operator=(TrackCand other)
assignment operator
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 setPdgCode(int pdgCode)
Set a particle hypothesis in form of a PDG code. This will also set the charge attribute.
void reset()
Delete and clear the TrackCandHits.
TrackCandHit * getHit(int i) const
bool operator==(const DetPlane &lhs, const DetPlane &rhs)