KaliVeda  1.12/06
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 
20 
21 protected:
27 
28  enum {
29  kIsIdentified = BIT(18), //flag set when identification of particle is complete
30  kIsCalibrated = BIT(19), //flag set when energy calibration of particle is complete
31  kCoherency = BIT(20), //particle created and/or identified by analysis of energy losses of other particles
32  kZMeasured = BIT(21), //the Z attributed to this nucleus was measured
33  kAMeasured = BIT(22) //the A attributed to this nucleus was measured
34  };
35 
41 
43 
44  void MakeDetectorList();
45  void RebuildReconTraj();
46 public:
47  void ReplaceReconTraj(const TString& traj_name);
48 
50  enum {
51  kStatusOK, // = 0 : identification is, in principle at least, possible straight away
52  kStatusOKafterSub, // = 1 : identification is, in principle, possible after identification and subtraction
54  kStatusOKafterShare, // = 2 : the energy loss in the shared detector of the group must be shared
56  kStatusStopFirstStage,//= 3 : the particle has stopped in the first member of an identification
58  kStatusPileupDE, // = 4 : only for filtered simulations: undetectable pile-up in DE detector
59  kStatusPileupGhost // = 5 : only for filtered simulations: undetectable particle
60  };
61 
64  void init();
66  virtual void Print(Option_t* option = "") const;
67  virtual void Clear(Option_t* option = "");
68  virtual void Reconstruct(KVDetector* kvd);
69 
72  {
73  if (i) {
74  fIDTelescope = i;
75  fIDTelName = i->GetName();
76  }
77  else fIDTelName = "";
78  };
79 
81  {
85 
86  if (fReconTraj) {
87  Obsolete("GetDetectorList", "1.10", "1.11");
88  return nullptr;
89  }
91  if (fDetList.IsEmpty()) {
92  const_cast<KVReconstructedNucleus*>(this)->MakeDetectorList();
93  }
94  return &fDetList;
95  }
96  KVDetector* GetDetector(const TString& label) const
97  {
99  if (fReconTraj) return fReconTraj->GetDetector(label);
102  return nullptr;
103  }
104  KVDetector* GetDetector(int i) const
105  {
111 
112  if (fReconTraj) return fReconTraj->GetNodeAt(i)->GetDetector();
114  if (i >= GetDetectorList()->GetEntries()) return 0;
115  return (KVDetector*) GetDetectorList()->At(i);
116  }
117 
118  const Char_t* GetDetectorNames() const
119  {
120  return fDetNames.Data();
121  }
122  const Char_t* GetIDtelNames() const
123  {
124  return fIDTelName.Data();
125  }
126 
129  {
131  return GetDetector(0);
132  };
133  Int_t GetNumDet() const
134  {
136  if (fReconTraj) return fReconTraj->GetN();
138  return GetDetectorList()->GetEntries();
139  }
141  {
144  return fNSegDet;
145  }
146  void SetNSegDet(Int_t seg)
147  {
150  fNSegDet = seg;
151  }
153  {
156 
159  fNSegDet = 0;
160  KVDetector* det;
161  TIter nxt(&fDetList);
162  while ((det = (KVDetector*)nxt())) fNSegDet += det->GetSegment();
163  }
164  inline Int_t GetStatus() const
165  {
182  return fAnalStatus;
183  };
184 
185  inline void SetStatus(Int_t a)
186  {
187  fAnalStatus = a;
188  }
189 
190  virtual void GetAnglesFromReconstructionTrajectory(Option_t* opt = "random");
191  KVGroup* GetGroup() const
192  {
194  return (GetStoppingDetector() ? GetStoppingDetector()->GetGroup() : 0);
195  };
196 
197 
198  void AddDetector(KVDetector*);
199 
200  virtual void Copy(TObject&) const;
201 
203  {
207 
208  if (fReconTraj) return fReconTraj->GetIDTelescopes();
210  return (GetStoppingDetector() ? GetStoppingDetector()->GetAlignedIDTelescopes() : 0);
211  }
212  virtual void Identify();
213  virtual void Calibrate();
214 
216  {
217  return fIDTelescope;
218  }
219 
221  {
223  GetParameters()->SetValue("IDCODE", (Int_t)s);
224  }
225  virtual Int_t GetIDCode() const
226  {
229  return GetParameters()->GetIntValue("IDCODE");
230  }
232  {
234  GetParameters()->SetValue("ECODE", (Int_t)s);
235  }
236  virtual Int_t GetECode() const
237  {
240  return GetParameters()->GetIntValue("ECODE");
241  }
242 
244  {
248  if (fReconTraj) {
250  return;
251  }
252  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementIdentifiedParticles)(1);
253  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementUnidentifiedParticles)(-1);
254  }
256  {
258  }
260  {
263  if (fReconTraj) {
265  return;
266  }
268  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementIdentifiedParticles)(-1);
269  const_cast<KVSeqCollection*>(GetDetectorList())->R__FOR_EACH(KVDetector, IncrementUnidentifiedParticles)(1);
270  }
272  {
274  }
276  {
277  return TestBit(kIsIdentified);
278  }
280  {
281  return TestBit(kIsCalibrated);
282  }
283 
284  void SetRealZ(Float_t zz)
285  {
286  fRealZ = zz;
287  }
289  {
290  fRealA = A;
291  }
293  {
294  if (fRealZ > 0) {
297  return fRealZ;
298  }
299  else {
302  return (Float_t) GetZ();
303  }
304  }
306  {
307  if (fRealA > 0)
308  return fRealA;
309  else
310  return (Float_t) GetA();
311  }
312  virtual Float_t GetPID() const
313  {
317  if (IsAMeasured())
318  return (GetRealZ() + 0.1 * (GetRealA() - 2. * GetRealZ()));
319  return GetRealZ();
320  };
322  {
325  };
327  {
329  return fTargetEnergyLoss;
330  };
331 
332  virtual void SetZMeasured(Bool_t yes = kTRUE)
333  {
336  SetBit(kZMeasured, yes);
337  };
338  virtual void SetAMeasured(Bool_t yes = kTRUE)
339  {
342  SetBit(kAMeasured, yes);
343  };
344  virtual Bool_t IsZMeasured() const
345  {
348  return TestBit(kZMeasured);
349  };
350  virtual Bool_t IsAMeasured() const
351  {
354  return TestBit(kAMeasured);
355  };
357  {
379 
380  KVIdentificationResult* id = nullptr;
381  if (i) id = (KVIdentificationResult*)fIDResults.ConstructedAt(i - 1);
382  id->SetNumber(i);
383  return id;
384  }
386  {
391  return fIDResults.GetEntries();
392  }
393 
395  {
403 
405  for (int i = 1; i <= n; i++) {
407  if (!strcmp(id->GetIDType(), idtype)) {
408  return id;
409  }
410  }
411  return nullptr;
412  }
413 
415  {
423 
424  if (!idt) return nullptr;
425  return GetIdentificationResult(idt->GetType());
426  }
428  {
429  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(i);
430  }
432  {
433  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idtype);
434  }
436  {
437  return const_cast<KVReconstructedNucleus*>(this)->GetIdentificationResult(idt);
438  }
439 
440  virtual void SubtractEnergyFromAllDetectors();
442  {
448  UInt_t n = 0;
449  if (grp->GetHits()) {
450  TIter next(grp->GetParticles());
451  KVReconstructedNucleus* nuc = 0;
452  while ((nuc = (KVReconstructedNucleus*) next()))
453  n += (UInt_t) nuc->IsIdentified();
454  }
455  return n;
456  }
458  {
464  return (grp->GetHits() - GetNIdentifiedInGroup(grp));
465  }
466  static void AnalyseParticlesInGroup(KVGroup* grp);
467 
469  {
472  return fReconTraj;
473  }
477  void PrintStatusString() const;
478 
479  Bool_t InArray(const TString&) const;
480  TString GetArrayName() const;
481  void ls(Option_t* = "") const;
482 
483  ClassDef(KVReconstructedNucleus, 17) //Nucleus detected by multidetector array
484 };
485 
486 
487 #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)
const Char_t * GetType() const
Definition: KVBase.h:170
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
UShort_t GetSegment() const
Definition: KVDetector.h:772
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:88
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:735
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