10 #ifdef __FastCaloSimStandAlone__
19 #include "GaudiKernel/SystemOfUnits.h"
29 m_linInterpol(0,
ROOT::Math::Interpolation::
kLINEAR) {}
32 Int_t
np,
const Double_t logEkin[],
const Double_t
response[]) {
44 Int_t
np,
const Double_t Ekin[],
const Double_t
response[]) {
45 std::vector<Double_t> logEkin(
np);
46 for (
int i = 0;
i <
np;
i++)
47 logEkin[
i] = TMath::Log(Ekin[
i]);
55 const float Ekin = truth->
Ekin();
78 <<
" and E=" << Einit);
80 ATH_MSG_DEBUG(
"set E=" << Emean <<
" for true Ekin=" << Ekin);
83 simulstate.
set_E(Emean);
113 bool shortprint =
opt.Index(
"short") >= 0;
115 TString optprint =
opt;
116 optprint.ReplaceAll(
"short",
"");
121 <<
"linInterpol N=" <<
m_logEkin.size() <<
" "
128 void TFCSEnergyInterpolationPiecewiseLinear::Streamer(TBuffer &R__b) {
130 if (R__b.IsReading()) {
132 R__b.ReadClassBuffer(TFCSEnergyInterpolationPiecewiseLinear::Class(),
this);
137 R__b.WriteClassBuffer(TFCSEnergyInterpolationPiecewiseLinear::Class(),
153 const int Graph0_n = 9;
154 Double_t Graph0_fx1001[Graph0_n] = {1.024, 2.048, 4.094, 8.192, 16.384,
155 32.768, 65.536, 131.072, 262.144};
157 for (
int i = 0;
i < Graph0_n; ++
i)
158 Graph0_fx1001[
i] *= 1000;
159 Double_t Graph0_fy1001[Graph0_n] = {0.6535402, 0.6571529, 0.6843001,
160 0.7172835, 0.7708416, 0.798819,
161 0.8187628, 0.8332745, 0.8443931};
162 grlinear =
new TGraph(Graph0_n, Graph0_fx1001, Graph0_fy1001);
165 TGraph *grdraw = (TGraph *)grlinear->Clone();
166 grdraw->SetMarkerColor(46);
167 grdraw->SetMarkerStyle(8);
170 "testTFCSEnergyInterpolationPieceWiseLinear",
171 "test TFCSEnergyInterpolationPiecewiseLinear");
173 test.set_Ekin_nominal(
174 0.5 * (grdraw->GetX()[0] + grdraw->GetX()[grdraw->GetN() - 1]));
175 test.set_Ekin_min(grdraw->GetX()[0]);
176 test.set_Ekin_max(grdraw->GetX()[grdraw->GetN() - 1]);
177 test.set_eta_nominal(0.225);
178 test.set_eta_min(0.2);
179 test.set_eta_max(0.25);
180 test.InitFromArrayInEkin(grlinear->GetN(), grlinear->GetX(),
187 TGraph *
gr =
new TGraph();
188 gr->SetNameTitle(
"testTFCSEnergyInterpolationPiecewiseLogX",
189 "test TFCSEnergyInterpolationPiecewiseLinear log x-axis");
190 gr->GetXaxis()->SetTitle(
"Ekin [MeV]");
191 gr->GetYaxis()->SetTitle(
"<E(reco)>/Ekin(true)");
194 for (
float Ekin =
test.Ekin_min() * 0.25; Ekin <=
test.Ekin_max() * 4;
197 truth->SetPxPyPzE(Ekin, 0, 0, Ekin);
198 simulstate->
set_E(Ekin);
202 gr->SetPoint(
ip, Ekin, simulstate->
E() / Ekin);
208 #if defined(__FastCaloSimStandAlone__)
209 TCanvas *
c =
new TCanvas(
gr->GetName(),
gr->GetTitle());
211 grdraw->Draw(
"Psame");