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 MakeDetectorList();
59 public:
60  void RebuildReconTraj(bool in_streamer = true);
61  void ReplaceReconTraj(const TString& traj_name);
62 
64  enum {
65  kStatusOK, // = 0 : identification is, in principle at least, possible straight away
66  kStatusOKafterSub, // = 1 : identification is, in principle, possible after identification and subtraction
68  kStatusOKafterShare, // = 2 : the energy loss in the shared detector of the group must be shared
70  kStatusStopFirstStage,//= 3 : the particle has stopped in the first member of an identification
72  kStatusPileupDE, // = 4 : only for filtered simulations: undetectable pile-up in DE detector
73  kStatusPileupGhost // = 5 : only for filtered simulations: undetectable particle
74  };
75 
78  void init();
80  virtual void Print(Option_t* option = "") const;
81  virtual void Clear(Option_t* option = "");
82  virtual void Reconstruct(KVDetector* kvd);
83 
86  {
87  if (i) {
88  fIDTelescope = i;
89  fIDTelName = i->GetName();
90  }
91  else fIDTelName = "";
92  };
93 
95  {
97 
98  if (fReconTraj) {
99  Obsolete("GetDetectorList", "1.10", "1.12");
100  return nullptr;
101  }
103  if (fDetList.IsEmpty()) {
104  const_cast<KVReconstructedNucleus*>(this)->MakeDetectorList();
105  }
106  return &fDetList;
107  }
108  KVDetector* GetDetector(const TString& label) const
109  {
111  if (fReconTraj) return fReconTraj->GetDetector(label);
114  return nullptr;
115  }
116  KVDetector* GetDetector(int i) const
117  {
125 
126  if (fReconTraj) return fReconTraj->GetNodeAt(i)->GetDetector();
128  if (i >= GetDetectorList()->GetEntries()) return 0;
129  return (KVDetector*) GetDetectorList()->At(i);
130  }
131 
132  const Char_t* GetDetectorNames() const
133  {
134  return fDetNames.Data();
135  }
136  const Char_t* GetIDtelNames() const
137  {
138  return fIDTelName.Data();
139  }
140 
143  {
145  return GetDetector(0);
146  };
147  Int_t GetNumDet() const
148  {
150  if (fReconTraj) return fReconTraj->GetN();
152  return GetDetectorList()->GetEntries();
153  }
155  {
158  return fNSegDet;
159  }
160  void SetNSegDet(Int_t seg)
161  {
164  fNSegDet = seg;
165  }
167  {
170 
173  fNSegDet = 0;
174  KVDetector* det;
175  TIter nxt(&fDetList);
176  while ((det = (KVDetector*)nxt())) fNSegDet += det->GetSegment();
177  }
178  inline Int_t GetStatus() const
179  {
196  return fAnalStatus;
197  };
198 
199  inline void SetStatus(Int_t a)
200  {
201  fAnalStatus = a;
202  }
203 
204  virtual void GetAnglesFromReconstructionTrajectory(Option_t* opt = "random");
205  KVGroup* GetGroup() const
206  {
208  return (GetStoppingDetector() ? GetStoppingDetector()->GetGroup() : 0);
209  };
210 
211 
212  void AddDetector(KVDetector*);
213 
214  virtual void Copy(TObject&) const;
215 
217  {
221 
222  if (fReconTraj) return fReconTraj->GetIDTelescopes();
224  return (GetStoppingDetector() ? GetStoppingDetector()->GetAlignedIDTelescopes() : 0);
225  }
226  virtual void Identify();
227  virtual void Calibrate();
228 
230  {
231  return fIDTelescope;
232  }
233 
234  virtual void SetIDCode(UShort_t s)
235  {
237  GetParameters()->SetValue("IDCODE", (Int_t)s);
238  }
239  virtual Int_t GetIDCode() const
240  {
243  return GetParameters()->GetIntValue("IDCODE");
244  }
245  virtual void SetECode(UChar_t s)
246  {
248  GetParameters()->SetValue("ECODE", (Int_t)s);
249  }
250  virtual Int_t GetECode() const
251  {
254  return GetParameters()->GetIntValue("ECODE");
255  }
256 
258  {
262  if (fReconTraj) {
264  return;
265  }
266  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementIdentifiedParticles)(1);
267  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementUnidentifiedParticles)(-1);
268  }
270  {
272  }
274  {
277  if (fReconTraj) {
279  return;
280  }
282  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementIdentifiedParticles)(-1);
283  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementUnidentifiedParticles)(1);
284  }
286  {
288  }
290  {
291  return TestBit(kIsIdentified);
292  }
294  {
295  return TestBit(kIsCalibrated);
296  }
297 
298  void SetRealZ(Float_t zz)
299  {
300  fRealZ = zz;
301  }
303  {
304  fRealA = A;
305  }
307  {
308  if (fRealZ > 0) {
311  return fRealZ;
312  }
313  else {
316  return (Float_t) GetZ();
317  }
318  }
320  {
321  if (fRealA > 0)
322  return fRealA;
323  else
324  return (Float_t) GetA();
325  }
326  virtual Float_t GetPID() const
327  {
331  if (IsAMeasured())
332  return (GetRealZ() + 0.1 * (GetRealA() - 2. * GetRealZ()));
333  return GetRealZ();
334  };
336  {
339  };
341  {
343  return fTargetEnergyLoss;
344  };
345 
346  virtual void SetZMeasured(Bool_t yes = kTRUE)
347  {
350  SetBit(kZMeasured, yes);
351  };
352  virtual void SetAMeasured(Bool_t yes = kTRUE)
353  {
356  SetBit(kAMeasured, yes);
357  };
358  virtual Bool_t IsZMeasured() const
359  {
362  return TestBit(kZMeasured);
363  };
364  virtual Bool_t IsAMeasured() const
365  {
368  return TestBit(kAMeasured);
369  };
371  {
393 
394  KVIdentificationResult* id = nullptr;
395  if (i) id = (KVIdentificationResult*)fIDResults.ConstructedAt(i - 1);
396  id->SetNumber(i);
397  return id;
398  }
400  {
405  return fIDResults.GetEntries();
406  }
407 
409  {
417 
419  for (int i = 1; i <= n; i++) {
421  if (!strcmp(id->GetIDType(), idtype)) {
422  return id;
423  }
424  }
425  return nullptr;
426  }
427 
429  {
437 
438  if (!idt) return nullptr;
439  return GetIdentificationResult(idt->GetType());
440  }
442  {
443  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(i);
444  }
446  {
447  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idtype);
448  }
450  {
451  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idt);
452  }
453 
454  virtual void SubtractEnergyFromAllDetectors();
456  {
462  UInt_t n = 0;
463  if (grp->GetHits()) {
464  TIter next(grp->GetParticles());
465  KVReconstructedNucleus* nuc = 0;
466  while ((nuc = (KVReconstructedNucleus*) next()))
467  n += (UInt_t) nuc->IsIdentified();
468  }
469  return n;
470  }
472  {
478  return (grp->GetHits() - GetNIdentifiedInGroup(grp));
479  }
480  static void AnalyseParticlesInGroup(KVGroup* grp);
481 
483  {
486  return fReconTraj;
487  }
491  void PrintStatusString() const;
492 
493  Bool_t InArray(const TString&) const;
494  TString GetArrayName() const;
495  void ls(Option_t* = "") const;
496 
497  ClassDef(KVReconstructedNucleus, 17) //Nucleus detected by multidetector array
498 };
499 
500 
501 #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 ClassDef(name, id)
#define BIT(n)
#define R__FOR_EACH(type, proc)
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:177
Base class for detector geometry description.
Definition: KVDetector.h:160
UShort_t GetSegment() const
Definition: KVDetector.h:830
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:20
UInt_t GetHits()
Definition: KVGroup.h:58
KVList * GetParticles()
Definition: KVGroup.h:66
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:126
Int_t GetA() const
Definition: KVNucleus.cpp:802
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:773
KVNameValueList * GetParameters() const
Definition: KVParticle.h:815
Path through detector array used to reconstruct detected particle.
Int_t GetNumberOfIndependentIdentifications() const
KVDetector * GetDetector(const TString &label) const
Nuclei reconstructed from data measured by a detector array .
virtual void SetIDCode(UShort_t s)
virtual void Reconstruct(KVDetector *kvd)
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 *)
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
void ls(Option_t *="") const
virtual Int_t GetECode() const
Int_t GetNumberOfIdentificationResults() const
const KVSeqCollection * GetDetectorList() const
virtual void Print(Option_t *option="") const
virtual void Copy(TObject &) const
KVIdentificationResult * GetIdentificationResult(Int_t i)
KVIdentificationResult * GetIdentificationResult(Int_t i) const
virtual void SubtractEnergyFromAllDetectors()
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 RebuildReconTraj(bool in_streamer=true)
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)
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
virtual void Clear(Option_t *option="")
KVIdentificationResult * GetIdentificationResult(KVIDTelescope *idt)
KVIDTelescope * GetIdentifyingTelescope() const
static void AnalyseParticlesInGroup(KVGroup *grp)
@ 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.
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.
virtual TObject * FindObjectByLabel(const Char_t *) const
virtual TObject * At(Int_t idx) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
TObject * ConstructedAt(Int_t idx)
virtual Int_t GetEntries() const
virtual Bool_t IsEmpty() const
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)
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
const char * Data() const
const Int_t n
TArc a