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 
7 
9 
10 // BEGIN_HTML <!--
12 /* -->
13 <h2>KVFAZIAIDTelescope</h2>
14 <h4>Identification for FAZIA array</h4>
15 <!-- */
16 // --> END_HTML
18 
19 
20 
24 {
25  // Default constructor
26  if (!fMassIDProb) {
27  fMassIDProb = new TF1("FAZIA-MassIDProb", "1./(exp((x-[0])/[1])+1)", 0, 100);
28  fMaxZ = 22.5;
29  fSigmaZ = .5;
30 // fMassIDProb->SetParameters(22.5, .5);
31  }
32 }
33 
34 
35 
44 
46 {
47  // Add a detector to the telescope.
48  //
49  // Detectors must be added in the order they will be hit by impinging particles,
50  // with the last detector being the one particles stopped in the telescope will stop in.
51  // i.e. dE1, dE2, ..., Eres
52  //
53  // Update name of telescope to "ID_[label of 1st detector]_[label of 2nd detector]_ ... _[label of last detector]"
54 
55  if (d) {
56  fDetectors.Add(d);
57  d->AddIDTelescope(this);
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 // Info("SetIdentificationStatus","%s : %lf %lf",ClassName(),fMassIDProb->GetParameter(0),fMassIDProb->GetParameter(1));
129 
130  n->SetZMeasured();
131  Bool_t okmass = (gRandom->Uniform() < fMassIDProb->Eval(n->GetZ())) && CanIdentify(n->GetZ(), n->GetA());
132 
133  if (okmass) {
134  //reset A to the original mass in case of multiple call of this method
135  if (n->GetParameters()->HasParameter("OriginalMass")) n->SetA(n->GetParameters()->GetIntValue("OriginalMass"));
136  n->SetAMeasured(kTRUE);
137  }
138  else {
139  //save the original mass in the parameter list in case of multiple call of this method
140  n->GetParameters()->SetValue("OriginalMass", n->GetA());
141  double e = n->GetE();
142  n->SetZ(n->GetZ());
143  n->SetE(e);
144  n->SetAMeasured(kFALSE);
145  }
146 }
147 
148 
#define d(i)
#define e(i)
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
char name[80]
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
const Char_t * GetLabel() const
Definition: KVBase.h:199
Base class for detector geometry description.
Definition: KVDetector.h:160
virtual Int_t GetIndex() const
Definition: KVDetector.h:803
static TF1 * fMassIDProb
virtual void SetIdentificationStatus(KVReconstructedNucleus *n)
static const Char_t* GetNewName(KVString oldname);
virtual void AddDetector(KVDetector *d)
KVDetector * GetDetector(UInt_t n) const
virtual Bool_t CanIdentify(Int_t Z, Int_t)
UInt_t GetSize() const
KVUnownedList fDetectors
list of detectors in telescope
Definition: KVIDTelescope.h:91
Nuclei reconstructed from data measured by a detector array .
virtual void Add(TObject *obj)
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)