KaliVeda
Toolkit for HIC analysis
KVCsI.cpp
1 #include "KVCsI.h"
2 
3 #include <KVCalibratedSignal.h>
4 
5 using namespace std;
6 
8 //_______________________________________________________________________________________
9 
10 
11 
14 void KVCsI::init()
15 {
16  //initialise non-persistent pointers
17  fSegment = 2;
18  fPinLaser = 0;
19 }
20 
21 
22 
23 
30 
32 {
33  //Default ctor
34  //This ctor (which in turn calls the KVDetector default ctor) must exist in
35  //order for Cloning of detectors to work (as used in KVTelescope::AddDetector).
36  //Do not replace this ctor by giving a default value for the argument of KVCsI(Float_t).
37  //
38  init();
39 }
40 
41 
42 
48 
49 KVCsI::KVCsI(Float_t thick, Float_t thickAl): KVINDRADetector("CsI", thick)
50 {
51  //Make a CsI detector "thick" cm long
52  //with a Al dead layer "thickAl" um long
53  //Set type of detector to "CSI"
54  //By default 'thick'=0
55 
56  if (thickAl > 0.0) {
57  KVMaterial* mat = new KVMaterial("Al", thickAl * KVUnits::um);
58  fAbsorbers->AddFirst(mat);
60  }
61  SetType("CSI");
62  SetLabel("CSI");//for use with KVReconNucTrajectory
63  init();
64 }
65 
66 
67 
69 
70 void KVCsI::SetAlThickness(Float_t thickAl /* um */)
71 {
72  KVMaterial* mat = 0;
73  if (!(mat = GetAbsorber("Al"))) {
74  mat = new KVMaterial("Al", thickAl * KVUnits::um);
75  fAbsorbers->AddFirst(mat);
77  }
78  else mat->SetThickness(thickAl * KVUnits::um);
79 }
80 
81 
82 
83 
86 
88 {
89  // Calculate calibrated energy loss for a nucleus (Z,A) giving total light output "lum".
90 
91  if (!(GetDetectorSignalValue("TotLight") > 0)) return -1;
92 
93  Int_t Z = nuc->GetZ();
94  Int_t A = nuc->GetA();
95 
96  Double_t eloss;
97  if (lum > -1) eloss = GetDetectorSignalValue("Energy", Form("INPUT=%g,Z=%d,A=%d", lum, Z, A));
98  else eloss = GetDetectorSignalValue("Energy", Form("Z=%d,A=%d", Z, A));
99  if (((KVCalibratedSignal*)GetDetectorSignal("Energy"))->InversionFailure()) {
100  Info("GetCorrectedEnergy", "Failed to invert Light-Energy calibration for %s with Z=%d A=%d LIGHT=%f",
101  GetName(), Z, A, GetDetectorSignalValue("TotLight"));
102  return -1;
103  }
104 
105  // If TotLight is calculated from fast and slow components (INDRA data before Mesytec acquisition upgrade)
106  // we check that the calculation went well
107  if (!GetDetectorSignal("TotLight")->IsRaw() && !GetDetectorSignal("TotLight")->GetStatus("LightIsGood")) return -1.;
108 
109  if (eloss > 0) {
110  SetEnergy(eloss);
111  return eloss;
112  }
113 
114  return -1.;
115 }
116 
117 
118 
120 
122 {
123  AbstractMethod("DeduceACQParameters");
124 
125  // Deduce fast & slow acquisition parameters for particles hitting CsI in given
126  // (simulated) event. The KVNumberList contains the indices of particles in the event.
127 // GetACQParam("R")->SetData(-1);
128 // GetACQParam("L")->SetData(-1);
129 // GetACQParam("T")->SetData(-1);
130 
131 // UShort_t Mt = 110;
132 // Double_t Xlen_sum = 0;
133 // Double_t Yrap_sum = 0;
134 
135 // KVIDTelescope* idcsi = (KVIDTelescope*)GetIDTelescopes()->At(0);
136 
137 // KVIDZAGrid* idgcsi = (KVIDZAGrid*)idcsi->GetIDGrid();
138 // if (!idgcsi) {
139 // //Warning("DeduceACQParameters","%s, No grid available",GetName());
140 // return;
141 // }
142 
143 // index.Begin();
144 // while (!index.End()) { // loop over all particles hitting CsI
145 // KVNucleus* nunuc = e->GetParticle(index.Next());
146 // Int_t zz = nunuc->GetZ();
147 // Int_t aa = nunuc->GetA();
148 // // calculate total light output corresponding to this particle and its individual energy loss
149 // Double_t lumiere = GetLightFromEnergy(zz, aa, nunuc->GetParameters()->GetDoubleValue(GetName()));
150 
153 
154 // KVIDZALine* idline = (KVIDZALine*)idgcsi->GetIdentifier(zz, aa);
155 // if (!idline && zz <= idgcsi->GetZmax()) {
156 // // Z within limits of grid, but we don't have the isotope
157 // // Look for line with closest mass
158 // Int_t closest_a = 1000;
159 // Int_t closest_index = -1;
160 // Int_t nids = idgcsi->GetNumberOfIdentifiers();
161 // for (Int_t iid = 0; iid < nids; iid++) {
162 // KVIDZALine* ll = (KVIDZALine*)idgcsi->GetIdentifierAt(iid);
163 // if (ll->GetZ() == zz) {
164 // if (TMath::Abs(ll->GetA() - aa) < TMath::Abs(closest_a - aa)) {
165 // closest_index = iid;
166 // closest_a = ll->GetA();
167 // }
168 // }
169 // }
170 // idline = (KVIDZALine*)idgcsi->GetIdentifierAt(closest_index);
171 // }
172 // Double_t Xlen = 0;
173 // Double_t Yrap = 0;
174 
175 // if (idline) {
176 // Double_t Yrap1, Yrap2, Xlen1, Xlen2;
177 // idline->GetStartPoint(Xlen1, Yrap1);
178 // idline->GetEndPoint(Xlen2, Yrap2);
179 
180 // Double_t lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
181 // Double_t lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
184 // if (lumiere < lumcalc1) {
185 // Xlen2 = Xlen1;
186 // Yrap2 = Yrap1;
187 // lumcalc2 = lumcalc1;
188 // Xlen1 = GetPedestal("L");
189 // Yrap1 = idline->Eval(Xlen1, 0, "S");
190 // lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
191 // //cout << "Extrapolating before start of ID line" << endl;
192 // }
193 // else if (lumiere > lumcalc2) {
194 // Xlen1 = Xlen2;
195 // Yrap1 = Yrap2;
196 // lumcalc1 = lumcalc2;
197 // Xlen2 = 4095;
198 // Yrap2 = idline->Eval(Xlen2, 0, "S");
199 // lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
200 // //cout << "Extrapolating after end of ID line" << endl;
201 // }
202 // //cout << "Xlen1=" << Xlen1 << " Yrap1="<<Yrap1<< " Lum_min = " << lumcalc1 << endl;
203 // //cout << "Xlen2=" << Xlen2 << " Yrap2=" << Yrap2<< " Lum_max = " << lumcalc2 << endl;
204 
205 // Xlen = (Xlen1 + Xlen2) / 2.;
206 // Yrap = idline->Eval(Xlen, 0, "S");
207 // Double_t lumcalc = Calculate(kLumiere, Yrap, Xlen);
208 // //cout << "-1 : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
209 
210 // Int_t niter = 0;
211 // while (niter < 20 && TMath::Abs(lumcalc - lumiere) / lumiere > 0.01) {
212 // if (lumcalc > lumiere) {
213 // Xlen2 = Xlen;
214 // }
215 // else {
216 // Xlen1 = Xlen;
217 // }
218 // Xlen = (Xlen1 + Xlen2) / 2.;
219 // Yrap = idline->Eval(Xlen, 0, "S");
220 // lumcalc = Calculate(kLumiere, Yrap, Xlen);
221 // //cout << niter << " : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
222 // niter++;
223 
224 // }
225 // // TMarker *mrk = new TMarker(Xlen,Yrap,2);
226 // // mrk->SetMarkerSize(2);
227 // // mrk->SetMarkerColor(kRed);
228 // // if(idgcsi->IsDrawn()) idgcsi->IsDrawn()->cd();
229 // // else {new TCanvas; idgcsi->Draw();}
230 // // mrk->Draw();
231 // }
232 // else {
233 // KVIDCutLine* imf_line = (KVIDCutLine*)idgcsi->GetCut("IMF_line");
234 // if (!imf_line) {
235 // //Warning("DeduceACQParameters","%s, No IMF_line defined",GetName());
236 // return;
237 // }
238 // else {
239 // Double_t Yrap1, Yrap2, Xlen1, Xlen2;
240 // imf_line->GetStartPoint(Xlen1, Yrap1);
241 // imf_line->GetEndPoint(Xlen2, Yrap2);
242 // Yrap1 += 10.; //au-dessus de la ligne fragment
243 // Yrap2 += 10.; //au-dessus de la ligne fragment
244 // Double_t lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
245 // Double_t lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
246 // if (lumiere < lumcalc1) {
247 // Xlen2 = Xlen1;
248 // Yrap2 = Yrap1;
249 // lumcalc2 = lumcalc1;
250 // Xlen1 = GetPedestal("L");
251 // Yrap1 = imf_line->Eval(Xlen1, 0, "S") + 10.;
252 // lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
253 // //cout << "Extrapolating before start of IMF line" << endl;
254 // }
255 // else if (lumiere > lumcalc2) {
256 // Xlen1 = Xlen2;
257 // Yrap1 = Yrap2;
258 // lumcalc1 = lumcalc2;
259 // Xlen2 = 4095;
260 // Yrap2 = imf_line->Eval(Xlen2, 0, "S") + 10.;
261 // lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
262 // //cout << "Extrapolating after end of IMF line" << endl;
263 // }
264 // //cout << "Xlen1=" << Xlen1 << " Yrap1="<<Yrap1<< " Lum_min = " << lumcalc1 << endl;
265 // //cout << "Xlen2=" << Xlen2 << " Yrap2=" << Yrap2<< " Lum_max = " << lumcalc2 << endl;
266 
267 // Xlen = (Xlen1 + Xlen2) / 2.;
268 // Yrap = imf_line->Eval(Xlen) + 10.;//au-dessus de la ligne fragment
269 // Double_t lumcalc = Calculate(kLumiere, Yrap, Xlen);
270 // //cout << "-1 : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
271 
272 // Int_t niter = 0;
273 // while (niter < 20 && TMath::Abs(lumcalc - lumiere) / lumiere > 0.01) {
274 // if (lumcalc > lumiere) {
275 // Xlen2 = Xlen;
276 // }
277 // else {
278 // Xlen1 = Xlen;
279 // }
280 // Xlen = (Xlen1 + Xlen2) / 2.;
281 // Yrap = imf_line->Eval(Xlen) + 10.;//au-dessus de la ligne fragment
282 // lumcalc = Calculate(kLumiere, Yrap, Xlen);
283 // //cout << niter << " : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
284 // niter++;
285 // }
286 // if (niter == 20) {
287 // Xlen = -1;
288 // Yrap = -1;
289 // Mt = -1;
290 // }
291 // // TMarker *mrk = new TMarker(Xlen,Yrap,2);
292 // // mrk->SetMarkerSize(2);
293 // // mrk->SetMarkerColor(kBlue);
294 // // if(idgcsi->IsDrawn()) idgcsi->IsDrawn()->cd();
295 // // else {new TCanvas; idgcsi->Draw();}
296 // // mrk->Draw();
297 // }
298 
299 // }
300 // if (Xlen > 0) Xlen_sum += Xlen;
301 // if (Yrap > 0) Yrap_sum += Yrap;
302 // }
303 // GetACQParam("R")->SetData((UShort_t)Yrap_sum);
304 // GetACQParam("L")->SetData((UShort_t)Xlen_sum);
305 // GetACQParam("T")->SetData(Mt);
306 
307 }
308 
309 
int Int_t
bool Bool_t
float Float_t
double Double_t
char * Form(const char *fmt,...)
void SetLabel(const Char_t *lab)
Definition: KVBase.h:195
Output signal from detector obtained by calibration.
CsI(Tl) scintillation detectors of the INDRA multidetector array.
Definition: KVCsI.h:16
void DeduceACQParameters(KVEvent *, KVNumberList &)
Definition: KVCsI.cpp:121
Double_t GetCorrectedEnergy(KVNucleus *, Double_t lum=-1., Bool_t transmission=kTRUE)
void SetACQParams();
Definition: KVCsI.cpp:87
KVCsI()
Definition: KVCsI.cpp:31
void init()
initialise non-persistent pointers
Definition: KVCsI.cpp:14
virtual KVDetectorSignal * GetDetectorSignal(const KVString &type) const
Definition: KVCsI.h:45
void SetAlThickness(Float_t thickAl)
Definition: KVCsI.cpp:70
KVMaterial * GetAbsorber(Int_t i) const
Returns pointer to the i-th absorber in the detector (i=0 first absorber, i=1 second,...
Definition: KVDetector.cpp:646
KVList * fAbsorbers
list of absorbers making up the detector
Definition: KVDetector.h:236
void SetActiveLayer(KVMaterial *actif)
Definition: KVDetector.h:285
Double_t GetDetectorSignalValue(const KVString &type, const KVNameValueList &params="") const
Definition: KVDetector.h:493
virtual void SetEnergy(Double_t e) const
Definition: KVDetector.h:361
Abstract base class container for multi-particle events.
Definition: KVEvent.h:67
Base class for detectors of INDRA array.
void SetType(const Char_t *t)
Description of physical materials used to construct detectors & targets; interface to range tables.
Definition: KVMaterial.h:94
virtual void SetThickness(Double_t thick)
Definition: KVMaterial.cpp:454
KVMaterial()
default ctor
Definition: KVMaterial.cpp:77
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:126
Int_t GetA() const
Definition: KVNucleus.cpp:802
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:773
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
virtual void AddFirst(TObject *obj)
virtual TObject * FindObject(const char *name) const
const char * GetName() const override
void AbstractMethod(const char *method) const
virtual void Info(const char *method, const char *msgfmt,...) const
const long double um
Definition: KVUnits.h:68
void init()
ClassImp(TPyArg)