KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVGeoDNTrajectory.cpp
1#include "KVGeoDNTrajectory.h"
2#include "KVDetector.h"
3
4#include <TPluginManager.h>
5
7
9
10
13
14KVGeoDNTrajectory::KVGeoDNTrajectory() : fNodes(3, 0), fIDTelescopes(kFALSE), fPathInTitle(kTRUE), fAddToNodes(kTRUE)
15{
16 // Default constructor
17 init();
18}
19
20
23
25 : fNodes(3, 0), fIDTelescopes(kFALSE), fPathInTitle(kTRUE), fAddToNodes(kTRUE)
26{
27 // Create a new trajectory starting from node
28 AddLast(node);
29 init();
30}
31
32
35
37 : KVBase(), fNodes(3, 0), fIDTelescopes(kFALSE), fPathInTitle(kTRUE), fAddToNodes(kTRUE)
38{
39 //copy ctor
40 obj.Copy(*this);
41 init();
42}
43
44
45
48
50{
51 // Destructor
52}
53
54
55
58
60{
61 // Instantiate & return object of class corresponding to plugin
62
63 TPluginHandler* ph = LoadPlugin("KVGeoDNTrajectory", plugin);
64 if (ph) {
65
66 return (KVGeoDNTrajectory*)ph->ExecPlugin(2, t, n);
67 }
68 return (KVGeoDNTrajectory*)nullptr;
69}
70
71
72
74
76{
79 if (fPathInTitle) SetName(Form("GDNTraj_%d", fGDNTrajNumber));
80 else SetTitle(Form("GDNTraj_%d", fGDNTrajNumber));
82}
83
84
85
91
93{
94 // called every time a new node is added to the trajectory
95 // to update the title with the new node name
96 // Dynamically constructed title: DET1/DET2/DET3/...
97 // if fPathInTitle = kFALSE, we change the name not the title
98
99 TString t;
100 TIter next(&fNodes);
102 while ((n = (KVGeoDetectorNode*)next())) {
103 t += n->GetName();
104 t += "/";
105 }
106 if (fPathInTitle) SetTitle(t);
107 else SetName(t);
108}
109
110
111
114
115void KVGeoDNTrajectory::increment_identified_particle_counters(int identified, int unidentified) const
116{
117 // increment counters in all detectors on trajectory
118 IterateFrom();
119 KVGeoDetectorNode* node;
120 while ((node = GetNextNode())) {
121 node->GetDetector()->IncrementIdentifiedParticles(identified);
122 node->GetDetector()->IncrementUnidentifiedParticles(unidentified);
123 }
124}
125
126
127
129
131{
132 KVBase::Copy(obj);
133 KVGeoDNTrajectory& CastedObj = (KVGeoDNTrajectory&)obj;
134 TIter next(&fNodes);
135 KVGeoDetectorNode* node;
136 CastedObj.fAddToNodes = fAddToNodes;
137 while ((node = (KVGeoDetectorNode*)next())) CastedObj.AddLast(node);
139 CastedObj.fPathInTitle = fPathInTitle;
140}
141
142
143
145
147{
148 if (&t != this) t.Copy(*this);
149 return (*this);
150}
151
152
153
156
158{
159 // Clear list of nodes in trajectory
160
161 fNodes.Clear();
163 if (fPathInTitle) SetTitle("");
164 else SetName("");
165}
166
167
168
171
173{
174 // Reverse the order of the nodes in the trajectory
175
176 int idx = fNodes.GetEntries();
177 TObjArray tmp(idx);
178 int N = idx;
179 TIter it(&fNodes);
180 KVGeoDetectorNode* node;
181 while ((node = (KVGeoDetectorNode*)it())) tmp.AddAt(node, --idx);
182 fNodes.Clear();
183 for (idx = 0; idx < N; ++idx) fNodes.AddAt(tmp[idx], idx);
185}
186
187
188
191
193{
194 // Add reference to this trajectory to all nodes on it
195
196 IterateFrom();
197 KVGeoDetectorNode* node;
198 while ((node = GetNextNode())) node->AddTrajectory(this);
199}
200
201
202
203
int Int_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
const char Option_t
#define N
char * Form(const char *fmt,...)
Base class for KaliVeda framework.
Definition KVBase.h:142
virtual void SetNumber(UInt_t num)
Definition KVBase.h:216
virtual void Copy(TObject &) const
Make a copy of this object.
Definition KVBase.cpp:394
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition KVBase.cpp:793
void IncrementIdentifiedParticles(Int_t n=1)
Definition KVDetector.h:565
void IncrementUnidentifiedParticles(Int_t n=1)
Definition KVDetector.h:559
Path taken by particles through multidetector geometry.
Bool_t fAddToNodes
if kTRUE, add trajectory to node's list
KVGeoDNTrajectory()
Default constructor.
static Int_t fGDNTrajNumber
void increment_identified_particle_counters(int identified, int unidentified) const
increment counters in all detectors on trajectory
static KVGeoDNTrajectory * Factory(const char *plugin, const KVGeoDNTrajectory *, const KVGeoDetectorNode *)
Instantiate & return object of class corresponding to plugin.
void ReverseOrder()
Reverse the order of the nodes in the trajectory.
void AddLast(KVGeoDetectorNode *n)
void AddToNodes()
Add reference to this trajectory to all nodes on it.
void IterateFrom(const KVGeoDetectorNode *node0=nullptr) const
void Clear(Option_t *="")
Clear list of nodes in trajectory.
KVUniqueNameList fIDTelescopes
list of id telescopes on this trajectory
Int_t fIter_idx_sav
index for iteration
Int_t fIter_idx
index for iteration
TObjArray fNodes
list of nodes on trajectory
virtual ~KVGeoDNTrajectory()
Destructor.
void Copy(TObject &obj) const
Bool_t fPathInTitle
true if path is in title, false if path is in name
KVGeoDNTrajectory & operator=(const KVGeoDNTrajectory &)
KVGeoDetectorNode * GetNextNode() const
Information on relative positions of detectors & particle trajectories.
void AddTrajectory(KVGeoDNTrajectory *)
KVDetector * GetDetector() const
virtual void Copy(TObject &obj) const
virtual void SetTitle(const char *title="")
virtual void SetName(const char *name)
void AddAt(TObject *obj, Int_t idx) override
void Clear(Option_t *option="") override
Int_t GetEntries() const override
Longptr_t ExecPlugin(int nargs)
const Int_t n
ClassImp(TPyArg)