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  // Constructors/Destructors ---------
58  GFTrackCand();
59  ~GFTrackCand();
60 
73  GFTrackCand(double curv, double dip, double inv, std::vector<unsigned int> detIDs, std::vector<unsigned int> hitIDs);
74  /* @brief same as previous ctor, but with ordering parameters */
75  GFTrackCand(double curv, double dip, double inv, std::vector<unsigned int> detIDs, std::vector<unsigned int> hitIDs, std::vector<double> rhos);
76 
77  /* @brief == operator does not check for rho */
78  friend bool operator==(const GFTrackCand &lhs, const GFTrackCand &rhs);
79 
80  // Accessors -----------------------
83  void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
84  {
85  assert(i < getNHits());
86  detId = fDetId.at(i);
87  hitId = fHitId.at(i);
88  }
92  void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId, double &rho) const
93  {
94  assert(i < getNHits());
95  detId = fDetId.at(i);
96  hitId = fHitId.at(i);
97  rho = fRho.at(i);
98  }
102  void getHitWithPlane(unsigned int i, unsigned int &detId, unsigned int &hitId, unsigned int &planeId) const
103  {
104  assert(i < getNHits());
105  detId = fDetId.at(i);
106  hitId = fHitId.at(i);
107  planeId = fPlaneId.at(i);
108  }
109 
110  unsigned int getNHits() const { return fDetId.size(); }
111  double getCurv() const { return fCurv; }
112  double getDip() const { return fDip; }
113  bool inverted() const { return fInv; }
114  std::vector<unsigned int> GetHitIDs(int detId = -1);
115  std::vector<unsigned int> GetDetIDs() const { return fDetId; }
116  std::vector<double> GetRhos() const { return fRho; }
117  std::set<unsigned int> GetUniqueDetIDs() const
118  {
119  std::set<unsigned int> retVal;
120  for (unsigned int i = 0; i < fDetId.size(); ++i) {
121  retVal.insert(fDetId.at(i));
122  }
123  return retVal;
124  }
127  int getMcTrackId() const { return fMcTrackId; }
129  TVector3 getPosSeed() const { return fPosSeed; }
131  TVector3 getDirSeed() const { return fDirSeed; }
133  double getQoverPseed() const { return fQoverpSeed; }
135  TVector3 getPosError() const { return fPosError; }
137  TVector3 getDirError() const { return fDirError; }
139  int getPdgCode() const { return fPdg; }
140  // Modifiers -----------------------
141  void addHit(unsigned int detId, unsigned int hitId, double rho = 0., unsigned int planeId = 0);
142  void setCurv(double c) { fCurv = c; }
143  void setDip(double d) { fDip = d; }
144  void setInverted(bool f = true) { fInv = f; }
147  void setMcTrackId(int i) { fMcTrackId = i; }
150  bool HitInTrack(unsigned int detId, unsigned int hitId);
153  void setTrackSeed(const TVector3 &pos, const TVector3 &direction, const double qop)
154  {
155  fPosSeed = pos;
156  fDirSeed = direction;
157  fQoverpSeed = qop;
158  }
161  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));
164  void setPdgCode(int pdgCode) { fPdg = pdgCode; }
165  void append(const GFTrackCand &);
166 
167  // Operations ----------------------
168  void reset();
169  void Print() const;
170 
171  private:
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  // Private Methods -----------------
191 
192  public:
193  ClassDef(GFTrackCand, 5)
194 };
195 
196 #endif
197 
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:92
bool inverted() const
Definition: GFTrackCand.h:113
std::vector< unsigned int > GetHitIDs(int detId=-1)
int getPdgCode() const
get the PDG code
Definition: GFTrackCand.h:139
bool HitInTrack(unsigned int detId, unsigned int hitId)
Test if hit already is part of this track candidate.
friend bool operator==(const GFTrackCand &lhs, const GFTrackCand &rhs)
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:83
int getMcTrackId() const
get the MCT track id, for MC simulations - def. value -1
Definition: GFTrackCand.h:127
void setDip(double d)
Definition: GFTrackCand.h:143
unsigned int i
Definition: P4_F32vec4.h:21
TVector3 getDirError() const
get the seed value for track: error on direction (standard deviation)
Definition: GFTrackCand.h:137
void setMcTrackId(int i)
set the MCT track id, for MC simulations
Definition: GFTrackCand.h:147
std::set< unsigned int > GetUniqueDetIDs() const
Definition: GFTrackCand.h:117
void setTrackSeed(const TVector3 &pos, const TVector3 &direction, const double qop)
set the seed values for track: pos, direction, q/p
Definition: GFTrackCand.h:153
double getCurv() const
Definition: GFTrackCand.h:111
void reset()
unsigned int getNHits() const
Definition: GFTrackCand.h:110
TVector3 getDirSeed() const
get the seed value for track: direction
Definition: GFTrackCand.h:131
std::vector< double > GetRhos() const
Definition: GFTrackCand.h:116
void append(const GFTrackCand &)
void setInverted(bool f=true)
Definition: GFTrackCand.h:144
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
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:102
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...
void Print() const
void setCurv(double c)
Definition: GFTrackCand.h:142
TVector3 getPosError() const
get the seed value for track: error on pos (standard deviation)
Definition: GFTrackCand.h:135
TVector3 getPosSeed() const
get the seed value for track: pos
Definition: GFTrackCand.h:129
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
std::vector< unsigned int > GetDetIDs() const
Definition: GFTrackCand.h:115
float f
Definition: P4_F32vec4.h:20
double getDip() const
Definition: GFTrackCand.h:112
void setPdgCode(int pdgCode)
set a particle hypothesis in form of a PDG code
Definition: GFTrackCand.h:164
double getQoverPseed() const
get the seed value for track: qoverp
Definition: GFTrackCand.h:133