LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
genf::GFTrackCand Class Reference

#include "GFTrackCand.h"

Inheritance diagram for genf::GFTrackCand:

Public Member Functions

 GFTrackCand ()
 
 ~GFTrackCand ()
 
 GFTrackCand (double curv, double dip, double inv, std::vector< unsigned int > detIDs, std::vector< unsigned int > hitIDs)
 Initializing constructor. More...
 
 GFTrackCand (double curv, double dip, double inv, std::vector< unsigned int > detIDs, std::vector< unsigned int > hitIDs, std::vector< double > rhos)
 
void getHit (unsigned int i, unsigned int &detId, unsigned int &hitId) const
 Get detector ID and cluster index (hitId) for hit number i. More...
 
void getHit (unsigned int i, unsigned int &detId, unsigned int &hitId, double &rho) const
 Get detector ID and cluster index (hitId) for hit number i with ordering parameter rho. More...
 
void getHitWithPlane (unsigned int i, unsigned int &detId, unsigned int &hitId, unsigned int &planeId) const
 Get detector ID and cluster index (hitId) for hit number i with plane id. More...
 
unsigned int getNHits () const
 
double getCurv () const
 
double getDip () const
 
bool inverted () const
 
std::vector< unsigned int > GetHitIDs (int detId=-1)
 
std::vector< unsigned int > GetDetIDs () const
 
std::vector< double > GetRhos () const
 
std::set< unsigned int > GetUniqueDetIDs () const
 
int getMcTrackId () const
 get the MCT track id, for MC simulations - def. value -1 More...
 
TVector3 getPosSeed () const
 get the seed value for track: pos More...
 
TVector3 getDirSeed () const
 get the seed value for track: direction More...
 
double getQoverPseed () const
 get the seed value for track: qoverp More...
 
TVector3 getPosError () const
 
TVector3 getDirError () const
 get the seed value for track: error on direction (standard deviation) More...
 
int getPdgCode () const
 get the PDG code More...
 
