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