KaliVeda
Toolkit for HIC analysis
KVLightEnergyCsI.cpp
1 #include "KVLightEnergyCsI.h"
2 #include "TMath.h"
3 
5 
6 
7 //___________________________________________________________________________
8 
9 
10 
22 Double_t KVLightEnergyCsI::CalculLumiere(Double_t* x, Double_t* par)
23 {
24  //Calcul de la lumiere totale a partir de Z, A d'une particule et son energie
25  //
26  //~~~~~~~~~~~~~~~~~~
27  // x[0] = energie (MeV)
28  // par[0] = a1 : gain factor
29  // par[1] = a2 : nuclear & recombination quenching term
30  // par[2] = a3 : threshold (MeV/u) for delta-ray production
31  // par[3] = a4 : fractional energy loss removed by delta rays
32  //~~~~~~~~~~~~~~~~~~
33  //
34 
35  Double_t energie = x[0];
36  Double_t c1 = par[0];
37  Double_t c2 = Z * Z * A * par[1];
38  Double_t c3 = A * par[2];
39  Double_t c4 = par[3];
40  Double_t T = 8 * A;
41  Double_t c4_new = c4 / (1. + TMath::Exp((c3 - energie) / T));
42  Double_t c0 = c4 / (1. + TMath::Exp(c3 / T));
43 
44  Double_t lumcalc = c1 * energie;
45  if (c2 > 0.0) {
46  Double_t xm = -c1 * c0 * c2 * TMath::Log(c2 / (c2 + c3));
47  lumcalc = lumcalc - c1 * c2 * TMath::Log(1. + energie / c2) + c1 * c2 * c4_new * TMath::Log((energie + c2) / (c3 + c2)) + xm;
48  }
49 
50  return lumcalc;
51 }
52 
53 
54 
57 
59 {
60  // \param[in] make_func used by child class constructors to inhibit creation of internal calibration function
61 
62  SetType("LightEnergyCsI");
63  if (make_func) SetCalibFunction(new TF1("fLight_CsI", this, &KVLightEnergyCsI::CalculLumiere, 0., 10000., 4));
65 }
66 
67 
68 
78 
80 {
81  // Calculate the calibrated energy (in MeV) for a given total light output.
82  //
83  // The Z and A of the particle should be given as extra parameters:
84  //
85  //~~~~~~~~~~~~~~~{.cpp}
86  // Compute(light, "Z=3,A=7");
87  //~~~~~~~~~~~~~~~
88  //
89 
90  if (!IsAvailableFor(z_and_a)) {
91  Error("Compute", "[%s] Cannot compute energy for : ", GetName());
92  z_and_a.ls();
93  return -1;
94  }
95  Z = z_and_a.GetIntValue("Z");
96  A = z_and_a.GetIntValue("A");
97  return KVCalibrator::Compute(light, z_and_a);
98 }
99 
100 
101 
113 
115 {
116  // Given the calibrated (or simulated) energy in MeV,
117  // calculate the corresponding total light output according to the
118  // calibration parameters (useful for filtering simulations).
119  //
120  // The Z and A of the particle should be given as extra parameters:
121  //
122  //~~~~~~~~~~~~~~~{.cpp}
123  // Invert(light, "Z=3,A=7");
124  //~~~~~~~~~~~~~~~
125  //
126 
127  if (!IsAvailableFor(z_and_a)) {
128  Error("Compute", "Cannot compute without knowing Z and A of nucleus");
129  return -1;
130  }
131  Z = z_and_a.GetIntValue("Z");
132  A = z_and_a.GetIntValue("A");
133  return KVCalibrator::Invert(energy, z_and_a);
134 }
135 
136 
137 
140 
142 {
143  // \return kFALSE if parameter list does not contain "Z=..." and "A=..."
144  return z_and_a.HasIntParameter("Z") && z_and_a.HasIntParameter("A");
145 }
146 
147 
bool Bool_t
double Double_t
virtual void SetType(const Char_t *str)
Definition: KVBase.h:173
Base class for all detector calibrations.
Definition: KVCalibrator.h:99
void SetCalibFunction(TF1 *f)
Definition: KVCalibrator.h:112
void SetUseInverseFunction(Bool_t yes=kTRUE)
Definition: KVCalibrator.h:241
virtual Double_t Invert(Double_t x, const KVNameValueList &) const
Definition: KVCalibrator.h:191
virtual Double_t Compute(Double_t x, const KVNameValueList &) const
Definition: KVCalibrator.h:185
Light-energy calibration function for CsI detectors using a Fermi-function dependence on energy for d...
KVLightEnergyCsI(Bool_t make_func=kTRUE)
virtual Double_t Invert(Double_t, const KVNameValueList &z_and_a="") const
Double_t CalculLumiere(Double_t *, Double_t *)
virtual Double_t Compute(Double_t chan, const KVNameValueList &z_and_a="") const
Bool_t IsAvailableFor(const KVNameValueList &z_and_a) const
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
virtual void ls(Option_t *opt="") const
Int_t GetIntValue(const Char_t *name) const
Bool_t HasIntParameter(const Char_t *name) const
const char * GetName() const override
virtual void Error(const char *method, const char *msgfmt,...) const
return c1
Double_t x[n]
return c2
return c3
double T(double x)
c0
Double_t Exp(Double_t x)
Double_t Log(Double_t x)
ClassImp(TPyArg)