KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVCsI.cpp
Go to the documentation of this file.
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 
85 
86 KVCsI::~KVCsI()
87 {
88 }
89 
90 
91 
95 
96 void KVCsI::Print(Option_t* option) const
97 {
98  //Print info on this detector - redefinition of KVDetector::Print for option="data" to include total light
99  //if option="data" the energy loss, total light and coder channel data are displayed
100 
101  if (!strcmp(option, "data")) {
102  cout << ((KVCsI*) this)->GetName() << " -- H=" << ((KVCsI*) this)->
103  GetDetectorSignalValue("TotLight") << " -- E=" << ((KVCsI*) this)->
104  GetEnergy() << " ";
105  TIter next(fACQParams);
106  KVACQParam* acq;
107  while ((acq = (KVACQParam*) next())) {
108  cout << acq->GetName() << "=" << (Short_t) acq->
109  GetCoderData() << "/" << TMath::Nint(acq->GetPedestal()) << " ";
110  }
112  cout << "(Belongs to an unidentified particle)";
113  cout << endl;
114  }
115  else {
116  KVDetector::Print(option);
117  }
118 }
119 
120 
121 
126 
128 {
129  // Set acquisition parameters for this CsI.
130  // Do not call before detector's name has been set.
131  // Initialises member pointers fACQ_R & fACQ_L for (fast) direct access.
132 
133  AddACQParamType("R");
134  AddACQParamType("L");
135  AddACQParamType("T");
136 }
137 
138 
139 
140 
144 
146 {
147  // Calculate calibrated energy loss for a nucleus (Z,A) giving total light output "lum".
148  // By default we use the current value of the detector's `TotLight` signal.
149 
150  if (!(GetDetectorSignalValue("TotLight") > 0)) return -1;
151 
152  Int_t Z = nuc->GetZ();
153  Int_t A = nuc->GetA();
154 
155  Double_t eloss;
156  if (lum > -1) eloss = GetDetectorSignalValue("Energy", Form("INPUT=%g,Z=%d,A=%d", lum, Z, A));
157  else eloss = GetDetectorSignalValue("Energy", Form("Z=%d,A=%d", Z, A));
158  if (((KVCalibratedSignal*)GetDetectorSignal("Energy"))->InversionFailure()) {
159  Info("GetCorrectedEnergy", "Failed to invert Light-Energy calibration for %s with Z=%d A=%d LIGHT=%f",
160  GetName(), Z, A, GetDetectorSignalValue("TotLight"));
161  return -1;
162  }
163 
164  if ((eloss > 0) && GetDetectorSignal("TotLight")->GetStatus("LightIsGood")) {
165  SetEnergy(eloss);
166  return eloss;
167  }
168  return -1.;
169 }
170 
171 
172 
174 
176 {
177  AbstractMethod("DeduceACQParameters");
178 
179  // Deduce fast & slow acquisition parameters for particles hitting CsI in given
180  // (simulated) event. The KVNumberList contains the indices of particles in the event.
181 // GetACQParam("R")->SetData(-1);
182 // GetACQParam("L")->SetData(-1);
183 // GetACQParam("T")->SetData(-1);
184 
185 // UShort_t Mt = 110;
186 // Double_t Xlen_sum = 0;
187 // Double_t Yrap_sum = 0;
188 
189 // KVIDTelescope* idcsi = (KVIDTelescope*)GetIDTelescopes()->At(0);
190 
191 // KVIDZAGrid* idgcsi = (KVIDZAGrid*)idcsi->GetIDGrid();
192 // if (!idgcsi) {
193 // //Warning("DeduceACQParameters","%s, No grid available",GetName());
194 // return;
195 // }
196 
197 // index.Begin();
198 // while (!index.End()) { // loop over all particles hitting CsI
199 // KVNucleus* nunuc = e->GetParticle(index.Next());
200 // Int_t zz = nunuc->GetZ();
201 // Int_t aa = nunuc->GetA();
202 // // calculate total light output corresponding to this particle and its individual energy loss
203 // Double_t lumiere = GetLightFromEnergy(zz, aa, nunuc->GetParameters()->GetDoubleValue(GetName()));
204 
207 
208 // KVIDZALine* idline = (KVIDZALine*)idgcsi->GetIdentifier(zz, aa);
209 // if (!idline && zz <= idgcsi->GetZmax()) {
210 // // Z within limits of grid, but we don't have the isotope
211 // // Look for line with closest mass
212 // Int_t closest_a = 1000;
213 // Int_t closest_index = -1;
214 // Int_t nids = idgcsi->GetNumberOfIdentifiers();
215 // for (Int_t iid = 0; iid < nids; iid++) {
216 // KVIDZALine* ll = (KVIDZALine*)idgcsi->GetIdentifierAt(iid);
217 // if (ll->GetZ() == zz) {
218 // if (TMath::Abs(ll->GetA() - aa) < TMath::Abs(closest_a - aa)) {
219 // closest_index = iid;
220 // closest_a = ll->GetA();
221 // }
222 // }
223 // }
224 // idline = (KVIDZALine*)idgcsi->GetIdentifierAt(closest_index);
225 // }
226 // Double_t Xlen = 0;
227 // Double_t Yrap = 0;
228 
229 // if (idline) {
230 // Double_t Yrap1, Yrap2, Xlen1, Xlen2;
231 // idline->GetStartPoint(Xlen1, Yrap1);
232 // idline->GetEndPoint(Xlen2, Yrap2);
233 
234 // Double_t lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
235 // Double_t lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
238 // if (lumiere < lumcalc1) {
239 // Xlen2 = Xlen1;
240 // Yrap2 = Yrap1;
241 // lumcalc2 = lumcalc1;
242 // Xlen1 = GetPedestal("L");
243 // Yrap1 = idline->Eval(Xlen1, 0, "S");
244 // lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
245 // //cout << "Extrapolating before start of ID line" << endl;
246 // }
247 // else if (lumiere > lumcalc2) {
248 // Xlen1 = Xlen2;
249 // Yrap1 = Yrap2;
250 // lumcalc1 = lumcalc2;
251 // Xlen2 = 4095;
252 // Yrap2 = idline->Eval(Xlen2, 0, "S");
253 // lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
254 // //cout << "Extrapolating after end of ID line" << endl;
255 // }
256 // //cout << "Xlen1=" << Xlen1 << " Yrap1="<<Yrap1<< " Lum_min = " << lumcalc1 << endl;
257 // //cout << "Xlen2=" << Xlen2 << " Yrap2=" << Yrap2<< " Lum_max = " << lumcalc2 << endl;
258 
259 // Xlen = (Xlen1 + Xlen2) / 2.;
260 // Yrap = idline->Eval(Xlen, 0, "S");
261 // Double_t lumcalc = Calculate(kLumiere, Yrap, Xlen);
262 // //cout << "-1 : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
263 
264 // Int_t niter = 0;
265 // while (niter < 20 && TMath::Abs(lumcalc - lumiere) / lumiere > 0.01) {
266 // if (lumcalc > lumiere) {
267 // Xlen2 = Xlen;
268 // }
269 // else {
270 // Xlen1 = Xlen;
271 // }
272 // Xlen = (Xlen1 + Xlen2) / 2.;
273 // Yrap = idline->Eval(Xlen, 0, "S");
274 // lumcalc = Calculate(kLumiere, Yrap, Xlen);
275 // //cout << niter << " : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
276 // niter++;
277 
278 // }
279 // // TMarker *mrk = new TMarker(Xlen,Yrap,2);
280 // // mrk->SetMarkerSize(2);
281 // // mrk->SetMarkerColor(kRed);
282 // // if(idgcsi->IsDrawn()) idgcsi->IsDrawn()->cd();
283 // // else {new TCanvas; idgcsi->Draw();}
284 // // mrk->Draw();
285 // }
286 // else {
287 // KVIDCutLine* imf_line = (KVIDCutLine*)idgcsi->GetCut("IMF_line");
288 // if (!imf_line) {
289 // //Warning("DeduceACQParameters","%s, No IMF_line defined",GetName());
290 // return;
291 // }
292 // else {
293 // Double_t Yrap1, Yrap2, Xlen1, Xlen2;
294 // imf_line->GetStartPoint(Xlen1, Yrap1);
295 // imf_line->GetEndPoint(Xlen2, Yrap2);
296 // Yrap1 += 10.; //au-dessus de la ligne fragment
297 // Yrap2 += 10.; //au-dessus de la ligne fragment
298 // Double_t lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
299 // Double_t lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
300 // if (lumiere < lumcalc1) {
301 // Xlen2 = Xlen1;
302 // Yrap2 = Yrap1;
303 // lumcalc2 = lumcalc1;
304 // Xlen1 = GetPedestal("L");
305 // Yrap1 = imf_line->Eval(Xlen1, 0, "S") + 10.;
306 // lumcalc1 = Calculate(kLumiere, Yrap1, Xlen1);
307 // //cout << "Extrapolating before start of IMF line" << endl;
308 // }
309 // else if (lumiere > lumcalc2) {
310 // Xlen1 = Xlen2;
311 // Yrap1 = Yrap2;
312 // lumcalc1 = lumcalc2;
313 // Xlen2 = 4095;
314 // Yrap2 = imf_line->Eval(Xlen2, 0, "S") + 10.;
315 // lumcalc2 = Calculate(kLumiere, Yrap2, Xlen2);
316 // //cout << "Extrapolating after end of IMF line" << endl;
317 // }
318 // //cout << "Xlen1=" << Xlen1 << " Yrap1="<<Yrap1<< " Lum_min = " << lumcalc1 << endl;
319 // //cout << "Xlen2=" << Xlen2 << " Yrap2=" << Yrap2<< " Lum_max = " << lumcalc2 << endl;
320 
321 // Xlen = (Xlen1 + Xlen2) / 2.;
322 // Yrap = imf_line->Eval(Xlen) + 10.;//au-dessus de la ligne fragment
323 // Double_t lumcalc = Calculate(kLumiere, Yrap, Xlen);
324 // //cout << "-1 : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
325 
326 // Int_t niter = 0;
327 // while (niter < 20 && TMath::Abs(lumcalc - lumiere) / lumiere > 0.01) {
328 // if (lumcalc > lumiere) {
329 // Xlen2 = Xlen;
330 // }
331 // else {
332 // Xlen1 = Xlen;
333 // }
334 // Xlen = (Xlen1 + Xlen2) / 2.;
335 // Yrap = imf_line->Eval(Xlen) + 10.;//au-dessus de la ligne fragment
336 // lumcalc = Calculate(kLumiere, Yrap, Xlen);
337 // //cout << niter << " : Rapide = " << Yrap << " Lente = " << Xlen << " lumcalc = " << lumcalc << endl;
338 // niter++;
339 // }
340 // if (niter == 20) {
341 // Xlen = -1;
342 // Yrap = -1;
343 // Mt = -1;
344 // }
345 // // TMarker *mrk = new TMarker(Xlen,Yrap,2);
346 // // mrk->SetMarkerSize(2);
347 // // mrk->SetMarkerColor(kBlue);
348 // // if(idgcsi->IsDrawn()) idgcsi->IsDrawn()->cd();
349 // // else {new TCanvas; idgcsi->Draw();}
350 // // mrk->Draw();
351 // }
352 
353 // }
354 // if (Xlen > 0) Xlen_sum += Xlen;
355 // if (Yrap > 0) Yrap_sum += Yrap;
356 // }
357 // GetACQParam("R")->SetData((UShort_t)Yrap_sum);
358 // GetACQParam("L")->SetData((UShort_t)Xlen_sum);
359 // GetACQParam("T")->SetData(Mt);
360 
361 }
362 
363 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
bool Bool_t
short Short_t
double Double_t
float Float_t
const char Option_t
char * Form(const char *fmt,...)
GANIL VXI/VME acquisition parameter.
Definition: KVACQParam.h:15
Float_t GetPedestal() const
Definition: KVACQParam.h:102
void SetLabel(const Char_t *lab)
Definition: KVBase.h:188
Calibrated output from detector.
CsI(Tl) scintillation detectors of the INDRA multidetector array.
Definition: KVCsI.h:15
virtual KVDetectorSignal * GetDetectorSignal(const TString &type) const
Definition: KVCsI.h:47
void DeduceACQParameters(KVEvent *, KVNumberList &)
Definition: KVCsI.cpp:175
virtual void Print(Option_t *option="") const
Definition: KVCsI.cpp:96
Double_t GetCorrectedEnergy(KVNucleus *, Double_t lum=-1., Bool_t transmission=kTRUE)
Definition: KVCsI.cpp:145
KVCsI()
Definition: KVCsI.cpp:31
void init()
initialise non-persistent pointers
Definition: KVCsI.cpp:14
void SetACQParams()
Definition: KVCsI.cpp:127
void SetAlThickness(Float_t thickAl)
Definition: KVCsI.cpp:70
virtual Double_t GetEnergy() const
Definition: KVDetector.h:308
Double_t GetDetectorSignalValue(const TString &type, const KVNameValueList &params="") const
Definition: KVDetector.h:426
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:769
KVList * fAbsorbers
list of absorbers making up the detector
Definition: KVDetector.h:200
KVList * fACQParams
list of raw data parameters read from coders
Definition: KVDetector.h:198
void SetActiveLayer(KVMaterial *actif)
Definition: KVDetector.h:244
Bool_t BelongsToUnidentifiedParticle() const
Definition: KVDetector.h:498
virtual void SetEnergy(Double_t e) const
Definition: KVDetector.h:320
virtual void Print(Option_t *option="") const
Definition: KVDetector.cpp:393
Base class container for multi-particle events.
Definition: KVEvent.h:176
Base class for detectors of INDRA array.
void SetType(const Char_t *t)
void AddACQParamType(const Char_t *type)
Description of physical materials used to construct detectors; interface to range tables.
Definition: KVMaterial.h:41
virtual void SetThickness(Double_t thick)
Definition: KVMaterial.cpp:354
KVMaterial()
default ctor
Definition: KVMaterial.cpp:70
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
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:83
virtual void AddFirst(TObject *obj)
virtual TObject * FindObject(const char *name) const
virtual const char * GetName() const
void AbstractMethod(const char *method) const
virtual void Info(const char *method, const char *msgfmt,...) const
const long double um
Definition: KVUnits.h:68
Int_t Nint(T x)