KaliVeda
Toolkit for HIC analysis
KVGeoNavigator.h
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 TGeoManager;
15 class TGeoVolume;
16 class TGeoNode;
17 class TEnv;
18 
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:
75  class KVGeoDetectorPath : public TNamed {
77  public:
78  KVGeoDetectorPath() : TNamed(), fDetector(nullptr) {}
79  KVGeoDetectorPath(const Char_t* path, KVDetector* det) :
80  TNamed(path, ""), fDetector(det) {}
81  virtual ~KVGeoDetectorPath() {}
83  {
84  return fDetector;
85  }
86  ClassDef(KVGeoDetectorPath, 1) //Link physical path to node in geometry with detector
87  };
88 protected:
91  {
95  return (KVDetector*)(gdp ? gdp->GetDetector() : nullptr);
96  }
97 
98 public:
100  virtual ~KVGeoNavigator();
101 
102  void ResetTrackID(Int_t id = 0)
103  {
104  fTrackID = id;
105  }
107  {
108  return fTrackID;
109  }
111  {
112  ++fTrackID;
113  }
114  void SetTracking(Bool_t on = kTRUE)
115  {
116  fTracking = on;
117  }
119  {
120  return fTracking;
121  }
122 
123  void SetStructureNameFormat(const Char_t* type, const Char_t* fmt);
124  void SetDetectorNameFormat(const Char_t* fmt)
125  {
145  fDetNameFmt = fmt;
146  }
148  {
149  return fDetNameFmt.Data();
150  }
151  void SetNameCorrespondanceList(const Char_t*);
152  void SetNameCorrespondanceList(const TEnv*);
154 
155  void PropagateEvent(KVEvent*, TVector3* TheOrigin = 0);
156  virtual void PropagateParticle(KVNucleus*, TVector3* TheOrigin = 0);
157  virtual void ParticleEntersNewVolume(KVNucleus*);
158 
160  {
161  return fGeometry;
162  }
164  {
165  return fCurrentVolume;
166  }
168  {
169  return fCurrentNode;
170  }
171  const TGeoHMatrix* GetCurrentMatrix() const;
173  {
174  return fStepSize;
175  }
176  const TVector3& GetEntryPoint() const
177  {
178  return fEntryPoint;
179  }
180  const TVector3& GetExitPoint() const
181  {
182  return fExitPoint;
183  }
187  {
188  return fCurrentPath;
189  }
190 
192  {
193  return fStopPropagation;
194  }
195  void SetStopPropagation(Bool_t stop = kTRUE)
196  {
197  fStopPropagation = stop;
198  }
199 
202  {
203  return fCurrentStructures;
204  }
206  void DrawTracks(KVNumberList* = nullptr);
207 
209  {
213 
216  }
218  {
219  TIter it(&fDetectorPaths);
220  KVGeoDetectorPath* gdp;
221  while ((gdp = (KVGeoDetectorPath*)it())) {
222  std::cout << gdp->GetDetector()->GetName() << " : " << gdp->GetName() << std::endl;
223  }
224  }
225 
226  ClassDef(KVGeoNavigator, 0) //Propagate particles of an event through a TGeo geometry
227 };
228 
229 #endif
int Int_t
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
double Double_t
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Base class for KaliVeda framework.
Definition: KVBase.h:142
Base class for detector geometry description.
Definition: KVDetector.h:160
Abstract base class container for multi-particle events.
Definition: KVEvent.h:67
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:126
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
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:73
Optimised list in which named objects can only be placed once.
virtual void AddAll(const TCollection *col)
const char * GetName() const override
const char * Data() const