KaliVeda
Toolkit for HIC analysis
KVGeoNodeIterator.cpp
1 //Created by KVClassFactory on Mon Oct 5 17:32:21 2015
2 //Author: John Frankland,,,
3 
4 #include "KVGeoNodeIterator.h"
5 
6 
8 
9 
10 
11 
24 void KVGeoNodeIterator::Reset(KVGeoDetectorNode* start, KVGeoDNTrajectory* trajectory)
25 {
26  // Reset the iterator in order to perform a new iteration:
27  //
28  // it.Reset(); => iterate from same node on same trajectory(ies)
29  // i.e. if you originally specified a trajectory to iterate over,
30  // it will be used again.
31  // If you want to iterate from the same node but now
32  // lifting the restriction on the trajectory, call it.ResetTrajectory()
33  //
34  // it.Reset(start); => iterate from a new node, using all trajectories
35  //
36  // it.Reset(start,trajectory) => iterate from a new node using given trajectory
37 
38  if (start == nullptr) {
39  current_node = start_node;
40  next_trajectory->Reset();
41  }
42  else {
43  current_node = start_node = start;
44  iter_on_traj = trajectory;
45  delete next_trajectory;
46  next_trajectory = new TIter(start->GetTrajectories());
47  }
48  current_trajectory = nullptr;
49  begin_iteration_on_next_trajectory();
50 }
51 
52 
53 
71 
73 {
74  // Reset the iterator in order to perform a new iteration starting
75  // from the same node but either with a different trajectory, or lifting
76  // the restriction on the trajectory originally given to the constructor:
77  //
78  // KVGeoNodeIterator it(start,trajectory);
79  // while( (KVGeoDetectorNode* n = it()) ){
80  // /* iterate only over 'trajectory' */
81  // }
82  // it.ResetTrajectory();
83  // while( (KVGeoDetectorNode* n = it()) ){
84  // /* iterate over all trajectories */
85  // }
86  // it.ResetTrajectory(trajectory2);
87  // while( (KVGeoDetectorNode* n = it()) ){
88  // /* iterate only over 'trajectory2' */
89  // }
90 
92  iter_on_traj = trajectory;
94  current_trajectory = nullptr;
96 }
97 
98 
Path taken by particles through multidetector geometry.
Information on relative positions of detectors & particle trajectories.
Iterate from node to node along trajectories in array geometry.
KVGeoDNTrajectory * current_trajectory
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
void Reset(KVGeoDetectorNode *start=nullptr, KVGeoDNTrajectory *trajectory=nullptr)
void Reset()
start
ClassImp(TPyArg)