25 const std::string &pathToModelParameters,
int intMinEta,
int intMaxEta) {
30 std::unique_ptr<TFile> modelParametersFile = std::unique_ptr<TFile>(
31 TFile::Open(pathToModelParameters.c_str(),
"READ"));
32 modelParametersFile->cd();
35 std::vector<std::string> parameterModelNames;
37 parameterModelNames = {
"a0",
"a1",
"a2",
"a3"};
39 parameterModelNames = {
"eta_s",
"phi_s"};
41 for (
auto ¶meterName : parameterModelNames) {
47 TGraph *modelParameterGraph = (TGraph *)
gDirectory->Get(
48 Form(
"photons/layer%d/m%d_m%d_%d_%d/%s",
layer, intMaxEta, intMinEta,
49 intMinEta, intMaxEta, parameterName.c_str()));
50 if (modelParameterGraph) {
53 modelParameterGraph->GetX(),
54 modelParameterGraph->GetY());
56 std::make_pair(parameterName, linModelInterpol));
58 ATH_MSG_DEBUG(
"[TFCSLateralShapeTuning] Could not find model parameter "
60 <<
layer <<
" minEta=" << intMinEta
61 <<
" maxEta=" << intMaxEta);
65 modelParametersFile->Close();
72 ATH_MSG_DEBUG(
"[TFCSLateralShapeTuning] Initializing data tuning model from "
73 "interpolation map.");
90 float maxScaling = 500;
93 const int pdgId = truth->
pdgid();
99 const double centerZ = hit.
center_z();
101 const float Ekin = truth->
Ekin();
105 ATH_MSG_DEBUG(
"[TFCSLateralShapeTuning] Initializing with pdgId="
106 << pdgId <<
", charge=" <<
charge <<
", Ekin=" << Ekin
107 <<
", caloSample=" <<
layer);
110 <<
" hit.eta=" << hit.
eta() <<
", hit.phi=" << hit.
phi()
111 <<
", hit.r=" << hit.
r());
124 std::abs(etaScaleFactor) < maxScaling ? etaScaleFactor : maxScaling;
126 std::abs(phiScaleFactor) < maxScaling ? phiScaleFactor : maxScaling;
128 ATH_MSG_DEBUG(
"[TFCSLateralShapeTuning] Applying 2D eta_s - eta_phi "
129 "scaling model with eta_s="
130 << etaScaleFactor <<
" and phi_s=" << phiScaleFactor);
132 double deltaEtaCorr = etaScaleFactor *
deltaEta;
133 double deltaPhiCorr = phiScaleFactor *
deltaPhi;
135 hit.
setEtaPhiZE(centerEta + deltaEtaCorr, centerPhi + deltaPhiCorr, centerZ,
150 std::abs(etaScaleFactor) < maxScaling ? etaScaleFactor : maxScaling;
152 ATH_MSG_DEBUG(
"[TFCSLateralShapeTuning] Applying eta_s series expansion "
156 double deltaEtaCorr = etaScaleFactor *
deltaEta;
166 double a0,
double a1,
double a2,
double a3,
double distToShowerCenter) {
168 double meanDistToShowerCentre = 0.0039;
170 1 +
a0 + a1 * distToShowerCenter / meanDistToShowerCentre +
171 a2 *
std::pow(distToShowerCenter / meanDistToShowerCentre, 2) +
172 a3 *
std::pow(distToShowerCenter / meanDistToShowerCentre, 3);