KaliVeda
Toolkit for HIC analysis
KVFAZIAIDTelescope.cpp
1 //Created by KVClassFactory on Mon Feb 17 13:51:39 2014
2 //Author: John Frankland,,,
3 
4 #include "KVFAZIAIDTelescope.h"
5 #include "TRandom.h"
6 
8 
10 
11 // BEGIN_HTML <!--
13 /* -->
14 <h2>KVFAZIAIDTelescope</h2>
15 <h4>Identification for FAZIA array</h4>
16 <!-- */
17 // --> END_HTML
19 
20 
21 
25 {
26  // Default constructor
27  if (!fMassIDProb) {
28  fMassIDProb = new TF1("FAZIA-MassIDProb", "1./(exp((x-[0])/[1])+1)", 0, 100);
29  fMaxZ = 22.5;
30  fSigmaZ = .5;
31 // fMassIDProb->SetParameters(22.5, .5);
32  }
33 }
34 
35 
36 
45 
47 {
48  // Add a detector to the telescope.
49  //
50  // Detectors must be added in the order they will be hit by impinging particles,
51  // with the last detector being the one particles stopped in the telescope will stop in.
52  // i.e. dE1, dE2, ..., Eres
53  //
54  // Update name of telescope to "ID_[label of 1st detector]_[label of 2nd detector]_ ... _[label of last detector]"
55 
56  if (d) {
57  fDetectors.Add(d);
58  if (GetSize() > 1) {
59  TString name = "ID_";
60  KVDetector* det = nullptr;
61  for (int i = 1; i <= GetSize(); ++i) {
62  det = GetDetector(i);
63  name += det->GetLabel();
64  name += "_";
65  }
66  name += Form("%d", det->GetIndex());
67  SetName(name);
68  }
69  else
70  SetName(Form("ID_%s_%d", GetDetector(1)->GetLabel(), GetDetector(1)->GetIndex()));
71  }
72  else {
73  Warning("AddDetector", "Called with null pointer");
74  }
75 }
76 
77 
78 //const Char_t* KVFAZIAIDTelescope::GetNewName(KVString oldname)
79 //{
80 
81 // KVString tmp = "";
82 // KVString lab = "";
83 // oldname.Begin("_");
84 // KVString id = oldname.Next();
85 // if (id != "ID") return "unkonwn";
86 // if (oldname.End()) return "unkonwn";
87 // KVString det1 = oldname.Next();
88 // KVString det2 = "";
89 // if (!oldname.End()) {
90 // det2 = oldname.Next();
91 // }
92 // KVString newdet1 = KVFAZIADetector::GetNewName(det1.Data());
93 // newdet1.Begin("-");
94 // KVString labdet1 = newdet1.Next();
95 // KVString idxdet1 = newdet1.Next();
96 
97 // static KVString newname;
98 // if (det2 == "") {
99 // newname.Form("ID_%s_%s", labdet1.Data(), idxdet1.Data());
100 // }
101 // else {
102 // KVString newdet2 = KVFAZIADetector::GetNewName(det2.Data());
103 // newdet2.Begin("-");
104 // KVString labdet2 = newdet2.Next();
105 // newname.Form("ID_%s_%s_%s", labdet1.Data(), labdet2.Data(), idxdet1.Data());
106 // }
107 
108 // return newname.Data();
109 //}
110 
111 
117 
119 {
120  // For filtering simulations
121  //
122  // Z-dependence of A identification:
123  // fMassIDProb parameters has to set in the Initialize method
124 
125 
127 
128  IDR->Zident = true;
129  Bool_t okmass = (gRandom->Uniform() < fMassIDProb->Eval(IDR->Z));
130 
131  if (okmass) {
132  //reset A to the original mass in case of multiple call of this method
133  if (n->GetParameters()->HasParameter("OriginalMass")) IDR->A = n->GetParameters()->GetIntValue("OriginalMass");
134  IDR->Aident = true;
135  }
136  else {
137  //save the original mass in the parameter list in case of multiple call of this method
138  n->GetParameters()->SetValue("OriginalMass", n->GetA());
139  // double e = n->GetE();
140  // give to IDR the mass corresponding to mass formula for particle?
141  IDR->A = n->GetA();
142  // n->SetE(e); ???
143  IDR->Aident = false;
144  }
145 }
146 
147 
#define d(i)
bool Bool_t
char name[80]
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
const Char_t * GetLabel() const
Definition: KVBase.h:198
static TF1 * fMassIDProb
void SetIdentificationStatus(KVIdentificationResult *IDR, const KVNucleus *n) override
void AddDetector(KVDetector *d) override
KVDetector * GetDetector(UInt_t n) const
UInt_t GetSize() const
KVUnownedList fDetectors
list of detectors in telescope
Definition: KVIDTelescope.h:91
Full result of one attempted particle identification.
Bool_t Aident
= kTRUE if A of particle established
Int_t A
A of particle found (if Aident==kTRUE)
Int_t Z
Z of particle found (if Zident==kTRUE)
Bool_t Zident
=kTRUE if Z of particle established
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:123
void Add(TObject *obj) override
virtual void SetParameters(const Double_t *params)
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual void SetName(const char *name)
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual Double_t Uniform(Double_t x1, Double_t x2)
const Int_t n
ClassImp(TPyArg)