KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVReconNucTrajectory.cpp
Go to the documentation of this file.
1 #include "KVReconNucTrajectory.h"
2 #include "KVIDTelescope.h"
3 
5 
6 
7 
11  KVGeoDNTrajectory(), fIndependentIdentifications(0)
12 {
13  // Copy constructor
14  o.Copy(*this);
15 }
16 
17 
18 
21 
23  KVGeoDNTrajectory(), fIndependentIdentifications(0)
24 {
25  // Build a reconstructed trajectory on tr starting from node n
26 
28  KVUniqueNameList* idtlist = dynamic_cast<KVUniqueNameList*>(AccessIDTelescopeList());
29 
30  tr->SaveIterationState();// in case an iteration was already underway
31  // add all nodes starting at n
32  tr->IterateFrom(n);
34  while ((_n = tr->GetNextNode())) {
35  AddLast(_n);
36  fDetLabels[_n->GetDetector()->GetLabel()] = _n->GetDetector();
37  }
38  // add all ID telescopes from parent trajectory which contain only
39  // detectors on this trajectory
40  TIter next(tr->GetIDTelescopes());
41  KVIDTelescope* idt;
42  while ((idt = (KVIDTelescope*)next())) {
43  if (ContainsAll(idt->GetDetectors())) {
44  idtlist->Add(idt);
46  }
47  }
48 
49  // unique name for fast look-up in hash table
50  SetName(Form("%s_%s", tr->GetTrajectoryName(), n->GetName()));
52 }
53 
54 
55 
57 
59 {
60  r.Copy(*this);
61  return (*this);
62 }
63 
64 
65 
73 
75 {
76  // This method copies the current state of 'this' object into 'obj'
77  // You should add here any member variables, for example:
78  // (supposing a member variable KVReconNucTrajectory::fToto)
79  // CastedObj.fToto = fToto;
80  // or
81  // CastedObj.SetToto( GetToto() );
82 
84  KVReconNucTrajectory& CastedObj = (KVReconNucTrajectory&)obj;
86 }
87 
88 
89 
91 
93 {
95  std::cout << "Identifications [" << GetIDTelescopes()->GetEntries() << "/"
96  << fIndependentIdentifications << "] : " << std::endl;
97  TIter next(GetIDTelescopes());
98  KVIDTelescope* idt;
99  while ((idt = (KVIDTelescope*)next())) {
100  std::cout << "\t" << idt->GetName() << " (" << idt->IsIndependent() << ")" << std::endl;
101  }
102 }
103 
104 
105 
121 
123 {
124  // Returns detector with given *label* on this trajectory.
125  //
126  // **N.B.** *label*, not *type*: several detectors of same *type* may occur on
127  // trajectory. The geometry should be defined so that labels are unique on all trajectories.
128  //
129  // For example, given a reconstructed nucleus whose trajectory includes silicon detectors (same type)
130  // with labels "SI1" and "SI2", here is how to access the "SI2" detector through which it passed:
131  //
132  //~~~~~~~{.cpp}
133  //KVReconstructedNucleus* rnuc_p; /* pointer to reconstructed nucleus */
134  //KVDetector* si2_det = rnuc_p->GetReconstructionTrajectory()->GetDetector("SI2");
135  //~~~~~~~
136  //
137  // If no such detector exists, returns nullptr.
138 
139 #ifdef WITH_CPP11
140  auto it
141 #else
142  std::map<std::string, KVDetector*>::const_iterator it
143 #endif
144  = fDetLabels.find(label.Data());
145  return it != fDetLabels.end() ? it->second : nullptr;
146 }
147 
148 
149 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
ROOT::R::TRInterface & r
const Bool_t kFALSE
const char Option_t
char * Form(const char *fmt,...)
const Char_t * GetLabel() const
Definition: KVBase.h:192
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Path taken by particles through multidetector geometry.
void SaveIterationState() const
Bool_t ContainsAll(const TCollection *l) const
Bool_t fAddToNodes
if kTRUE, add trajectory to node's list
const Char_t * GetTrajectoryName() const
KVGeoDetectorNode * GetNextNode() const
KVSeqCollection * AccessIDTelescopeList()
void ls(Option_t *="") const
void AddLast(KVGeoDetectorNode *n)
void IterateFrom(const KVGeoDetectorNode *node0=nullptr) const
const KVSeqCollection * GetIDTelescopes() const
void Copy(TObject &obj) const
Make a copy of this object.
void RestoreIterationState() const
Information on relative positions of detectors & particle trajectories.
KVDetector * GetDetector() const
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:88
const KVList * GetDetectors() const
Bool_t IsIndependent() const
Path through detector array used to reconstruct detected particle.
KVReconNucTrajectory & operator=(const KVReconNucTrajectory &)
void Copy(TObject &obj) const
void ls(Option_t *="") const
KVDetector * GetDetector(const TString &label) const
Int_t fIndependentIdentifications
number of independent ID telescopes on trajectory
std::unordered_map< std::string, KVDetector * > fDetLabels
map detector labels to detectors
Optimised list in which named objects can only be placed once.
Bool_t ObjectAdded() const
virtual void Add(TObject *obj)
virtual Int_t GetEntries() const
virtual const char * GetName() const
virtual void SetName(const char *name)
virtual void Copy(TObject &object) const
const char * Data() const
const Int_t n