void addHit (unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
 
void setCurv (double c)
 
void setDip (double d)
 
void setInverted (bool f=true)
 
void setMcTrackId (int i)
 set the MCT track id, for MC simulations More...
 
bool HitInTrack (unsigned int detId, unsigned int hitId)
 Test if hit already is part of this track candidate. More...
 
void setTrackSeed (const TVector3 &p, const TVector3 &d, double qop)
 set the seed values for track: pos, direction, q/p More...
 
void setComplTrackSeed (const TVector3 &pos, const TVector3 &mom, const int pdgCode, TVector3 posError=TVector3(1.0, 1.0, 1.0), TVector3 dirError=TVector3(1.0, 1.0, 1.0))
 
void setPdgCode (int pdgCode)
 set a particle hypothesis in form of a PDG code More...
 
void append (const GFTrackCand &)
 
void reset ()
 
void Print (std::ostream &out=std::cout) const
 

Private Member Functions

virtual void Print (Option_t *) const
 

Private Attributes

std::vector< unsigned int > fDetId
 
std::vector< unsigned int > fHitId
 
std::vector< unsigned int > fPlaneId
 
std::vector< double > fRho
 
double fCurv
 
double fDip
 
bool fInv
 
TVector3 fPosSeed
 
TVector3 fDirSeed
 
double fQoverpSeed
 
TVector3 fPosError
 
TVector3 fDirError
 
int fPdg
 
int fMcTrackId
 

Friends

bool operator== (const GFTrackCand &lhs, const GFTrackCand &rhs)
 

Detailed Description

Definition at line 56 of file GFTrackCand.h.

Constructor & Destructor Documentation

genf::GFTrackCand::GFTrackCand ( )

Definition at line 28 of file GFTrackCand.cxx.

28  : fCurv(0), fDip(0), fInv(false), fQoverpSeed(0.), fMcTrackId(-1)
29 {}
genf::GFTrackCand::~GFTrackCand ( )

Definition at line 31 of file GFTrackCand.cxx.

31 {}
genf::GFTrackCand::GFTrackCand ( double  curv,
double  dip,
double  inv,
std::vector< unsigned int >  detIDs,
std::vector< unsigned int >  hitIDs 
)

Initializing constructor.

Parameters
curvCurvature from prefit. There is no stringent definition what this parameter means at the moment.
dipDip angle from prefit. There is no stringent definition what this parameter means at the moment.
invDummy paramter. Has been used to mark inverted tracks in the past.
detIDscollection of detector IDs. Each detector ID needs a corresponding GFRecoHitProducer. See RecoHitFactory for details.
hitIDscollection of hit indices.

Definition at line 33 of file GFTrackCand.cxx.

References fDetId, fHitId, fRho, and GFException::setFatal().

38  : fDetId(detIDs)
39  , fHitId(hitIDs)
40  , fCurv(curv)
41  , fDip(dip)
42  , fInv(inv)
43  , fQoverpSeed(0.)
44  , fMcTrackId(-1)
45 {
46  if (fDetId.size() != fHitId.size())
47  throw GFException("genf::GFTrackCand::GFTrackCand(): hit/det size mismatch", __LINE__, __FILE__)
48  .setFatal();
49  fRho.resize(fDetId.size(), 0.);
50 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
std::vector< double > fRho
Definition: GFTrackCand.h:204
genf::GFTrackCand::GFTrackCand ( double  curv,
double  dip,
double  inv,
std::vector< unsigned int >  detIDs,
std::vector< unsigned int >  hitIDs,
std::vector< double >  rhos 
)

Definition at line 51 of file GFTrackCand.cxx.

References fDetId, fHitId, and GFException::setFatal().

57  : fDetId(detIDs)
58  , fHitId(hitIDs)
59  , fRho(rhos)
60  , fCurv(curv)
61  , fDip(dip)
62  , fInv(inv)
63  , fQoverpSeed(0.)
64  , fMcTrackId(-1)
65 {
66  if (fDetId.size() != fHitId.size())
67  throw GFException("genf::GFTrackCand::GFTrackCand(): hit/det size mismatch", __LINE__, __FILE__)
68  .setFatal();
69  if (fDetId.size() != fHitId.size())
70  throw GFException("genf::GFTrackCand::GFTrackCand(): rho/det size mismatch", __LINE__, __FILE__)
71  .setFatal();
72 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
std::vector< double > fRho
Definition: GFTrackCand.h:204

Member Function Documentation

void genf::GFTrackCand::addHit ( unsigned int  detId,
unsigned int  hitId,
double  rho = 0.,
unsigned int  planeId = 0 
)

Definition at line 74 of file GFTrackCand.cxx.

References fDetId, fHitId, fPlaneId, and fRho.

Referenced by genf::GFTrack::addHit(), append(), and getPdgCode().

78 {
79  fDetId.push_back(detId);
80  fHitId.push_back(hitId);
81  fPlaneId.push_back(planeId);
82  fRho.push_back(rho);
83 }
std::vector< unsigned int > fPlaneId
Definition: GFTrackCand.h:203
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
std::vector< double > fRho
Definition: GFTrackCand.h:204
void genf::GFTrackCand::append ( const GFTrackCand rhs)

Definition at line 139 of file GFTrackCand.cxx.

References addHit(), getHit(), and getNHits().

Referenced by setPdgCode().

140 {
141  unsigned int detId, hitId;
142  double rho;
143  for (unsigned int i = 0; i < rhs.getNHits(); ++i) {
144  rhs.getHit(i, detId, hitId, rho);
145  addHit(detId, hitId, rho);
146  }
147 }
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
Definition: GFTrackCand.cxx:74
double genf::GFTrackCand::getCurv ( ) const
inline

Definition at line 135 of file GFTrackCand.h.

References fCurv.

135 { return fCurv; }
std::vector<unsigned int> genf::GFTrackCand::GetDetIDs ( ) const
inline

Definition at line 139 of file GFTrackCand.h.

References fDetId.

139 { return fDetId; }
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
double genf::GFTrackCand::getDip ( ) const
inline

Definition at line 136 of file GFTrackCand.h.

References fDip.

136 { return fDip; }
TVector3 genf::GFTrackCand::getDirError ( ) const
inline

get the seed value for track: error on direction (standard deviation)

Definition at line 160 of file GFTrackCand.h.

References fDirError.

Referenced by genf::RKTrackRep::RKTrackRep().

160 { return fDirError; }
TVector3 fDirError
Definition: GFTrackCand.h:214
TVector3 genf::GFTrackCand::getDirSeed ( ) const
inline

get the seed value for track: direction

Definition at line 155 of file GFTrackCand.h.

References fDirSeed.

Referenced by genf::RKTrackRep::RKTrackRep().

155 { return fDirSeed; }
void genf::GFTrackCand::getHit ( unsigned int  i,
unsigned int &  detId,
unsigned int &  hitId 
) const
inline

Get detector ID and cluster index (hitId) for hit number i.

Definition at line 93 of file GFTrackCand.h.

References fDetId, fHitId, getNHits(), and GFException::setFatal().

Referenced by append(), genf::GFRecoHitFactory::createMany(), genf::GFTrack::getResiduals(), and genf::GFTrack::mergeHits().

94  {
95  if (i >= getNHits())
96  throw GFException(
97  "genf::GFTrackCand::getHit(int, int, int): hit index out of range", __LINE__, __FILE__)
98  .setFatal();
99  detId = fDetId.at(i);
100  hitId = fHitId.at(i);
101  }
unsigned int getNHits() const
Definition: GFTrackCand.h:134
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
void genf::GFTrackCand::getHit ( unsigned int  i,
unsigned int &  detId,
unsigned int &  hitId,
double &  rho 
) const
inline

Get detector ID and cluster index (hitId) for hit number i with ordering parameter rho.

Definition at line 105 of file GFTrackCand.h.

References fDetId, fHitId, fRho, getNHits(), and GFException::setFatal().

106  {
107  if (i >= getNHits())
108  throw GFException(
109  "genf::GFTrackCand::getHit(int, int, int, double): hit index out of range",
110  __LINE__,
111  __FILE__)
112  .setFatal();
113  detId = fDetId.at(i);
114  hitId = fHitId.at(i);
115  rho = fRho.at(i);
116  }
unsigned int getNHits() const
Definition: GFTrackCand.h:134
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
std::vector< double > fRho
Definition: GFTrackCand.h:204
std::vector< unsigned int > genf::GFTrackCand::GetHitIDs ( int  detId = -1)

Definition at line 85 of file GFTrackCand.cxx.

References fDetId, fHitId, and n.

Referenced by inverted().

86 {
87  if (detId < 0) { // return hits from all detectors
88  return fHitId;
89  }
90  else {
91  std::vector<unsigned int> result;
92  unsigned int n = fHitId.size();
93  for (unsigned int i = 0; i < n; ++i) {
94  if (fDetId[i] == (unsigned int)detId) result.push_back(fHitId[i]);
95  }
96  return result;
97  }
98 }
Char_t n[5]
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
void genf::GFTrackCand::getHitWithPlane ( unsigned int  i,
unsigned int &  detId,
unsigned int &  hitId,
unsigned int &  planeId 
) const
inline

Get detector ID and cluster index (hitId) for hit number i with plane id.

Definition at line 120 of file GFTrackCand.h.

References fDetId, fHitId, fPlaneId, getNHits(), and GFException::setFatal().

Referenced by genf::GFTrack::getHitsByPlane().

124  {
125  if (i >= getNHits())
126  throw GFException(
127  "genf::GFTrackCand::getHitWithPlane(): hit index out of range", __LINE__, __FILE__)
128  .setFatal();
129  detId = fDetId.at(i);
130  hitId = fHitId.at(i);
131  planeId = fPlaneId.at(i);
132  }
std::vector< unsigned int > fPlaneId
Definition: GFTrackCand.h:203
unsigned int getNHits() const
Definition: GFTrackCand.h:134
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
int genf::GFTrackCand::getMcTrackId ( ) const
inline

get the MCT track id, for MC simulations - def. value -1

Definition at line 151 of file GFTrackCand.h.

References fMcTrackId.

151 { return fMcTrackId; }
unsigned int genf::GFTrackCand::getNHits ( ) const
inline

Definition at line 134 of file GFTrackCand.h.

References fDetId.

Referenced by append(), genf::GFRecoHitFactory::createMany(), genf::GFTrack::fillGeoTrack(), getHit(), genf::GFTrack::getHitsByPlane(), getHitWithPlane(), and genf::operator==().

134 { return fDetId.size(); }
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
int genf::GFTrackCand::getPdgCode ( ) const
inline

get the PDG code

Definition at line 162 of file GFTrackCand.h.

References addHit(), and fPdg.

Referenced by genf::RKTrackRep::RKTrackRep().

162 { return fPdg; }
TVector3 genf::GFTrackCand::getPosError ( ) const
inline

Definition at line 158 of file GFTrackCand.h.

References fPosError.

Referenced by genf::RKTrackRep::RKTrackRep().

158 { return fPosError; }
TVector3 fPosError
Definition: GFTrackCand.h:213
TVector3 genf::GFTrackCand::getPosSeed ( ) const
inline

get the seed value for track: pos

Definition at line 153 of file GFTrackCand.h.

References fPosSeed.

Referenced by genf::RKTrackRep::RKTrackRep().

153 { return fPosSeed; }
double genf::GFTrackCand::getQoverPseed ( ) const
inline

get the seed value for track: qoverp

Definition at line 157 of file GFTrackCand.h.

References fQoverpSeed.

157 { return fQoverpSeed; }
std::vector<double> genf::GFTrackCand::GetRhos ( ) const
inline

Definition at line 140 of file GFTrackCand.h.

References fRho.

140 { return fRho; }
std::vector< double > fRho
Definition: GFTrackCand.h:204
std::set<unsigned int> genf::GFTrackCand::GetUniqueDetIDs ( ) const
inline

Definition at line 141 of file GFTrackCand.h.

References fDetId.

142  {
143  std::set<unsigned int> retVal;
144  for (unsigned int i = 0; i < fDetId.size(); ++i) {
145  retVal.insert(fDetId.at(i));
146  }
147  return retVal;
148  }
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
bool genf::GFTrackCand::HitInTrack ( unsigned int  detId,
unsigned int  hitId 
)

Test if hit already is part of this track candidate.

Definition at line 106 of file GFTrackCand.cxx.

References fDetId, and fHitId.

Referenced by setMcTrackId().

107 {
108  for (unsigned int i = 0; i < fDetId.size(); i++) {
109  if (detId == fDetId[i])
110  if (hitId == fHitId[i]) return true;
111  }
112  return false;
113 }
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
bool genf::GFTrackCand::inverted ( ) const
inline

Definition at line 137 of file GFTrackCand.h.

References fInv, and GetHitIDs().

137 { return fInv; }
void genf::GFTrackCand::Print ( std::ostream &  out = std::cout) const

Definition at line 123 of file GFTrackCand.cxx.

References fDetId, fDirSeed, fHitId, fMcTrackId, fPosSeed, fQoverpSeed, fRho, and genf::PrintROOTobject().

Referenced by setPdgCode().

124 {
125  out << "======== GFTrackCand::print ========";
126  if (fMcTrackId >= 0) out << "\nmcTrackId=" << fMcTrackId;
127  out << "\nseed values for pos,direction, and q/p: " << std::endl;
130  out << "q/p=" << fQoverpSeed << std::endl;
131  if (fDetId.size() != fHitId.size())
132  throw std::runtime_error("genf::GFTrackCand::GFTrackCand(): hit/det size mismatch");
133  out << "detId|hitId|rho ";
134  for (unsigned int i = 0; i < fDetId.size(); ++i)
135  out << fDetId.at(i) << "|" << fHitId.at(i) << "|" << fRho.at(i) << " ";
136  out << std::endl;
137 }
void PrintROOTobject(std::ostream &, const ROOTOBJ &)
Small utility functions which print some ROOT objects into an output stream.
Definition: GFException.h:127
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
std::vector< double > fRho
Definition: GFTrackCand.h:204
virtual void genf::GFTrackCand::Print ( Option_t *  ) const
inlineprivatevirtual

Definition at line 220 of file GFTrackCand.h.

References operator==, and GFException::setFatal().

221  {
222  throw GFException(
223  std::string(__func__) + "::Print(Option_t*) not available", __LINE__, __FILE__)
224  .setFatal();
225  }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
void genf::GFTrackCand::reset ( )

Definition at line 100 of file GFTrackCand.cxx.

References fDetId, and fHitId.

Referenced by setPdgCode().

101 {
102  fDetId.clear();
103  fHitId.clear();
104 }
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:201
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:202
void genf::GFTrackCand::setComplTrackSeed ( const TVector3 &  pos,
const TVector3 &  mom,
const int  pdgCode,
TVector3  posError = TVector3(1.0, 1.0, 1.0),
TVector3  dirError = TVector3(1.0, 1.0, 1.0) 
)

Referenced by setTrackSeed().

void genf::GFTrackCand::setCurv ( double  c)
inline

Definition at line 166 of file GFTrackCand.h.

References fCurv.

166 { fCurv = c; }
void genf::GFTrackCand::setDip ( double  d)
inline

Definition at line 167 of file GFTrackCand.h.

References d, and fDip.

167 { fDip = d; }
Float_t d
Definition: plot.C:235
void genf::GFTrackCand::setInverted ( bool  f = true)
inline

Definition at line 168 of file GFTrackCand.h.

References f, and fInv.

168 { fInv = f; }
TFile f
Definition: plotHisto.C:6
void genf::GFTrackCand::setMcTrackId ( int  i)
inline

set the MCT track id, for MC simulations

Definition at line 171 of file GFTrackCand.h.

References fMcTrackId, and HitInTrack().

171 { fMcTrackId = i; }
void genf::GFTrackCand::setPdgCode ( int  pdgCode)
inline

set a particle hypothesis in form of a PDG code

Definition at line 191 of file GFTrackCand.h.

References append(), fPdg, Print(), and reset().

191 { fPdg = pdgCode; }
void genf::GFTrackCand::setTrackSeed ( const TVector3 &  p,
const TVector3 &  d,
double  qop 
)
inline

set the seed values for track: pos, direction, q/p

Definition at line 177 of file GFTrackCand.h.

References d, fDirSeed, fPosSeed, fQoverpSeed, and setComplTrackSeed().

178  {
179  fPosSeed = p;
180  fDirSeed = d;
181  fQoverpSeed = qop;
182  }
Float_t d
Definition: plot.C:235

Friends And Related Function Documentation

bool operator== ( const GFTrackCand lhs,
const GFTrackCand rhs 
)
friend

Referenced by Print().

Member Data Documentation

double genf::GFTrackCand::fCurv
private

Definition at line 206 of file GFTrackCand.h.

Referenced by getCurv(), and setCurv().

std::vector<unsigned int> genf::GFTrackCand::fDetId
private
double genf::GFTrackCand::fDip
private

Definition at line 207 of file GFTrackCand.h.

Referenced by getDip(), and setDip().

TVector3 genf::GFTrackCand::fDirError
private

Definition at line 214 of file GFTrackCand.h.

Referenced by getDirError().

TVector3 genf::GFTrackCand::fDirSeed
private

Definition at line 211 of file GFTrackCand.h.

Referenced by getDirSeed(), Print(), and setTrackSeed().

std::vector<unsigned int> genf::GFTrackCand::fHitId
private
bool genf::GFTrackCand::fInv
private

Definition at line 208 of file GFTrackCand.h.

Referenced by inverted(), and setInverted().

int genf::GFTrackCand::fMcTrackId
private

Definition at line 217 of file GFTrackCand.h.

Referenced by getMcTrackId(), Print(), and setMcTrackId().

int genf::GFTrackCand::fPdg
private

Definition at line 215 of file GFTrackCand.h.

Referenced by getPdgCode(), and setPdgCode().

std::vector<unsigned int> genf::GFTrackCand::fPlaneId
private

Definition at line 203 of file GFTrackCand.h.

Referenced by addHit(), and getHitWithPlane().

TVector3 genf::GFTrackCand::fPosError
private

Definition at line 213 of file GFTrackCand.h.

Referenced by getPosError().

TVector3 genf::GFTrackCand::fPosSeed
private

Definition at line 210 of file GFTrackCand.h.

Referenced by getPosSeed(), Print(), and setTrackSeed().

double genf::GFTrackCand::fQoverpSeed
private

Definition at line 212 of file GFTrackCand.h.

Referenced by getQoverPseed(), Print(), and setTrackSeed().

std::vector<double> genf::GFTrackCand::fRho
private

Definition at line 204 of file GFTrackCand.h.

Referenced by addHit(), getHit(), GetRhos(), GFTrackCand(), and Print().


The documentation for this class was generated from the following files: