4 #include "KVLightEnergyCsIFull.h"
20 frac = 0.5 *
log(rap) / deno;
28 Double_t KVLightEnergyCsIFull::dLightIntegralApprox(
double* x,
double* par)
38 double e_delta = par[3];
41 if (zfit == 2. && afit == 4.)
m = 3727.4;
42 if ((zfit == 1.) && (afit == 1.))
m = 938.;
50 beta =
sqrt(1. - m * m / ((e + m) * (e + m)));
52 fraction = GetDeltaFraction(
beta, beta_delta);
53 if (fraction > 1.) fraction = 1.;
54 if (fraction < 0.) fraction = 0.;
57 double se = sp_e(zfit, afit, e);
58 double sn = sp_n(zfit, afit, e);
59 double deno = 1. + ar * se + an * sn;
60 double deno2 = 1. + (1. - fraction) * ar * se + an * sn;
61 double raps = 1. + sn / se;
62 if (e <= e_delta * afit) {
63 if (se > 0. && raps > 0. && deno > 0.) dlum = (1. + an * sn) / (deno * raps);
66 if (se > 0. && raps > 0. && deno > 0.) {
67 dlum = (1. + an * sn) * (1. - fraction) / (deno2 * raps) + fraction / raps;
79 Double_t KVLightEnergyCsIFull::dLightIntegral(
double* x,
double* par)
86 if (ar < 1.e-8) ar = 0.;
88 double e_delta = par[3];
90 if (zfit == 1. && afit == 1.)
m = 938.2;
91 if (zfit == 1. && afit == 2.)
m = 1876.;
92 if (zfit == 1. && afit == 3.)
m = 2809.4;
93 if (zfit == 2. && afit == 3.)
m = 2809.4;
94 if (zfit == 2. && afit == 4.)
m = 3727.4;
95 if (zfit == 2. && afit == 6.)
m = 5606.6;
96 if (zfit == 2. && afit == 8.)
m = 7483.7;
101 beta =
sqrt(1. - m * m / ((e + m) * (e + m)));
102 fraction = GetDeltaFraction(
beta, beta_delta);
103 if (fraction > 1.) fraction = 1.;
104 if (fraction < 0.) fraction = 0.;
106 double se = sp_e(zfit, afit, e);
107 double sn = sp_n(zfit, afit, e);
109 if (se > 1.e-6) raps = 1. + sn / se;
110 double arg = 1. - ar * se / (1. + an * sn + ar * se);
112 double deno = 1. + an * sn + (1. - fraction) * ar * se;
114 if (e <= e_delta * afit) {
115 if (arg > 0. && raps * ar * se > 0.) dlum = -fact *
log(arg) / (raps * ar * se);
120 if (deno > 0.) arg = 1. - (1. - fraction) * ar * se / deno;
121 if (arg > 0. && ar * se > 0. && raps > 0.) dlum = -fact *
log(arg) / (raps * ar * se) + fraction / raps;
152 Double_t KVLightEnergyCsIFull::sp_e(
double z,
double a,
double e)
155 if (e < 1.e-4)
return 0.;
158 double a2_i = 0.6519;
163 double a7_i = 0.1043;
164 double a8_i = -0.1315;
165 double a9_i = -0.009175;
168 double a2_cs = 0.3923;
169 double a3_cs = 152.5;
170 double a4_cs = 8.354;
171 double a5_cs = 2.597;
172 double a6_cs = 4.671;
173 double a7_cs = 0.1136;
174 double a8_cs = -0.1298;
175 double a9_cs = -0.009078;
179 double ei = float(aref) *
e /
a * 1000.;
181 double shigh_cs = 0.;
187 slow_cs = a1_cs *
pow(ei, a2_cs);
188 shigh_cs = 1000.*a3_cs *
log(1. + 1000.*a4_cs / ei + a5_cs * ei / 1000.) / ei;
189 slow_i = a1_i *
pow(ei, a2_i);
190 shigh_i = 1000.*a3_i *
log(1. + 1000.*a4_i / ei + a5_i * ei / 1000.) / ei;
193 se_cs = fact * slow_cs * shigh_cs / (slow_cs + shigh_cs);
194 se_i = fact * slow_i * shigh_i / (slow_i + shigh_i);
197 se_cs =
exp(a6_cs + a7_cs *
log(1000. / ei) + a8_cs *
pow(
log(1000. / ei), 2.) + a9_cs *
pow(
log(1000. / ei), 3.));
198 se_i =
exp(a6_i + a7_i *
log(1000. / ei) + a8_i *
pow(
log(1000. / ei), 2.) + a9_i *
pow(
log(1000. / ei), 3.));
201 double seref = (127.*se_i + 133.*se_cs) / (127. + 133.);
203 se =
pow(
gamma(z, a, e) *
float(z) / (
gamma(zref, aref, ei) *
float(zref)), 2.) * seref;
205 if (z ==
int(zref)) se = seref;
206 if (z == 1.) se = seref / (
pow(
float(zref), 2.) *
gamma(zref, aref, ei));
208 se *= 6.022 / (10.*fAmed);
223 Double_t KVLightEnergyCsIFull::gamma(
double z,
double a,
double e)
227 g0 = (gamma_hbg(z, a, e) + gamma_ziegler(z, a, e)) / 2.;
231 if (e < 0.4 * a) g0 = gamma_ziegler(z, a, 0.4 * a);
239 Double_t KVLightEnergyCsIFull::gamma_ziegler(
double z,
double a,
double e)
243 if (z == 2. && a == 4.)
m = 3727.4;
244 double v0 = 7.2983824e-3;
245 double v =
sqrt(2.*ei / m);
246 double v1 = 0.886 * (
v /
v0) *
pow(z, -2. / 3.);
247 double v2 =
v1 + 0.038 *
sin(3.141592654 * v1 / 2.);
248 double xgamma = 1. - (1.034 - 0.17777 *
exp(-0.08114 * z)) *
exp(-v2);
256 Double_t KVLightEnergyCsIFull::gamma_hbg(
double z,
double a,
double e)
261 double d = 1.164 + 0.2319 *
exp(-0.0004302 * z2);
262 double x1 =
d +
b *
exp(-c * z);
263 double x2 = 8.144 + 0.09876 *
log(z2);
264 double x3 = 0.314 + 0.01072 *
log(z2);
265 double x4 = 0.5218 + 0.02521 *
log(z2);
286 double xgamma = 1. -
x1 *
exp(-x2 *
pow(e / a, x3) /
pow(z, x4));
287 if (xgamma > 1.) xgamma = 1.;
288 if (xgamma < 0.) xgamma = 0.;
297 Double_t KVLightEnergyCsIFull::sp_n(
double z,
double a,
double e)
300 if (e < 1.e-4)
return 0.;
302 double sn = 1.593 *
sqrt(ered);
303 if (ered >= 0.01 && ered <= 10.) sn = 1.7 *
sqrt(ered) * (
log(ered +
exp(1.)) / (1. + 6.8 * ered + 3.4 *
TMath::Power(ered, 1.5)));
304 if (ered > 10.) sn =
log(0.47 * ered) / (2.*ered);
312 sn = sn * 6.022 / (10.*fAmed);
333 Double_t KVLightEnergyCsIFull::GetLight(
double* x,
double* par)
346 #if ROOT_VERSION_CODE > ROOT_VERSION(5,99,01)
348 fDlight->SetParameters(par);
349 return par[4] + fDlight->Integral(emin, emax, epsilon);
351 return par[4] + fDlight->Integral(emin, emax, par, epsilon);
368 Double_t KVLightEnergyCsIFull::GetLightApprox(
double* x,
double* par)
395 return par[0] + lumcalc;
410 Double_t KVLightEnergyCsIFull::GetLightApproxSilicon(
double* x,
double* par)
430 Double_t si = a0 * (
E - raz2 *
log(1. + E / raz2) + raz2 *
log((E + raz2) /
431 (a3 * A + raz2)) - (1. - a2) * (1. - a2) * raz2 *
log((E + (1. - a2) * raz2) /
432 (a3 * A + (1. - a2) * raz2)));
452 void KVLightEnergyCsIFull::init()
459 switch (fLightFormula) {
461 fDlight =
new TF1(
"fDlight_CsI",
this, &KVLightEnergyCsIFull::dLightIntegral, 0., 10000., 4);
462 SetCalibFunction(
new TF1(
"fLight_CsI",
this, &KVLightEnergyCsIFull::GetLight, 0., 10000., 5));
467 fDlight =
new TF1(
"fDlight_CsI",
this, &KVLightEnergyCsIFull::dLightIntegralApprox, 0., 10000., 4);
468 SetCalibFunction(
new TF1(
"fLight_CsI",
this, &KVLightEnergyCsIFull::GetLight, 0., 10000., 5));
473 SetCalibFunction(
new TF1(
"fLight_CsI",
this, &KVLightEnergyCsIFull::GetLightApprox, 0., 10000., 5));
480 SetCalibFunction(
new TF1(
"fLight_CsI",
this, &KVLightEnergyCsIFull::GetLightApproxSilicon, 0., 10000., 5));
485 SetCalibFunction(
new TF1(
"fLight_CsI",
this, &KVLightEnergyCsIFull::GetLightApprox, 0., 10000., 5));
498 cout <<
"Formula : " << fLightFormula <<
" Type : " <<
GetType() << endl;
524 TString formula_types[] = {
"Exact",
"ApproxIntegral",
"Approx",
"ApproxSilicon"};
525 for (
int i = 0; i < 4; ++i) {
526 if (formula_types[i] == which) {
531 KVError::Error(
this,
"SetLightFormula",
"Unkown light formula type : %s", which.
Data());
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
virtual const Char_t * GetType() const
virtual void SetType(const Char_t *str)
void Print(Option_t *opt="") const override
Print a description of the calibration object, including a list of its parameters.
Exact calibration formula for CsI detectors.
void SetOptions(const KVNameValueList &opt) override
void Print(Option_t *opt="") const override
void SetLightFormula(Int_t form)
Light-energy calibration function for CsI detectors using a Fermi-function dependence on energy for d...
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
const Char_t * GetStringValue(const Char_t *name) const
const char * Data() const
Expr< UnaryOp< Sqrt< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > sqrt(const SMatrix< T, D, D2, R > &rhs)
double beta(double x, double y)
RVec< PromoteTypes< T0, T1 > > pow(const T0 &x, const RVec< T1 > &v)
RVec< PromoteType< T > > log(const RVec< T > &v)
RVec< PromoteType< T > > exp(const RVec< T > &v)
RVec< PromoteType< T > > sin(const RVec< T > &v)
void Error(UserClass p, const char *location, const char *va_(fmt),...)
Double_t Power(Double_t x, Double_t y)