KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVINDRACsITotLightReconstructor.cpp
1//Created by KVClassFactory on Sun Oct 27 09:22:29 2019
2//Author: John Frankland,,,
3
4#include "KVINDRACsITotLightReconstructor.h"
5
7
8
9
17
18void KVINDRACsITotLightReconstructor::Calculate() const
19{
20 //Private method
21 //This function is called by GetLumiereTotale and GetTauZero, the return value depends
22 //on the value of 'mode' (kLumiere or kTau).
23 //The 'TauZero' in the code is the variable 'x'.
24 //In either case, if problems are encountered in the calculation, the value returned
25 //is zero and fLumTotStatus should give information on the problem (GetStatusLumiere).
26
27 //pedestal-corrected fast and slow components from raw data
28 Double_t rap_corr = fFast->GetValue();
29 Double_t len_corr = fSlow->GetValue();
30
31 if (rap_corr < 0 || len_corr < 0) {
32 fLumTotStatus = NEGATIVE_PEDESTAL_CORRECTED_VALUE;
33 const_cast<KVINDRACsITotLightReconstructor*>(this)->set_value(0);
34 return;
35 }
36 Double_t x;
38 Double_t x3;
39 Double_t bx;
40
41 Double_t dx;
42 Double_t rp = (len_corr / rap_corr) * (c1 / c2);
43 if (rp >= 1 && rap_corr <= 10) {
44 //calculation without correction for PM gain
45 x = 600;
46 x2 = TMath::Exp(-tau1 / x);
47 x3 = TMath::Exp(-tau2 / x);
48 bx = x2 - x3;
49 fLumTotStatus = NO_GAIN_CORRECTION;
50 }
51 else {
52 //iterative calculation of total light output
53 fLumTotStatus = CALCULATED_WITH_GAIN_CORRECTION;
54 x = p0 + p1 * rp;
55 x = x - 100;
56 Double_t at = 1. - TMath::Exp(-tau0 / tau);
57 at = tau * at;
58 Int_t niter = 0;
59 do {
60 niter++;
61 Double_t xx = x * x;
62 Double_t x1 = TMath::Exp(-tau0 / x);
63 x2 = TMath::Exp(-tau1 / x);
64 x3 = TMath::Exp(-tau2 / x);
65 Double_t ax = 1. - x1;
66 ax = ax - at / x;
67 bx = x2 - x3;
68 Double_t fx = bx / ax - rp;
69 Double_t apx = -tau0 * x1;
70 apx = (apx + at) / xx;
71 Double_t bpx = tau1 * x2 - tau2 * x3;
72 bpx = bpx / xx;
73 Double_t fpx = (bpx * ax - apx * bx) / (ax * ax);
74 dx = -fx / fpx;
75 x = x + dx;
76 }
77 while (TMath::Abs(dx / x) >= eps && niter <= 50);
78
79 if (niter > 50 || x <= tau) {
80 fLumTotStatus = CALCULATION_NOT_CONVERGED;
81 const_cast<KVINDRACsITotLightReconstructor*>(this)->set_value(0.0);
82 return;
83 }
84 }
85
86 const_cast<KVINDRACsITotLightReconstructor*>(this)->set_value(len_corr * (x - tau) / (x * bx));
87}
88
89
90
91
104
106{
107 //Status concerning the calculation of the total light output for
108 //this CsI detector. The possible values are
109 //(you can use the named constants for comparisons):
110 //
111 //~~~~~~~~~~~~~~~~~~~~~~~~~
112 // NOT_CALCULATED = 0
113 // CALCULATED_WITH_GAIN_CORRECTION = 1
114 // NO_GAIN_CORRECTION = 4
115 // NEGATIVE_PEDESTAL_CORRECTED_VALUE = 15
116 // CALCULATION_NOT_CONVERGED = 12
117 //~~~~~~~~~~~~~~~~~~~~~~~~~
118
119 return fLumTotStatus;
120}
121
122
123
124
129
131{
132 //Returns kTRUE if total light output has been successfully calculated
133 //for the CsI, either with (GetStatusLumiere()=CALCULATED_WITH_GAIN_CORRECTION)
134 //or without (GetStatusLumiere()=NO_GAIN_CORRECTION) iterative gain correction.
135
136 if (GetStatusLumiere() == CALCULATED_WITH_GAIN_CORRECTION
137 || GetStatusLumiere() == NO_GAIN_CORRECTION)
138 return kTRUE;
139
140 return kFALSE;
141}
142
143
144
153
155{
156 // Get status of last calculation of total light:
157 //
158 //~~~~~~~~~~~{.cpp}
159 //what = "LightIsGood" : returns either 1 (true) or 0 (false), as given by LightIsGood()
160 //
161 //what = "StatusLumiere" : returns value of GetStatusLumiere()
162 //~~~~~~~~~~~
163
164 if (what == "LightIsGood") return LightIsGood();
165 else if (what == "StatusLumiere") return GetStatusLumiere();
166 return -1;
167}
168
169
int Int_t
unsigned int UInt_t
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Calculation of light output from fast and slow components for INDRA CsI detectors.
Double_t GetValue(const KVNameValueList &="") const
UInt_t fLumTotStatus
pedestal corrected slow component, "L_PedCor"
return c1
Double_t x[n]
return c2
Double_t Exp(Double_t x)
Double_t Abs(Double_t d)
ClassImp(TPyArg)