KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVReconstructedNucleus.h
Go to the documentation of this file.
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"
10 #include "KVGroup.h"
11 #include "TClonesArray.h"
12 #include "KVReconNucTrajectory.h"
13 
33 
34 protected:
40 
41  enum {
42  kIsIdentified = BIT(18), //flag set when identification of particle is complete
43  kIsCalibrated = BIT(19), //flag set when energy calibration of particle is complete
44  kCoherency = BIT(20), //particle created and/or identified by analysis of energy losses of other particles
45  kZMeasured = BIT(21), //the Z attributed to this nucleus was measured
46  kAMeasured = BIT(22) //the A attributed to this nucleus was measured
47  };
48 
54 
56 
57  void MakeDetectorList();
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  virtual void Print(Option_t* option = "") const;
80  virtual void Clear(Option_t* option = "");
81  virtual void Reconstruct(KVDetector* kvd);
82 
85  {
86  if (i) {
87  fIDTelescope = i;
88  fIDTelName = i->GetName();
89  }
90  else fIDTelName = "";
91  };
92 
94  {
96 
97  if (fReconTraj) {
98  Obsolete("GetDetectorList", "1.10", "1.12");
99  return nullptr;
100  }
102  if (fDetList.IsEmpty()) {
103  const_cast<KVReconstructedNucleus*>(this)->MakeDetectorList();
104  }
105  return &fDetList;
106  }
107  KVDetector* GetDetector(const TString& label) const
108  {
110  if (fReconTraj) return fReconTraj->GetDetector(label);
113  return nullptr;
114  }
115  KVDetector* GetDetector(int i) const
116  {
124 
125  if (fReconTraj) return fReconTraj->GetNodeAt(i)->GetDetector();
127  if (i >= GetDetectorList()->GetEntries()) return 0;
128  return (KVDetector*) GetDetectorList()->At(i);
129  }
130 
131  const Char_t* GetDetectorNames() const
132  {
133  return fDetNames.Data();
134  }
135  const Char_t* GetIDtelNames() const
136  {
137  return fIDTelName.Data();
138  }
139 
142  {
144  return GetDetector(0);
145  };
146  Int_t GetNumDet() const
147  {
149  if (fReconTraj) return fReconTraj->GetN();
151  return GetDetectorList()->GetEntries();
152  }
154  {
157  return fNSegDet;
158  }
159  void SetNSegDet(Int_t seg)
160  {
163  fNSegDet = seg;
164  }
166  {
169 
172  fNSegDet = 0;
173  KVDetector* det;
174  TIter nxt(&fDetList);
175  while ((det = (KVDetector*)nxt())) fNSegDet += det->GetSegment();
176  }
177  inline Int_t GetStatus() const
178  {
195  return fAnalStatus;
196  };
197 
198  inline void SetStatus(Int_t a)
199  {
200  fAnalStatus = a;
201  }
202 
203  virtual void GetAnglesFromReconstructionTrajectory(Option_t* opt = "random");
204  KVGroup* GetGroup() const
205  {
207  return (GetStoppingDetector() ? GetStoppingDetector()->GetGroup() : 0);
208  };
209 
210 
211  void AddDetector(KVDetector*);
212 
213  virtual void Copy(TObject&) const;
214 
216  {
220 
221  if (fReconTraj) return fReconTraj->GetIDTelescopes();
223  return (GetStoppingDetector() ? GetStoppingDetector()->GetAlignedIDTelescopes() : 0);
224  }
225  virtual void Identify();
226  virtual void Calibrate();
227 
229  {
230  return fIDTelescope;
231  }
232 
234  {
236  GetParameters()->SetValue("IDCODE", (Int_t)s);
237  }
238  virtual Int_t GetIDCode() const
239  {
242  return GetParameters()->GetIntValue("IDCODE");
243  }
245  {
247  GetParameters()->SetValue("ECODE", (Int_t)s);
248  }
249  virtual Int_t GetECode() const
250  {
253  return GetParameters()->GetIntValue("ECODE");
254  }
255 
257  {
261  if (fReconTraj) {
263  return;
264  }
265  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementIdentifiedParticles)(1);
266  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementUnidentifiedParticles)(-1);
267  }
269  {
271  }
273  {
276  if (fReconTraj) {
278  return;
279  }
281  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementIdentifiedParticles)(-1);
282  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementUnidentifiedParticles)(1);
283  }
285  {
287  }
289  {
290  return TestBit(kIsIdentified);
291  }
293  {
294  return TestBit(kIsCalibrated);
295  }
296 
297  void SetRealZ(Float_t zz)
298  {
299  fRealZ = zz;
300  }
302  {
303  fRealA = A;
304  }
306  {
307  if (fRealZ > 0) {
310  return fRealZ;
311  }
312  else {
315  return (Float_t) GetZ();
316  }
317  }
319  {
320  if (fRealA > 0)
321  return fRealA;
322  else
323  return (Float_t) GetA();
324  }
325  virtual Float_t GetPID() const
326  {
330  if (IsAMeasured())
331  return (GetRealZ() + 0.1 * (GetRealA() - 2. * GetRealZ()));
332  return GetRealZ();
333  };
335  {
338  };
340  {
342  return fTargetEnergyLoss;
343  };
344 
345  virtual void SetZMeasured(Bool_t yes = kTRUE)
346  {
349  SetBit(kZMeasured, yes);
350  };
351  virtual void SetAMeasured(Bool_t yes = kTRUE)
352  {
355  SetBit(kAMeasured, yes);
356  };
357  virtual Bool_t IsZMeasured() const
358  {
361  return TestBit(kZMeasured);
362  };
363  virtual Bool_t IsAMeasured() const
364  {
367  return TestBit(kAMeasured);
368  };
370  {
392 
393  KVIdentificationResult* id = nullptr;
394  if (i) id = (KVIdentificationResult*)fIDResults.ConstructedAt(i - 1);
395  id->SetNumber(i);
396  return id;
397  }
399  {
404  return fIDResults.GetEntries();
405  }
406 
408  {
416 
418  for (int i = 1; i <= n; i++) {
420  if (!strcmp(id->GetIDType(), idtype)) {
421  return id;
422  }
423  }
424  return nullptr;
425  }
426 
428  {
436 
437  if (!idt) return nullptr;
438  return GetIdentificationResult(idt->GetType());
439  }
441  {
442  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(i);
443  }
445  {
446  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idtype);
447  }
449  {
450  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idt);
451  }
452 
453  virtual void SubtractEnergyFromAllDetectors();
455  {
461  UInt_t n = 0;
462  if (grp->GetHits()) {
463  TIter next(grp->GetParticles());
464  KVReconstructedNucleus* nuc = 0;
465  while ((nuc = (KVReconstructedNucleus*) next()))
466  n += (UInt_t) nuc->IsIdentified();
467  }
468  return n;
469  }
471  {
477  return (grp->GetHits() - GetNIdentifiedInGroup(grp));
478  }
479  static void AnalyseParticlesInGroup(KVGroup* grp);
480 
482  {
485  return fReconTraj;
486  }
490  void PrintStatusString() const;
491 
492  Bool_t InArray(const TString&) const;
493  TString GetArrayName() const;
494  void ls(Option_t* = "") const;
495 
496  ClassDef(KVReconstructedNucleus, 17) //Nucleus detected by multidetector array
497 };
498 
499 
500 #endif
int Int_t
unsigned int UInt_t
#define e(i)
unsigned short UShort_t
unsigned char UChar_t
char Char_t
bool Bool_t
double Double_t
float Float_t
const char Option_t
#define ClassDef(name, id)
#define BIT(n)
#define R__FOR_EACH(type, proc)
virtual const Char_t * GetType() const
Definition: KVBase.h:176
Base class for detector geometry description.
Definition: KVDetector.h:159
UShort_t GetSegment() const
Definition: KVDetector.h:829
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:57
KVList * GetParticles()
Definition: KVGroup.h:65
Extended version of ROOT THashList.
Definition: KVHashList.h:28
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:83
Full result of one attempted particle identification.
const Char_t * GetIDType() const
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:125
Int_t GetA() const
Definition: KVNucleus.cpp:799
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:770
KVNameValueList * GetParameters() const
Definition: KVParticle.h:816
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 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
Display nucleus parameters.
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
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
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:72
TObject * ConstructedAt(Int_t idx)
virtual Int_t GetEntries() const
virtual Bool_t IsEmpty() const
virtual const char * GetName() const
Int_t GetEntries() const
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
const long double s
Definition: KVUnits.h:94
auto * a