KaliVeda
Toolkit for HIC analysis
KVGeoDetectorNode.h
1 
4 #ifndef __KVDETECTORNODE_H
5 #define __KVDETECTORNODE_H
6 
7 #include "KVBase.h"
8 #include "KVUniqueNameList.h"
9 
10 class KVDetector;
11 class KVGeoDNTrajectory;
12 
50 class KVGeoDetectorNode : public KVBase {
51  KVDetector* fDetector;
57  Int_t fNTraj = -1; //number of trajectories passing through this node
58  Int_t fNTrajForwards = -1; //number of trajectories going forwards from this node
59  Int_t fNTrajBackwards = -1; //number of trajectories going backwards from this node
60 
63 
64 public:
66  {
67  fTraj.SetCleanup();
68  }
69  KVGeoDetectorNode(const Char_t* name) : KVBase(name, "/FULL/PATH/TO/NODE")
70  {
71  fTraj.SetCleanup();
72  }
73 
74  void SetDetector(KVDetector*);
75  KVDetector* GetDetector() const;
76  const Char_t* GetName() const override;
77 
78  void AddInFront(KVDetector*);
79  void AddBehind(KVDetector*);
80  Bool_t IsInFrontOf(KVDetector*);
81  Bool_t IsBehind(KVDetector*);
83  {
84  return &fInFront;
85  }
87  {
88  return &fBehind;
89  }
91  {
92  return &fTraj;
93  }
95  {
98 
99  if (fNTrajForwards < 0) const_cast<KVGeoDetectorNode*>(this)->CalculateForwardsTrajectories();
100  return (fNTrajForwards ? &fTrajF : nullptr);
101  }
103  {
106 
108  return (fNTrajBackwards ? &fTrajB : nullptr);
109  }
111  {
113  return fInFront.GetEntries();
114  }
116  {
118  return fBehind.GetEntries();
119  }
120  Int_t GetNTraj() const
121  {
123  if (fNTraj < 0) {
124  const_cast<KVGeoDetectorNode*>(this)->fNTraj = fTraj.GetEntries();
125  }
126  return fNTraj;
127  }
129  {
134 
135  if (fNTrajForwards < 0) const_cast<KVGeoDetectorNode*>(this)->CalculateForwardsTrajectories();
136  return fNTrajForwards;
137  }
139  {
144 
146  return fNTrajBackwards;
147  }
148 
151 
152  void RehashLists();
153 
154  KVGeoDNTrajectory* FindTrajectory(const char* title) const;
155  KVGeoDNTrajectory* FindTrajectory(UInt_t number) const;
156 
157  const Char_t* GetFullPathToNode() const
158  {
161  return GetTitle();
162  }
163 
164  void ls(Option_t* option = "") const override;
165 
166  ClassDefOverride(KVGeoDetectorNode, 2) //Information on relative positions of detectors & particle trajectories
167 };
168 
169 #endif
int Int_t
unsigned int UInt_t
bool Bool_t
char Char_t
const char Option_t
#define ClassDefOverride(name, id)
char name[80]
Base class for KaliVeda framework.
Definition: KVBase.h:139
Path taken by particles through multidetector geometry.
Information on relative positions of detectors & particle trajectories.
Bool_t IsInFrontOf(KVDetector *)
return true if this node is directly in front of the detector
KVGeoDetectorNode(const Char_t *name)
void CalculateForwardsTrajectories()
Fill list with all trajectories going forwards from this node.
void BuildTrajectoriesForwards(TSeqCollection *)
void AddTrajectory(KVGeoDNTrajectory *)
void AddInFront(KVDetector *)
const KVSeqCollection * GetBackwardTrajectories() const
const Char_t * GetFullPathToNode() const
KVGeoDNTrajectory * FindTrajectory(const char *title) const
const KVSeqCollection * GetTrajectories() const
KVDetector * fDetector
associated detector
KVUniqueNameList fTrajF
list of trajectories passing through this node going forwards
const KVSeqCollection * GetDetectorsBehind() const
KVDetector * GetDetector() const
const KVSeqCollection * GetForwardTrajectories() const
Int_t GetNTrajBackwards() const
Int_t GetNTraj() const
const Char_t * GetName() const override
Name of node is same as name of associated detector.
Int_t GetNDetsBehind() const
void ls(Option_t *option="") const override
KVUniqueNameList fInFront
list of detectors in front
KVUniqueNameList fTraj
list of trajectories passing through this node
Int_t GetNDetsInFront() const
KVUniqueNameList fTrajB
list of trajectories passing through this node going backwards
Int_t GetNTrajForwards() const
void SetDetector(KVDetector *)
void AddBehind(KVDetector *)
Bool_t IsBehind(KVDetector *)
return true if this node is directly behind the detector
void CalculateBackwardsTrajectories()
Fill list with all trajectories going backwards from this node.
KVUniqueNameList fBehind
list of detectors behind
const KVSeqCollection * GetDetectorsInFront() const
KaliVeda extensions to ROOT collection classes.
virtual void SetCleanup(Bool_t enable=kTRUE)
Optimised list in which named objects can only be placed once.
virtual Int_t GetEntries() const
const char * GetTitle() const override