KaliVeda
Toolkit for HIC analysis
KVGeoNodeIterator.h
1 
4 #ifndef __KVGEONODEITERATOR_H
5 #define __KVGEONODEITERATOR_H
6 
7 #include "KVBase.h"
8 #include "KVGeoDetectorNode.h"
9 #include "KVGeoDNTrajectory.h"
10 
37 class KVGeoNodeIterator : public KVBase {
45 
47  {
48  if (iter_on_traj) {
50  else current_trajectory = nullptr;
51  }
52  else
54  if (current_trajectory) {
57  }
58  }
60  {
62  else current_node = nullptr;
63  }
64 
65 
66 public:
67  KVGeoNodeIterator(KVGeoDetectorNode* start, KVGeoDNTrajectory* trajectory = nullptr) :
68  start_node(start), current_node(start), iter_on_traj(trajectory), next_trajectory(new TIter(start->GetTrajectories())),
70  {
74 
76  }
77 
79  {
80  delete next_trajectory;
81  }
82 
83  void ExcludeStartNode(Bool_t u = kTRUE)
84  {
87  }
88  void IterateBackwards(Bool_t i = kTRUE)
89  {
92  }
93 
95  {
97 
99  if (current_node == nullptr) {
102  }
103  if (exclude_start_node && current_node == start_node) return this->operator()();
104  return current_node;
105  }
106 
107  void Reset(KVGeoDetectorNode* start = nullptr, KVGeoDNTrajectory* trajectory = nullptr);
108  void ResetTrajectory(KVGeoDNTrajectory* trajectory = nullptr);
109 
110  ClassDef(KVGeoNodeIterator, 0) //Iterator over geometry nodes/trajectories
111 };
112 
113 #endif
bool Bool_t
constexpr Bool_t kFALSE
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:142
Path taken by particles through multidetector geometry.
KVGeoDetectorNode * GetNextNode() const
void IterateFrom(const KVGeoDetectorNode *node0=nullptr) const
void IterateBackFrom(const KVGeoDetectorNode *node0=nullptr) const
Information on relative positions of detectors & particle trajectories.
Iterate from node to node along trajectories in array geometry.
KVGeoDNTrajectory * current_trajectory
void IterateBackwards(Bool_t i=kTRUE)
KVGeoDetectorNode * start_node
void ResetTrajectory(KVGeoDNTrajectory *trajectory=nullptr)
KVGeoDetectorNode * current_node
void begin_iteration_on_next_trajectory() const
KVGeoDNTrajectory * iter_on_traj
limit iteration to this trajectory, if given
virtual ~KVGeoNodeIterator()
void ExcludeStartNode(Bool_t u=kTRUE)
void get_next_node_on_current_trajectory() const
KVGeoNodeIterator(KVGeoDetectorNode *start, KVGeoDNTrajectory *trajectory=nullptr)
KVGeoDetectorNode * operator()(void) const
void Reset(KVGeoDetectorNode *start=nullptr, KVGeoDNTrajectory *trajectory=nullptr)
start