16 #ifdef __FastCaloSimStandAlone__
25 #include "GaudiKernel/SystemOfUnits.h"
37 Int_t
np, Double_t logEkin[], Double_t
response[],
const char *
opt,
38 Double_t valbeg, Double_t valend) {
39 TSpline3 initspline(GetName(), logEkin,
response,
np,
opt, valbeg, valend);
44 Int_t
np, Double_t Ekin[], Double_t
response[],
const char *
opt,
45 Double_t valbeg, Double_t valend) {
46 std::vector<Double_t> logEkin(
np);
47 for (
int i = 0;
i <
np; ++
i)
48 logEkin[
i] = TMath::Log(Ekin[
i]);
58 const float Ekin = truth->
Ekin();
60 Einit = simulstate.
E();
77 Emean =
m_spline.Eval(logEkin) * Einit;
83 <<
" and E=" << Einit);
87 simulstate.
set_E(Emean);
94 bool shortprint =
opt.Index(
"short") >= 0;
96 TString optprint =
opt;
97 optprint.ReplaceAll(
"short",
"");
102 <<
"Spline N=" <<
m_spline.GetNp() <<
" "
104 <<
"<=log(Ekin)<=" <<
m_spline.GetXmax() <<
" "
106 <<
"<=Ekin<=" << TMath::Exp(
m_spline.GetXmax()));
120 const int Graph0_n = 9;
121 Double_t Graph0_fx1001[Graph0_n] = {1.024, 2.048, 4.094, 8.192, 16.384,
122 32.768, 65.536, 131.072, 262.144};
123 for (
int i = 0;
i < Graph0_n; ++
i)
124 Graph0_fx1001[
i] *= 1000;
126 Double_t Graph0_fy1001[Graph0_n] = {0.6535402, 0.6571529, 0.6843001,
127 0.7172835, 0.7708416, 0.798819,
128 0.8187628, 0.8332745, 0.8443931};
129 grspline =
new TGraph(Graph0_n, Graph0_fx1001, Graph0_fy1001);
132 TGraph *grdraw = (TGraph *)grspline->Clone();
133 grdraw->SetMarkerColor(46);
134 grdraw->SetMarkerStyle(8);
137 "test TFCSEnergyInterpolationSpline");
139 test.set_Ekin_nominal(
140 0.5 * (grdraw->GetX()[0] + grdraw->GetX()[grdraw->GetN() - 1]));
141 test.set_Ekin_min(grdraw->GetX()[0]);
142 test.set_Ekin_max(grdraw->GetX()[grdraw->GetN() - 1]);
143 test.set_eta_nominal(0.225);
144 test.set_eta_min(0.2);
145 test.set_eta_max(0.25);
146 test.InitFromArrayInEkin(grspline->GetN(), grspline->GetX(), grspline->GetY(),
153 TGraph *
gr =
new TGraph();
154 gr->SetNameTitle(
"testTFCSEnergyInterpolationSplineLogX",
155 "test TFCSEnergyInterpolationSpline log x-axis");
156 gr->GetXaxis()->SetTitle(
"Ekin [MeV]");
157 gr->GetYaxis()->SetTitle(
"<E(reco)>/Ekin(true)");
160 for (
float Ekin =
test.Ekin_min() * 0.25; Ekin <=
test.Ekin_max() * 4;
163 truth->SetPxPyPzE(Ekin, 0, 0, Ekin);
164 simulstate->
set_E(Ekin);
168 gr->SetPoint(
ip, Ekin, simulstate->
E() / Ekin);
174 #if defined(__FastCaloSimStandAlone__)
175 TCanvas *
c =
new TCanvas(
gr->GetName(),
gr->GetTitle());
177 grdraw->Draw(
"Psame");