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:
36  const KVReconNucTrajectory* fReconTraj;
37  KVString fDetNames;
38  KVHashList fDetList;
39  KVString fIDTelName;
40  KVIDTelescope* fIDTelescope;
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 
50  Int_t fNSegDet;
51  Int_t fAnalStatus;
52  Float_t fRealZ;
53  Float_t fRealA;
54  Double_t fTargetEnergyLoss;
55 
56  TClonesArray fIDResults;
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  {
122  return GetDetector(0);
123  };
124  Int_t GetNumDet() const
125  {
127  return fReconTraj ? fReconTraj->GetN() : 0;
128  }
129 
130  inline Int_t GetStatus() const
131  {
148  return fAnalStatus;
149  };
150 
151  inline void SetStatus(Int_t a)
152  {
153  fAnalStatus = a;
154  }
155 
156  virtual void GetAnglesFromReconstructionTrajectory(Option_t* opt = "random");
157  KVGroup* GetGroup() const
158  {
160  return (GetStoppingDetector() ? GetStoppingDetector()->GetGroup() : 0);
161  }
162 
163  void Copy(TObject&) const override;
164 
166  {
170 
171  return fReconTraj ? fReconTraj->GetIDTelescopes() : nullptr;
172  }
174  {
175  return fIDTelescope;
176  }
177 
178  virtual void SetIDCode(UShort_t s)
179  {
181  GetParameters()->SetValue("IDCODE", (Int_t)s);
182  }
183  virtual Int_t GetIDCode() const
184  {
187  return GetParameters()->GetIntValue("IDCODE");
188  }
189  virtual void SetECode(UChar_t s)
190  {
192  GetParameters()->SetValue("ECODE", (Int_t)s);
193  }
194  virtual Int_t GetECode() const
195  {
198  return GetParameters()->GetIntValue("ECODE");
199  }
200 
202  {
205  SetBit(kIsIdentified);
206  fReconTraj->AddIdentifiedParticle();
207  }
209  {
210  SetBit(kIsCalibrated);
211  }
213  {
216  ResetBit(kIsIdentified);
217  fReconTraj->AddUnidentifiedParticle();
218  }
220  {
221  ResetBit(kIsCalibrated);
222  }
224  {
225  return TestBit(kIsIdentified);
226  }
228  {
229  return TestBit(kIsCalibrated);
230  }
231 
232  void SetRealZ(Float_t zz)
233  {
234  fRealZ = zz;
235  }
237  {
238  fRealA = A;
239  }
241  {
242  if (fRealZ > 0) {
245  return fRealZ;
246  }
247  else {
250  return (Float_t) GetZ();
251  }
252  }
254  {
255  if (fRealA > 0)
256  return fRealA;
257  else
258  return (Float_t) GetA();
259  }
260  virtual Float_t GetPID() const
261  {
265  if (IsAMeasured())
266  return (GetRealZ() + 0.1 * (GetRealA() - 2. * GetRealZ()));
267  return GetRealZ();
268  };
270  {
272  fTargetEnergyLoss = e;
273  };
275  {
277  return fTargetEnergyLoss;
278  };
279 
280  virtual void SetZMeasured(Bool_t yes = kTRUE)
281  {
284  SetBit(kZMeasured, yes);
285  };
286  virtual void SetAMeasured(Bool_t yes = kTRUE)
287  {
290  SetBit(kAMeasured, yes);
291  };
292  virtual Bool_t IsZMeasured() const
293  {
296  return TestBit(kZMeasured);
297  };
298  virtual Bool_t IsAMeasured() const
299  {
302  return TestBit(kAMeasured);
303  };
305  {
322 
323  KVIdentificationResult* id = nullptr;
324  if (i) id = (KVIdentificationResult*)fIDResults.ConstructedAt(i - 1);
325  id->SetNumber(i);
326  return id;
327  }
329  {
334  return fIDResults.GetEntries();
335  }
336 
338  {
346 
348  for (int i = 1; i <= n; i++) {
350  if (!strcmp(id->GetIDType(), idtype)) {
351  return id;
352  }
353  }
354  return nullptr;
355  }
356 
358  {
366 
367  if (!idt) return nullptr;
368  return GetIdentificationResult(idt->GetType());
369  }
371  {
372  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(i);
373  }
375  {
376  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idtype);
377  }
379  {
380  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idt);
381  }
382 
384  {
390  UInt_t n = 0;
391  if (grp->GetHits()) {
392  TIter next(grp->GetParticles());
393  KVReconstructedNucleus* nuc = 0;
394  while ((nuc = (KVReconstructedNucleus*) next()))
395  n += (UInt_t) nuc->IsIdentified();
396  }
397  return n;
398  }
400  {
406  return (grp->GetHits() - GetNIdentifiedInGroup(grp));
407  }
408 
410  {
413  return fReconTraj;
414  }
418  void PrintStatusString() const;
419 
420  Bool_t InArray(const TString&) const;
421  TString GetArrayName() const;
422  void ls(Option_t* = "") const override;
423 
424  ClassDefOverride(KVReconstructedNucleus, 17) //Nucleus detected by multidetector array
425 };
426 
427 
428 #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:177
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:173
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:57
KVSeqCollection * GetParticles()
Definition: KVGroup.h:67
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:85
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:796
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:767
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
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.
virtual Int_t GetECode() const
Int_t GetNumberOfIdentificationResults() const
KVIdentificationResult * GetIdentificationResult(Int_t i)
KVIdentificationResult * GetIdentificationResult(Int_t i) const
const KVReconNucTrajectory * GetReconstructionTrajectory() const
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)
KVDetector * GetStoppingDetector() const
virtual void SetTargetEnergyLoss(Double_t e)
void ModifyReconstructionTrajectory(const KVReconNucTrajectory *t)
virtual void GetAnglesFromReconstructionTrajectory(Option_t *opt="random")
static UInt_t GetNIdentifiedInGroup(KVGroup *grp)
void init()
default initialisation
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)
void ReplaceReconTraj(const TString &traj_name)
virtual Float_t GetPID() const
KVIdentificationResult * GetIdentificationResult(KVIDTelescope *idt)
KVIDTelescope * GetIdentifyingTelescope() const
KVIdentificationResult * GetIdentificationResult(const Char_t *idtype) const
void SetIdentifyingTelescope(KVIDTelescope *i)
virtual Bool_t IsAMeasured() const
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