KaliVeda
Toolkit for HIC analysis
KVReconstructedNucleus.h
1 #ifndef KVRECONSTRUCTEDNUCLEUS_H
2 #define KVRECONSTRUCTEDNUCLEUS_H
3 
4 #include "KVNucleus.h"
5 #include "KVHashList.h"
6 #include "KVList.h"
7 #include "KVDetector.h"
8 #include "KVIDTelescope.h"
9 #include "KVIdentificationResult.h"
10 #include "KVGroup.h"
11 #include "TClonesArray.h"
12 #include "KVReconNucTrajectory.h"
13 
34 
35 protected:
41 
42  enum {
43  kIsIdentified = BIT(18), //flag set when identification of particle is complete
44  kIsCalibrated = BIT(19), //flag set when energy calibration of particle is complete
45  kCoherency = BIT(20), //particle created and/or identified by analysis of energy losses of other particles
46  kZMeasured = BIT(21), //the Z attributed to this nucleus was measured
47  kAMeasured = BIT(22) //the A attributed to this nucleus was measured
48  };
49 
55 
57 
58  void RebuildReconTraj();
59 public:
60  void ReplaceReconTraj(const TString& traj_name);
61 
63  enum {
64  kStatusOK, // = 0 : identification is, in principle at least, possible straight away
65  kStatusOKafterSub, // = 1 : identification is, in principle, possible after identification and subtraction
67  kStatusOKafterShare, // = 2 : the energy loss in the shared detector of the group must be shared
69  kStatusStopFirstStage,//= 3 : the particle has stopped in the first member of an identification
71  kStatusPileupDE, // = 4 : only for filtered simulations: undetectable pile-up in DE detector
72  kStatusPileupGhost // = 5 : only for filtered simulations: undetectable particle
73  };
74 
77  void init();
79  void Print(Option_t* option = "") const override;
80  void Clear(Option_t* option = "") override;
81 
84  {
85  if (i) {
86  fIDTelescope = i;
87  fIDTelName = i->GetName();
88  }
89  else fIDTelName = "";
90  };
91 
92  KVDetector* GetDetector(const TString& label) const
93  {
95  return fReconTraj ? fReconTraj->GetDetector(label) : nullptr;
96  }
97  KVDetector* GetDetector(int i) const
98  {
106 
107  return fReconTraj ? fReconTraj->GetNodeAt(i)->GetDetector() : nullptr;
108  }
109 
110  const Char_t* GetDetectorNames() const
111  {
112  return fDetNames.Data();
113  }
114  const Char_t* GetIDtelNames() const
115  {
116  return fIDTelName.Data();
117  }
118 
120  KVDetector* GetStoppingDetector() const
121  {
123  return GetDetector(0);
124  };
125  Int_t GetNumDet() const
126  {
128  return fReconTraj ? fReconTraj->GetN() : 0;
129  }
130 
131  inline Int_t GetStatus() const
132  {
149  return fAnalStatus;
150  };
151 
152  inline void SetStatus(Int_t a)
153  {
154  fAnalStatus = a;
155  }
156 
157  virtual void GetAnglesFromReconstructionTrajectory(Option_t* opt = "random");
158  KVGroup* GetGroup() const
159  {
161  return (GetStoppingDetector() ? GetStoppingDetector()->GetGroup() : 0);
162  }
163 
164  void Copy(TObject&) const override;
165 
167  {
171 
172  return fReconTraj ? fReconTraj->GetIDTelescopes() : nullptr;
173  }
175  {
176  return fIDTelescope;
177  }
178 
179  virtual void SetIDCode(UShort_t s)
180  {
182  GetParameters()->SetValue("IDCODE", (Int_t)s);
183  }
184  virtual Int_t GetIDCode() const
185  {
188  return GetParameters()->GetIntValue("IDCODE");
189  }
190  virtual void SetECode(UChar_t s)
191  {
193  GetParameters()->SetValue("ECODE", (Int_t)s);
194  }
195  virtual Int_t GetECode() const
196  {
199  return GetParameters()->GetIntValue("ECODE");
200  }
201 
203  {
208  }
210  {
212  }
214  {
219  }
221  {
223  }
225  {
226  return TestBit(kIsIdentified);
227  }
229  {
230  return TestBit(kIsCalibrated);
231  }
232 
233  void SetRealZ(Float_t zz)
234  {
235  fRealZ = zz;
236  }
238  {
239  fRealA = A;
240  }
242  {
243  if (fRealZ > 0) {
246  return fRealZ;
247  }
248  else {
251  return (Float_t) GetZ();
252  }
253  }
255  {
256  if (fRealA > 0)
257  return fRealA;
258  else
259  return (Float_t) GetA();
260  }
261  virtual Float_t GetPID() const
262  {
266  if (IsAMeasured())
267  return (GetRealZ() + 0.1 * (GetRealA() - 2. * GetRealZ()));
268  return GetRealZ();
269  };
271  {
274  };
276  {
278  return fTargetEnergyLoss;
279  };
280 
281  virtual void SetZMeasured(Bool_t yes = kTRUE)
282  {
285  SetBit(kZMeasured, yes);
286  };
287  virtual void SetAMeasured(Bool_t yes = kTRUE)
288  {
291  SetBit(kAMeasured, yes);
292  };
293  virtual Bool_t IsZMeasured() const
294  {
297  return TestBit(kZMeasured);
298  };
299  virtual Bool_t IsAMeasured() const
300  {
303  return TestBit(kAMeasured);
304  };
306  {
328 
329  KVIdentificationResult* id = nullptr;
330  if (i) id = (KVIdentificationResult*)fIDResults.ConstructedAt(i - 1);
331  id->SetNumber(i);
332  return id;
333  }
335  {
340  return fIDResults.GetEntries();
341  }
342 
344  {
352 
354  for (int i = 1; i <= n; i++) {
356  if (!strcmp(id->GetIDType(), idtype)) {
357  return id;
358  }
359  }
360  return nullptr;
361  }
362 
364  {
372 
373  if (!idt) return nullptr;
374  return GetIdentificationResult(idt->GetType());
375  }
377  {
378  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(i);
379  }
381  {
382  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idtype);
383  }
385  {
386  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idt);
387  }
388 
390  {
396  UInt_t n = 0;
397  if (grp->GetHits()) {
398  TIter next(grp->GetParticles());
399  KVReconstructedNucleus* nuc = 0;
400  while ((nuc = (KVReconstructedNucleus*) next()))
401  n += (UInt_t) nuc->IsIdentified();
402  }
403  return n;
404  }
406  {
412  return (grp->GetHits() - GetNIdentifiedInGroup(grp));
413  }
414 
416  {
419  return fReconTraj;
420  }
424  void PrintStatusString() const;
425 
426  Bool_t InArray(const TString&) const;
427  TString GetArrayName() const;
428  void ls(Option_t* = "") const override;
429 
430  ClassDefOverride(KVReconstructedNucleus, 17) //Nucleus detected by multidetector array
431 };
432 
433 
434 #endif
int Int_t
unsigned int UInt_t
#define e(i)
bool Bool_t
unsigned short UShort_t
unsigned char UChar_t
char Char_t
float Float_t
double Double_t
const char Option_t
#define BIT(n)
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
virtual const Char_t * GetType() const
Definition: KVBase.h:176
void AddUnidentifiedParticle(int modify_identified=-1) const
void AddIdentifiedParticle(int modify_unidentified=-1) const
const KVSeqCollection * GetIDTelescopes() const
KVGeoDetectorNode * GetNodeAt(Int_t i) const
KVDetector * GetDetector() const
Group of detectors which can be treated independently of all others in array.
Definition: KVGroup.h:19
UInt_t GetHits()
Definition: KVGroup.h:47
KVList * GetParticles()
Definition: KVGroup.h:55
Extended version of ROOT THashList.
Definition: KVHashList.h:29
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:84
Full result of one attempted particle identification.
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:123
Int_t GetA() const
Definition: KVNucleus.cpp:792
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:763
KVNameValueList * GetParameters() const
Definition: KVParticle.h:818
Path through detector array used to reconstruct detected particle.
KVDetector * GetDetector(const TString &label) const
Nuclei reconstructed from data measured by a detector array .
virtual void SetIDCode(UShort_t s)
void ls(Option_t *="") const override
KVDetector * GetDetector(const TString &label) const
virtual Bool_t IsZMeasured() const
virtual void SetAMeasured(Bool_t yes=kTRUE)
const Char_t * GetIDtelNames() const
Float_t fRealZ
Z returned by identification routine.
void SetReconstructionTrajectory(const KVReconNucTrajectory *t)
Method called in initial reconstruction of particle.
virtual Double_t GetTargetEnergyLoss() const
void CopyAndMoveReferences(const KVReconstructedNucleus *)
@ kStatusOKafterShare
of energy losses of other particles in the same group which have Status=0
@ kStatusStopFirstStage
(arbitrarily) between this and the other particle(s) with Status=2
@ kStatusPileupDE
telescope; a minimum Z could be estimated from the measured energy loss.
Bool_t InArray(const TString &) const
Returns kTRUE if particle was detected in array with given name.
const KVReconNucTrajectory * fReconTraj
trajectory used to reconstruct particle
virtual Int_t GetECode() const
Int_t GetNumberOfIdentificationResults() const
KVIdentificationResult * GetIdentificationResult(Int_t i)
KVIdentificationResult * GetIdentificationResult(Int_t i) const
KVHashList fDetList
non-persistent list of pointers to detectors
const KVReconNucTrajectory * GetReconstructionTrajectory() const
Float_t fRealA
A returned by identification routine.
void SetIdentification(KVIdentificationResult *, KVIDTelescope *)
static UInt_t GetNUnidentifiedInGroup(KVGroup *grp)
KVIdentificationResult * GetIdentificationResult(KVIDTelescope *idt) const
void Copy(TObject &) const override
void Clear(Option_t *option="") override
virtual Int_t GetIDCode() const
const KVSeqCollection * GetIDTelescopes() const
KVIdentificationResult * GetIdentificationResult(const Char_t *idtype)
TClonesArray fIDResults
results of every identification attempt made for this nucleus, in order of the ID telescopes used
KVDetector * GetStoppingDetector() const
void SetDetector(int i, KVDetector *);
virtual void SetTargetEnergyLoss(Double_t e)
KVString fDetNames
list of names of detectors through which particle passed
void ModifyReconstructionTrajectory(const KVReconNucTrajectory *t)
virtual void GetAnglesFromReconstructionTrajectory(Option_t *opt="random")
static UInt_t GetNIdentifiedInGroup(KVGroup *grp)
void init()
default initialisation
KVString fIDTelName
name of identification telescope which identified this particle (if any)
TString GetArrayName() const
Returns name of array particle was detected in (if known)
void Print(Option_t *option="") const override
KVDetector * GetDetector(int i) const
virtual void SetZMeasured(Bool_t yes=kTRUE)
Int_t fNSegDet
number of segmented/independent detectors hit by particle
void ReplaceReconTraj(const TString &traj_name)
virtual Float_t GetPID() const
Double_t fTargetEnergyLoss
calculated energy lost in target
KVIdentificationResult * GetIdentificationResult(KVIDTelescope *idt)
KVIDTelescope * GetIdentifyingTelescope() const
KVIdentificationResult * GetIdentificationResult(const Char_t *idtype) const
void SetIdentifyingTelescope(KVIDTelescope *i)
KVIDTelescope * fIDTelescope
non-persistent pointer to identification telescope
virtual Bool_t IsAMeasured() const
Int_t fAnalStatus
status of particle after analysis of reconstructed event
virtual void SetECode(UChar_t s)
const Char_t * GetDetectorNames() const
KaliVeda extensions to ROOT collection classes.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
TObject * ConstructedAt(Int_t idx)
const char * GetName() const override
Int_t GetEntries() const override
void SetBit(UInt_t f)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void ResetBit(UInt_t f)
const char * Data() const
const Int_t n
TArc a