KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVGeoNavigator.h
Go to the documentation of this file.
1 
4 #ifndef __KVGEONAVIGATOR_H
5 #define __KVGEONAVIGATOR_H
6 
7 #include "KVBase.h"
8 #include "TVector3.h"
9 #include "TClonesArray.h"
10 #include "KVDetector.h"
11 #include <KVNameValueList.h>
12 #include <TGeoMatrix.h>
13 class KVNucleus;
14 class KVEvent;
15 class TGeoManager;
16 class TGeoVolume;
17 class TGeoNode;
18 class TEnv;
19 
46 class KVGeoNavigator : public KVBase {
47 private:
63 protected:
67  void FormatStructureName(const Char_t* type, Int_t number, KVString& name);
68  void FormatDetectorName(const Char_t* basename, KVString& name);
69 
70 public:
74  class KVGeoDetectorPath : public TNamed {
76  public:
77  KVGeoDetectorPath() : TNamed(), fDetector(nullptr) {}
78  KVGeoDetectorPath(const Char_t* path, KVDetector* det) :
79  TNamed(path, ""), fDetector(det) {}
80  virtual ~KVGeoDetectorPath() {}
82  {
83  return fDetector;
84  }
85  ClassDef(KVGeoDetectorPath, 1) //Link physical path to node in geometry with detector
86  };
87 protected:
90  {
94  return (KVDetector*)(gdp ? gdp->GetDetector() : nullptr);
95  }
96 
97 public:
99  virtual ~KVGeoNavigator();
100 
101  void ResetTrackID(Int_t id = 0)
102  {
103  fTrackID = id;
104  }
106  {
107  return fTrackID;
108  }
110  {
111  ++fTrackID;
112  }
113  void SetTracking(Bool_t on = kTRUE)
114  {
115  fTracking = on;
116  }
118  {
119  return fTracking;
120  }
121 
122  void SetStructureNameFormat(const Char_t* type, const Char_t* fmt);
123  void SetDetectorNameFormat(const Char_t* fmt)
124  {
144  fDetNameFmt = fmt;
145  }
147  {
148  return fDetNameFmt.Data();
149  }
150  void SetNameCorrespondanceList(const Char_t*);
151  void SetNameCorrespondanceList(const TEnv*);
153 
154  void PropagateEvent(KVEvent*, TVector3* TheOrigin = 0);
155  virtual void PropagateParticle(KVNucleus*, TVector3* TheOrigin = 0);
156  virtual void ParticleEntersNewVolume(KVNucleus*);
157 
159  {
160  return fGeometry;
161  }
163  {
164  return fCurrentVolume;
165  }
167  {
168  return fCurrentNode;
169  }
170  const TGeoHMatrix* GetCurrentMatrix() const;
172  {
173  return fStepSize;
174  }
175  const TVector3& GetEntryPoint() const
176  {
177  return fEntryPoint;
178  }
179  const TVector3& GetExitPoint() const
180  {
181  return fExitPoint;
182  }
186  {
187  return fCurrentPath;
188  }
189 
191  {
192  return fStopPropagation;
193  }
194  void SetStopPropagation(Bool_t stop = kTRUE)
195  {
196  fStopPropagation = stop;
197  }
198 
201  {
202  return fCurrentStructures;
203  }
205  void DrawTracks(KVNumberList* = nullptr);
206 
208  {
212 
215  }
217  {
218  TIter it(&fDetectorPaths);
219  KVGeoDetectorPath* gdp;
220  while ((gdp = (KVGeoDetectorPath*)it())) {
221  std::cout << gdp->GetDetector()->GetName() << " : " << gdp->GetName() << std::endl;
222  }
223  }
224 
225  ClassDef(KVGeoNavigator, 0) //Propagate particles of an event through a TGeo geometry
226 };
227 
228 #endif
int Int_t
char Char_t
const Bool_t kFALSE
bool Bool_t
double Double_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:135
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Base class container for multi-particle events.
Definition: KVEvent.h:176
Link physical path to node in geometry with detector.
KVDetector * GetDetector() const
KVGeoDetectorPath(const Char_t *path, KVDetector *det)
Base class for propagation of particles through array geometry.
virtual void AddPointToCurrentTrack(Double_t, Double_t, Double_t)
void FormatStructureName(const Char_t *type, Int_t number, KVString &name)
Bool_t IsTracking() const
const Char_t * GetDetectorNameFormat() const
TGeoHMatrix fCurrentMatrix
current global transformation matrix
void SetDetectorNameFormat(const Char_t *fmt)
void PropagateEvent(KVEvent *, TVector3 *TheOrigin=0)
const TGeoHMatrix * GetCurrentMatrix() const
Returns pointer to internal copy of current global transformation matrix.
void AbsorbDetectorPaths(KVGeoNavigator *GN)
TClonesArray fCurrentStructures
list of current structures deduced from path
Int_t GetTrackID() const
TString fCurrentPath
current full path to physical node
void FormatDetectorName(const Char_t *basename, KVString &name)
void IncrementTrackID()
TGeoNode * fCurrentDetectorNode
node for current detector
void ExtractDetectorNameFromPath(KVString &)
KVDetector * GetDetectorFromPath(const Char_t *p)
KVUniqueNameList fDetectorPaths
correspondance between physical node and detector objects
void PrintDetectorPaths()
TGeoNode * GetCurrentNode() const
TGeoNode * fMotherNode
mother node of current node
void SetTracking(Bool_t on=kTRUE)
KVGeoNavigator(TGeoManager *)
Constructor. Call with pointer to geometry.
Double_t GetStepSize() const
KVNameValueList fStrucNameFmt
list of user-defined formats for structure names
const TClonesArray & CurrentStructures() const
void SetNameCorrespondanceList(const Char_t *)
TVector3 fExitPoint
position of particle on exiting volume
TEnv * fDetStrucNameCorrespList
list(s) of correspondance for renaming structures/detectors
void SetStopPropagation(Bool_t stop=kTRUE)
virtual void PropagateParticle(KVNucleus *, TVector3 *TheOrigin=0)
Int_t fTrackID
track counter
Bool_t fTracking
set to true when tracking particles
TGeoNode * GetCurrentDetectorNode() const
virtual void ParticleEntersNewVolume(KVNucleus *)
TString GetCurrentPath() const
TGeoVolume * GetCurrentVolume() const
Bool_t GetNameCorrespondance(const Char_t *, TString &)
Double_t fStepSize
distance to travel in volume
TGeoManager * fGeometry
geometry to navigate
Bool_t StopPropagation() const
TGeoNode * fCurrentNode
current node
virtual ~KVGeoNavigator()
Destructor.
TVector3 fEntryPoint
position of particle on entering volume
KVString fDetNameFmt
user-defined format for detector names
Int_t fCurStrucNumber
number of current parent structures
void ResetTrackID(Int_t id=0)
TGeoVolume * fCurrentVolume
current volume
const TVector3 & GetExitPoint() const
void SetStructureNameFormat(const Char_t *type, const Char_t *fmt)
TGeoVolume * GetCurrentDetectorNameAndVolume(KVString &, Bool_t &)
const TVector3 & GetEntryPoint() const
TGeoManager * GetGeometry() const
void DrawTracks(KVNumberList *=nullptr)
Bool_t fStopPropagation
flag set by user when particle propagation should stop
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:83
virtual void SetOwner(Bool_t enable=kTRUE)
virtual TObject * FindObject(const char *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
Optimised list in which named objects can only be placed once.
virtual void AddAll(const TCollection *col)
virtual const char * GetName() const
const char * Data() const