FairRoot/PandaRoot
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 #include <iostream>
28 #include "assert.h"
29 
30 #include "TObject.h"
31 #include "TVector3.h"
32 
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  assert(i<getNHits());
88  detId=fDetId.at(i);hitId=fHitId.at(i);
89  }
93  void getHit(unsigned int i,
94  unsigned int& detId,
95  unsigned int& hitId,
96  double &rho) const {
97  assert(i<getNHits());
98  detId=fDetId.at(i);hitId=fHitId.at(i);
99  rho=fRho.at(i);
100  }
104  void getHitWithPlane(unsigned int i,
105  unsigned int& detId,
106  unsigned int& hitId,
107  unsigned int& planeId) const {
108  assert(i<getNHits());
109  detId=fDetId.at(i);hitId=fHitId.at(i);
110  planeId=fPlaneId.at(i);
111  }
112 
113  unsigned int getNHits() const {return fDetId.size();}
114  double getCurv() const {return fCurv;}
115  double getDip() const {return fDip;}
116  bool inverted() const {return fInv;}
117  std::vector<unsigned int> GetHitIDs(int detId=-1);
118  std::vector<unsigned int> GetDetIDs() const {return fDetId;}
119  std::vector<double> GetRhos() const {return fRho;}
120  std::set<unsigned int> GetUniqueDetIDs() const {
121  std::set<unsigned int> retVal;
122  for(unsigned int i=0;i<fDetId.size();++i){
123  retVal.insert(fDetId.at(i));
124  }
125  return retVal;
126  }
129  int getMcTrackId() const {return fMcTrackId;}
131  TVector3 getPosSeed() const {return fPosSeed;}
133  TVector3 getDirSeed() const {return fDirSeed;}
135  double getQoverPseed() const {return fQoverpSeed;}
137  TVector3 getPosError() const {return fPosError;}
139  TVector3 getDirError() const {return fDirError;}
141  int getPdgCode() const {return fPdg;}
142  // Modifiers -----------------------
143  void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0);
144  void setCurv(double c){fCurv=c;}
145  void setDip(double d){fDip=d;}
146  void setInverted(bool f=true) {fInv=f;}
152  bool HitInTrack(unsigned int detId, unsigned int hitId);
155  void setTrackSeed(const TVector3& pos,const TVector3& direction,const double qop){
156  fPosSeed=pos;fDirSeed=direction;fQoverpSeed=qop;
157  }
160  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));
163  void setPdgCode(int pdgCode){fPdg=pdgCode;}
164  void append(const GFTrackCand&);
165 
166  // Operations ----------------------
167  void reset();
168  void Print() const ;
169 
170 private:
171 
172  // Private Data Members ------------
173  std::vector<unsigned int> fDetId;
174  std::vector<unsigned int> fHitId;
175  std::vector<unsigned int> fPlaneId;
176  std::vector<double> fRho;
177 
178  double fCurv; // curvature from pattern reco
179  double fDip; // dip angle from pattern reco
180  bool fInv; // true if inverted track
181 
182  TVector3 fPosSeed; //seed value for the track: pos
183  TVector3 fDirSeed; //direction
184  TVector3 fPosError; //error on position seed given as a standard deviation
185  TVector3 fDirError; //error on direction seed given as a standard deviation
186  double fQoverpSeed; //q/p
187  int fMcTrackId; //if MC simulation, store the mct track id here
188  int fPdg; // particle data groupe's id for a particle
189 
190 
191  // Private Methods -----------------
192 
193 public:
194  ClassDef(GFTrackCand,5)
195 };
196 
197 #endif
198 
TVector3 pos
TObjArray * d
Int_t i
Definition: run_full.C:25
double fDip
Definition: GFTrackCand.h:179
bool inverted() const
Definition: GFTrackCand.h:116
double getDip() const
Definition: GFTrackCand.h:115
bool HitInTrack(unsigned int detId, unsigned int hitId)
Test if hit already is part of this track candidate.
Definition: GFTrackCand.cxx:73
TVector3 fPosError
Definition: GFTrackCand.h:184
unsigned int getNHits() const
Definition: GFTrackCand.h:113
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:93
friend bool operator==(const GFTrackCand &lhs, const GFTrackCand &rhs)
Definition: GFTrackCand.cxx:83
Double_t mom
Definition: plot_dirc.C:14
std::set< unsigned int > GetUniqueDetIDs() const
Definition: GFTrackCand.h:120
void setDip(double d)
Definition: GFTrackCand.h:145
std::vector< unsigned int > fHitId
Definition: GFTrackCand.h:174
double getCurv() const
Definition: GFTrackCand.h:114
TVector3 getPosSeed() const
get the seed value for track: pos
Definition: GFTrackCand.h:131
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:104
std::vector< unsigned int > fPlaneId
Definition: GFTrackCand.h:175
TVector3 fPosSeed
Definition: GFTrackCand.h:182
double fCurv
Definition: GFTrackCand.h:178
void setMcTrackId(int i)
set the MCT track id, for MC simulations
Definition: GFTrackCand.h:149
void setTrackSeed(const TVector3 &pos, const TVector3 &direction, const double qop)
set the seed values for track: pos, direction, q/p
Definition: GFTrackCand.h:155
TVector3 getDirSeed() const
get the seed value for track: direction
Definition: GFTrackCand.h:133
std::vector< double > GetRhos() const
Definition: GFTrackCand.h:119
std::vector< unsigned int > GetHitIDs(int detId=-1)
Definition: GFTrackCand.cxx:53
void reset()
Definition: GFTrackCand.cxx:68
double getQoverPseed() const
get the seed value for track: qoverp
Definition: GFTrackCand.h:135
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
void append(const GFTrackCand &)
TVector3 getDirError() const
get the seed value for track: error on direction (standard deviation)
Definition: GFTrackCand.h:139
TFile * f
Definition: bump_analys.C:12
void setInverted(bool f=true)
Definition: GFTrackCand.h:146
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
int getMcTrackId() const
get the MCT track id, for MC simulations - def. value -1
Definition: GFTrackCand.h:129
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))
set the seed values for track: pos, momentum, pdgCode, pos error, momentum error (errors are optional...
std::vector< double > fRho
Definition: GFTrackCand.h:176
TVector3 getPosError() const
get the seed value for track: error on pos (standard deviation)
Definition: GFTrackCand.h:137
int getPdgCode() const
get the PDG code
Definition: GFTrackCand.h:141
void setCurv(double c)
Definition: GFTrackCand.h:144
double fQoverpSeed
Definition: GFTrackCand.h:186
TVector3 fDirSeed
Definition: GFTrackCand.h:183
std::vector< unsigned int > fDetId
Definition: GFTrackCand.h:173
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
Definition: GFTrackCand.cxx:44
void setPdgCode(int pdgCode)
set a particle hypothesis in form of a PDG code
Definition: GFTrackCand.h:163
void Print() const
Definition: GFTrackCand.cxx:90
std::vector< unsigned int > GetDetIDs() const
Definition: GFTrackCand.h:118
TVector3 fDirError
Definition: GFTrackCand.h:185