LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GFTrackCand.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
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 GFTRACKCAND_H
23 #define GFTRACKCAND_H
24 
25 #include <vector>
26 #include <set>
27 
28 #include "TObject.h"
29 #include "TVector3.h"
30 
32 
53 namespace genf {
54 
55  class GFTrackCand : public TObject {
56  public:
57 
58  // Constructors/Destructors ---------
59  GFTrackCand();
60  ~GFTrackCand();
61 
74  GFTrackCand(double curv, double dip, double inv, std::vector<unsigned int> detIDs, std::vector<unsigned int> hitIDs);
75  /* @brief same as previous ctor, but with ordering parameters */
76  GFTrackCand(double curv, double dip, double inv, std::vector<unsigned int> detIDs, std::vector<unsigned int> hitIDs, std::vector<double> rhos);
77 
78  /* @brief == operator does not check for rho */
79  friend bool operator== (const GFTrackCand& lhs, const GFTrackCand& rhs);
80 
81  // Accessors -----------------------
84  void getHit(unsigned int i,
85  unsigned int& detId,
86  unsigned int& hitId) const {
87  if (i >= getNHits())
88  throw GFException("genf::GFTrackCand::getHit(int, int, int): hit index out of range", __LINE__, __FILE__).setFatal();
89  detId=fDetId.at(i);hitId=fHitId.at(i);
90  }
94  void getHit(unsigned int i,
95  unsigned int& detId,
96  unsigned int& hitId,
97  double &rho) const {
98  if (i >= getNHits())
99  throw GFException("genf::GFTrackCand::getHit(int, int, int, double): hit index out of range", __LINE__, __FILE__).setFatal();
100  detId=fDetId.at(i);hitId=fHitId.at(i);
101  rho=fRho.at(i);
102  }
106  void getHitWithPlane(unsigned int i,
107  unsigned int& detId,
108  unsigned int& hitId,
109  unsigned int& planeId) const {
110  if (i >= getNHits())
111  throw GFException("genf::GFTrackCand::getHitWithPlane(): hit index out of range", __LINE__, __FILE__).setFatal();
112  detId=fDetId.at(i);hitId=fHitId.at(i);
113  planeId=fPlaneId.at(i);
114  }
115 
116  unsigned int getNHits() const {return fDetId.size();}
117  double getCurv() const {return fCurv;}
118  double getDip() const {return fDip;}
119  bool inverted() const {return fInv;}
120  std::vector<unsigned int> GetHitIDs(int detId=-1);
121  std::vector<unsigned int> GetDetIDs() const {return fDetId;}
122  std::vector<double> GetRhos() const {return fRho;}
123  std::set<unsigned int> GetUniqueDetIDs() const {
124  std::set<unsigned int> retVal;
125  for(unsigned int i=0;i<fDetId.size();++i){
126  retVal.insert(fDetId.at(i));
127  }
128  return retVal;
129  }
132  int getMcTrackId() const {return fMcTrackId;}
134  TVector3 getPosSeed() const {return fPosSeed;}
136  TVector3 getDirSeed() const {return fDirSeed;}
138  double getQoverPseed() const {return fQoverpSeed;}
139  TVector3 getPosError() const {return fPosError;}
141  TVector3 getDirError() const {return fDirError;}
143  int getPdgCode() const {return fPdg;}
144 
145  // Modifiers -----------------------
146  void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0);
147  void setCurv(double c){fCurv=c;}
148  void setDip(double d){fDip=d;}
149  void setInverted(bool f=true) {fInv=f;}
152  void setMcTrackId(int i){fMcTrackId=i;}
155  bool HitInTrack(unsigned int detId, unsigned int hitId);
158  void setTrackSeed(const TVector3& p,const TVector3& d,double qop){
160  }
161 
162  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));
165  void setPdgCode(int pdgCode){fPdg=pdgCode;}
166 
167  void append(const GFTrackCand&);
168 
169  // Operations ----------------------
170  void reset();
171  void Print(std::ostream& out = std::cout) const ;
172 
173  private:
174 
175  // Private Data Members ------------
176  std::vector<unsigned int> fDetId;
177  std::vector<unsigned int> fHitId;
178  std::vector<unsigned int> fPlaneId;
179  std::vector<double> fRho;
180 
181  double fCurv; // curvature from pattern reco
182  double fDip; // dip angle from pattern reco
183  bool fInv; // true if inverted track
184 
185  TVector3 fPosSeed; //seed value for the track: pos
186  TVector3 fDirSeed; //direction
187  double fQoverpSeed; //q/p
188  TVector3 fPosError; //error on position seed given as a standard deviation
189  TVector3 fDirError; //error on direction seed given as a standard deviation
190  int fPdg; // particle data groupe's id for a particle
191 
192  int fMcTrackId; //if MC simulation, store the mct track id here
193  // Private Methods -----------------
194 
195  virtual void Print(Option_t*) const
196  { throw GFException(std::string(__func__) + "::Print(Option_t*) not available", __LINE__, __FILE__).setFatal(); }
197 
198  //public:
199  //ClassDef(GFTrackCand,3)
200  };
201 
202  bool operator==(const genf::GFTrackCand&, const genf::GFTrackCand&);
203 } // namespace genf
204 #endif
205 
friend bool operator==(const GFTrackCand &lhs, const GFTrackCand &rhs)
TVector3 getPosError() const
Definition: GFTrackCand.h:139
double getCurv() const
Definition: GFTrackCand.h:117
void setTrackSeed(const TVector3 &p, const TVector3 &d, double qop)
set the seed values for track: pos, direction, q/p
Definition: GFTrackCand.h:158
TVector3 getPosSeed() const
get the seed value for track: pos
Definition: GFTrackCand.h:134
void setPdgCode(int pdgCode)
set a particle hypothesis in form of a PDG code
Definition: GFTrackCand.h:165
TVector3 fPosError
Definition: GFTrackCand.h:188
void Print(std::ostream &out=std::cout) const
Definition: GFTrackCand.cxx:94
Generic Interface to magnetic fields in GENFIT.
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.
Definition: GFTrackCand.h:106
virtual void Print(Option_t *) const
Definition: GFTrackCand.h:195
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...
Definition: GFTrackCand.h:94
TVector3 getDirSeed() const
get the seed value for track: direction
Definition: GFTrackCand.h:136
void append(const GFTrackCand &)
TFile f
Definition: plotHisto.C:6
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))
bool HitInTrack(unsigned int detId, unsigned int hitId)
Test if hit already is part of this track candidate.
Definition: GFTrackCand.cxx:77
std::vector< double > GetRhos() const
Definition: GFTrackCand.h:122
std::vector< unsigned int > fPlaneId
Definition: GFTrackCand.h:178
double getDip() const
Definition: GFTrackCand.h:118
Float_t d
Definition: plot.C:237
void setCurv(double c)
Definition: GFTrackCand.h:147
int getPdgCode() const
get the PDG code
Definition: GFTrackCand.h:143
void setDip(double d)
Definition: GFTrackCand.h:148
bool inverted() const
Definition: GFTrackCand.h:119
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
Definition: GFTrackCand.h:84
unsigned int getNHits() const
Definition: GFTrackCand.h:116
void setMcTrackId(int i)
set the MCT track id, for MC simulations
Definition: GFTrackCand.h:152
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:50
std::vector< unsigned int > GetHitIDs(int detId=-1)
Definition: GFTrackCand.cxx:57
std::set< unsigned int > GetUniqueDetIDs() const
Definition: GFTrackCand.h:123
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:80
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
Definition: GFTrackCand.cxx:48
void setInverted(bool f=true)
Definition: GFTrackCand.h:149
TVector3 getDirError() const
get the seed value for track: error on direction (standard deviation)
Definition: GFTrackCand.h:141
int getMcTrackId() const
get the MCT track id, for MC simulations - def. value -1
Definition: GFTrackCand.h:132
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:176
std::vector< unsigned int > GetDetIDs() const
Definition: GFTrackCand.h:121
TVector3 fDirError
Definition: GFTrackCand.h:189
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:177
double getQoverPseed() const
get the seed value for track: qoverp
Definition: GFTrackCand.h:138
std::vector< double > fRho
Definition: GFTrackCand.h:179