PandaRoot
GFTrackCand.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /* Copyright 2008-2010, Technische Universitaet Muenchen,
14  Authors: Christian Hoeppner & Sebastian Neubert
15 
16  This file is part of GENFIT.
17 
18  GENFIT is free software: you can redistribute it and/or modify
19  it under the terms of the GNU Lesser General Public License as published
20  by the Free Software Foundation, either version 3 of the License, or
21  (at your option) any later version.
22 
23  GENFIT is distributed in the hope that it will be useful,
24  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  GNU Lesser General Public License for more details.
27 
28  You should have received a copy of the GNU Lesser General Public License
29  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
30 */
34 #ifndef GFTRACKCAND_H
35 #define GFTRACKCAND_H
36 
37 #include <vector>
38 #include <set>
39 #include <iostream>
40 #include "assert.h"
41 
42 #include "TObject.h"
43 #include "TVector3.h"
44 
67 class GFTrackCand : public TObject {
68  public:
69  // Constructors/Destructors ---------
70  GFTrackCand();
71  ~GFTrackCand();
72 
85  GFTrackCand(double curv, double dip, double inv, std::vector<unsigned int> detIDs, std::vector<unsigned int> hitIDs);
86  /* @brief same as previous ctor, but with ordering parameters */
87  GFTrackCand(double curv, double dip, double inv, std::vector<unsigned int> detIDs, std::vector<unsigned int> hitIDs, std::vector<double> rhos);
88 
89  /* @brief == operator does not check for rho */
90  friend bool operator==(const GFTrackCand &lhs, const GFTrackCand &rhs);
91 
92  // Accessors -----------------------
95  void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
96  {
97  assert(i < getNHits());
98  detId = fDetId.at(i);
99  hitId = fHitId.at(i);
100  }
104  void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId, double &rho) const
105  {
106  assert(i < getNHits());
107  detId = fDetId.at(i);
108  hitId = fHitId.at(i);
109  rho = fRho.at(i);
110  }
114  void getHitWithPlane(unsigned int i, unsigned int &detId, unsigned int &hitId, unsigned int &planeId) const
115  {
116  assert(i < getNHits());
117  detId = fDetId.at(i);
118  hitId = fHitId.at(i);
119  planeId = fPlaneId.at(i);
120  }
121 
122  unsigned int getNHits() const { return fDetId.size(); }
123  double getCurv() const { return fCurv; }
124  double getDip() const { return fDip; }
125  bool inverted() const { return fInv; }
126  std::vector<unsigned int> GetHitIDs(int detId = -1);
127  std::vector<unsigned int> GetDetIDs() const { return fDetId; }
128  std::vector<double> GetRhos() const { return fRho; }
129  std::set<unsigned int> GetUniqueDetIDs() const
130  {
131  std::set<unsigned int> retVal;
132  for (unsigned int i = 0; i < fDetId.size(); ++i) {
133  retVal.insert(fDetId.at(i));
134  }
135  return retVal;
136  }
139  int getMcTrackId() const { return fMcTrackId; }
141  TVector3 getPosSeed() const { return fPosSeed; }
143  TVector3 getDirSeed() const { return fDirSeed; }
145  double getQoverPseed() const { return fQoverpSeed; }
147  TVector3 getPosError() const { return fPosError; }
149  TVector3 getDirError() const { return fDirError; }
151  int getPdgCode() const { return fPdg; }
152  // Modifiers -----------------------
153  void addHit(unsigned int detId, unsigned int hitId, double rho = 0., unsigned int planeId = 0);
154  void setCurv(double c) { fCurv = c; }
155  void setDip(double d) { fDip = d; }
156  void setInverted(bool f = true) { fInv = f; }
159  void setMcTrackId(int i) { fMcTrackId = i; }
162  bool HitInTrack(unsigned int detId, unsigned int hitId);
165  void setTrackSeed(const TVector3 &pos, const TVector3 &direction, const double qop)
166  {
167  fPosSeed = pos;
168  fDirSeed = direction;
169  fQoverpSeed = qop;
170  }
173  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));
176  void setPdgCode(int pdgCode) { fPdg = pdgCode; }
177  void append(const GFTrackCand &);
178 
179  // Operations ----------------------
180  void reset();
181  void Print() const;
182 
183  private:
184  // Private Data Members ------------
185  std::vector<unsigned int> fDetId;
186  std::vector<unsigned int> fHitId;
187  std::vector<unsigned int> fPlaneId;
188  std::vector<double> fRho;
189 
190  double fCurv; // curvature from pattern reco
191  double fDip; // dip angle from pattern reco
192  bool fInv; // true if inverted track
193 
194  TVector3 fPosSeed; // seed value for the track: pos
195  TVector3 fDirSeed; // direction
196  TVector3 fPosError; // error on position seed given as a standard deviation
197  TVector3 fDirError; // error on direction seed given as a standard deviation
198  double fQoverpSeed; // q/p
199  int fMcTrackId; // if MC simulation, store the mct track id here
200  int fPdg; // particle data groupe's id for a particle
201 
202  // Private Methods -----------------
203 
204  public:
205  ClassDef(GFTrackCand, 5)
206 };
207 
208 #endif
209 
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:104
bool inverted() const
Definition: GFTrackCand.h:125
std::vector< unsigned int > GetHitIDs(int detId=-1)
int getPdgCode() const
get the PDG code
Definition: GFTrackCand.h:151
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:95
int getMcTrackId() const
get the MCT track id, for MC simulations - def. value -1
Definition: GFTrackCand.h:139
void setDip(double d)
Definition: GFTrackCand.h:155
unsigned int i
Definition: P4_F32vec4.h:33
TVector3 getDirError() const
get the seed value for track: error on direction (standard deviation)
Definition: GFTrackCand.h:149
void setMcTrackId(int i)
set the MCT track id, for MC simulations
Definition: GFTrackCand.h:159
std::set< unsigned int > GetUniqueDetIDs() const
Definition: GFTrackCand.h:129
void setTrackSeed(const TVector3 &pos, const TVector3 &direction, const double qop)
set the seed values for track: pos, direction, q/p
Definition: GFTrackCand.h:165
double getCurv() const
Definition: GFTrackCand.h:123
void reset()
unsigned int getNHits() const
Definition: GFTrackCand.h:122
TVector3 getDirSeed() const
get the seed value for track: direction
Definition: GFTrackCand.h:143
std::vector< double > GetRhos() const
Definition: GFTrackCand.h:128
void append(const GFTrackCand &)
void setInverted(bool f=true)
Definition: GFTrackCand.h:156
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:67
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:114
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:154
TVector3 getPosError() const
get the seed value for track: error on pos (standard deviation)
Definition: GFTrackCand.h:147
TVector3 getPosSeed() const
get the seed value for track: pos
Definition: GFTrackCand.h:141
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
std::vector< unsigned int > GetDetIDs() const
Definition: GFTrackCand.h:127
float f
Definition: P4_F32vec4.h:32
double getDip() const
Definition: GFTrackCand.h:124
void setPdgCode(int pdgCode)
set a particle hypothesis in form of a PDG code
Definition: GFTrackCand.h:176
double getQoverPseed() const
get the seed value for track: qoverp
Definition: GFTrackCand.h:145