43const double GeV = 1000.;
60 "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
62 "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
63 return std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
92 folder =
"egammaMVACalib/v1";
95 folder =
"egammaMVACalib/v1";
101 folder =
"egammaMVACalib/offline/v3";
105 folder =
"egammaMVACalib/offline/v3_E4crack_bis";
114 folder =
"egammaMVACalib/offline/v4.0";
124 folder =
"egammaMVACalib/offline/v7";
128 folder =
"egammaMVACalib/offline/v9";
131 folder =
"egammaMVACalib/offline/v10";
142 std::string tune =
"";
147 tune =
"2011_alt_with_layer2";
161 tune =
"2012_alt_with_layer2";
165 tune =
"es2017_20.7_improved";
168 tune =
"es2017_20.7_final";
176 tune =
"es2017_21.0_v0";
179 tune =
"es2018_21.0_v0";
182 tune =
"es2022_22.0_Precision";
185 tune =
"es2022_22.0_Precision_v1";
188 tune =
"es2024_run3_extrapolate_v0";
193 return std::make_unique<egammaLayerRecalibTool>(tune, enableSacc);
289 const std::string&
name)
304 auto cluster =
acc.caloClusterAcc(
egamma)[0].value();
306 std::abs(
acc.clusterPhiAcc(cluster)) * 1E6 +
307 std::abs(
acc.clusterEtaAcc(cluster)) * 1E3 +
308 acc.eventNumberAcc(ei));
310 m_accessors(std::make_unique<Accessors>(*
this)) {
312 declareProperty(
"ESModel", m_ESModel =
"");
313 declareProperty(
"decorrelationModel", m_decorrelation_model_name =
"");
314 declareProperty(
"decorrelationModelScale",
315 m_decorrelation_model_scale_name =
"");
316 declareProperty(
"decorrelationModelResolution",
317 m_decorrelation_model_resolution_name =
"");
318 declareProperty(
"ResolutionType", m_ResolutionType =
"SigmaEff90");
319 declareProperty(
"varSF", m_varSF = 1.0);
320 declareProperty(
"doScaleCorrection", m_doScaleCorrection = AUTO);
321 declareProperty(
"doSmearing", m_doSmearing = AUTO);
322 declareProperty(
"useLayerCorrection", m_useLayerCorrection = AUTO);
323 declareProperty(
"usePSCorrection", m_usePSCorrection = AUTO);
324 declareProperty(
"useS12Correction", m_useS12Correction = AUTO);
325 declareProperty(
"useSaccCorrection", m_useSaccCorrection = AUTO);
326 declareProperty(
"useIntermoduleCorrection",
327 m_useIntermoduleCorrection = AUTO);
328 declareProperty(
"usePhiUniformCorrection", m_usePhiUniformCorrection = AUTO);
329 declareProperty(
"useCaloDistPhiUnifCorrection",
330 m_useCaloDistPhiUnifCorrection = AUTO);
331 declareProperty(
"useGainCorrection", m_useGainCorrection = AUTO);
332 declareProperty(
"useGainInterpolation", m_useGainInterpolation = AUTO);
333 declareProperty(
"doADCLinearityCorrection",
334 m_doADCLinearityCorrection = AUTO);
335 declareProperty(
"doLeakageCorrection", m_doLeakageCorrection = AUTO);
336 declareProperty(
"MVAfolder", m_MVAfolder =
"");
337 declareProperty(
"layerRecalibrationTune", m_layer_recalibration_tune =
"");
338 declareProperty(
"useEPCombination", m_use_ep_combination =
false);
339 declareProperty(
"useMVACalibration", m_use_mva_calibration = AUTO);
340 declareProperty(
"use_full_statistical_error",
341 m_use_full_statistical_error =
false);
342 declareProperty(
"use_temp_correction201215",
343 m_use_temp_correction201215 = AUTO);
344 declareProperty(
"use_uA2MeV_2015_first2weeks_correction",
345 m_use_uA2MeV_2015_first2weeks_correction = AUTO);
346 declareProperty(
"randomRunNumber", m_user_random_run_number = 0);
349 declareProperty(
"useFastSim", m_useFastSim = -1,
350 "This should be explicitly set by the user depending on the "
351 "data type (int)0=full sim, (int)1=fast sim");
353 "useAFII", m_use_AFII = -1,
354 "This is now deprecated. Kept for explicit error message for now");
355 declareProperty(
"decorateEmva", m_decorateEmva =
false,
"whether to decorate the eMVA value");
390 }
else if (
m_ESModel ==
"es2015PRE_res_improved") {
394 }
else if (
m_ESModel ==
"es2015cPRE_res_improved") {
396 }
else if (
m_ESModel ==
"es2015c_summer") {
400 }
else if (
m_ESModel ==
"es2016data_mc15c") {
402 }
else if (
m_ESModel ==
"es2016data_mc15c_summer") {
404 }
else if (
m_ESModel ==
"es2016data_mc15c_summer_improved") {
406 }
else if (
m_ESModel ==
"es2016data_mc15c_final") {
410 }
else if (
m_ESModel ==
"es2017_R21_PRE") {
412 }
else if (
m_ESModel ==
"es2017_R21_v0") {
414 }
else if (
m_ESModel ==
"es2017_R21_v1") {
416 }
else if (
m_ESModel ==
"es2017_R21_ofc0_v1") {
418 }
else if (
m_ESModel ==
"es2018_R21_v0") {
420 }
else if (
m_ESModel ==
"es2018_R21_v1") {
422 }
else if (
m_ESModel ==
"es2022_R22_PRE") {
424 }
else if (
m_ESModel ==
"es2023_R22_Run2_v0") {
426 }
else if (
m_ESModel ==
"es2023_R22_Run2_v1") {
428 }
else if (
m_ESModel ==
"es2024_Run3_ofc0_v0") {
430 }
else if (
m_ESModel ==
"es2024_Run3_v0") {
434 return StatusCode::FAILURE;
437 return StatusCode::FAILURE;
448 return StatusCode::FAILURE;
453 "Property useAFII is deprecated. It is now replaced with useFastSim, "
454 "which should be explicitly configured");
455 return StatusCode::FAILURE;
463 ATH_MSG_ERROR(
"Property useFastSim should be explicitly configured");
464 return StatusCode::FAILURE;
470 "Sample is FastSim but no AF3 calibration is supported with "
471 "MC23 pre-recommendations (es2022_R22_PRE and es2024_Run3_ofc0_v0). "
472 "Please swtich to Run3 consolidated recommendations (es2024_Run3_v0), "
473 "or get in touch with the EGamma CP group in case you are using this");
474 return StatusCode::FAILURE;
493 ATH_MSG_WARNING(
"no decorrelation model specified, assuming full model");
502 return StatusCode::FAILURE;
508 "flag decorrelation model ignored for scale decorrelation model");
519 ATH_MSG_FATAL(
"cannot understand the scale decorrelation model '"
521 return StatusCode::FAILURE;
535 return StatusCode::FAILURE;
539 "not information how to initialize the scale decorrelation model");
540 return StatusCode::FAILURE;
548 "flag decorrelation model ignored for resolution decorrelation "
556 ATH_MSG_FATAL(
"cannot understand the resolution decorrelation model '"
558 return StatusCode::FAILURE;
572 return StatusCode::FAILURE;
579 m_rootTool = std::make_unique<AtlasRoot::egammaEnergyCorrectionTool>();
582 return StatusCode::FAILURE;
591 "Using linear interpolation in the gain tool (uncertainties only)");
609 "egammaMVACalibTool/tool_mva_electron");
617 "egammaMVACalibTool/tool_mva_unconverted");
620 config_mva_unconverted.
setProperty(
"use_layer_corrected",
true));
624 this->msg().level()));
628 "egammaMVACalibTool/tool_mva_converted");
634 this->msg().level()));
638 std::ostringstream mva_service_name;
639 mva_service_name <<
"egammaMVASvc/service_mva_egamma_id"
640 << (
void const*)
this;
642 ATH_CHECK(config_mva_service.addPrivateTool(
"ElectronTool",
643 config_mva_electron));
644 ATH_CHECK(config_mva_service.addPrivateTool(
"UnconvertedPhotonTool",
645 config_mva_unconverted));
646 ATH_CHECK(config_mva_service.addPrivateTool(
"ConvertedPhotonTool",
647 config_mva_converted));
651 "egammaMVACalibTool/tool_mva_fwdelectron");
657 ATH_CHECK(config_mva_service.addPrivateTool(
"FwdElectronTool",
658 config_mva_fwdelectron));
660 config_mva_service.setPropertyFromString(
"folder",
m_MVAfolder);
662 config_mva_service.setProperty(
"OutputLevel", this->msg().level()));
675 ATH_MSG_INFO(
"Layer recalibration already applied at cell level");
680 ATH_MSG_DEBUG(
"initializing layer recalibration tool (if needed)");
714 m_rootTool->use_uA2MeV_2015_first2weeks_correction(
723 throw std::runtime_error(
"ep combination not supported yet");
752 "cannot instantiate gain tool for this model (you can only disable "
753 "the gain tool, but not enable it)");
757 "initializing gain tool for run2 final precision recommendations");
759 "Gain corrections required but Zee scales are derived without Gain, "
760 "will cause inconsistency!");
762 "ElectronPhotonFourMomentumCorrection/v29/"
763 "gain_uncertainty_specialRun.root");
765 gain_tool_run_2_filename,
false,
"GainCorrection",
778 "ElectronPhotonFourMomentumCorrection/v25/linearity_ADC.root");
784 m_ESModel +
" recommendations use ADC corrections for scale "
785 "derivation. Disabling the ADCLinearity flag will create "
799 "ElectronPhotonFourMomentumCorrection/v33/"
800 "egammaEnergyCorrectionData.root");
801 std::unique_ptr<TFile> fCorr(
802 TFile::Open(phiUnifCorrfileName.c_str(),
"READ"));
804 dynamic_cast<TH2*
>(fCorr->Get(
"CaloDistortionPhiUniformityCorrection/"
805 "es2023_R22_Run2_v0/h2DcorrPhiUnif")));
809 m_ESModel +
" recommendations use CaloDistPhiUnif for scale "
810 "derivation. Disabling the CaloDistPhiUnif flag will create "
851 return StatusCode::FAILURE;
854 ATH_MSG_ERROR(
"Cannot select both onlyElectrons and onlyPhotons");
855 return StatusCode::FAILURE;
860 resetAccessor (
m_accessors->electronTrackAcc, *
this,
"trackParticleLinks");
865 resetAccessor (
m_accessors->photonVertexAcc, *
this,
"vertexLinks");
868 resetAccessor (
m_accessors->decEmva, *
this,
"E_mva_only");
872 return StatusCode::SUCCESS;
890 if (
acc.photonVertexAcc(particle).size() > 0)
911 throw std::runtime_error(
"particle is not electron or photon");
919 const auto cl_etaCalo =
922 return m_rootTool->resolution(particle.e(), particle.caloCluster()->eta(),
923 cl_etaCalo, ptype, withCT,
928 double energy,
double cl_eta,
double cl_etaCalo,
930 return m_rootTool->resolution(energy, cl_eta, cl_etaCalo, ptype, withCT,
938 if (
evtStore()->retrieve(event_info,
"EventInfo").isFailure()) {
950 "Non-null pointer received. "
951 "There's a possible memory leak!");
954 output->makePrivateStore(input);
963 "Non-null pointer received. "
964 "There's a possible memory leak!");
967 output->makePrivateStore(input);
975 const double e = new_particle->
e();
984 const double e = new_particle->
e();
1000 ATH_MSG_DEBUG(
"applying energy recalibration before E0|E1|E2|E3 = "
1001 <<
acc.energyBEAcc (inputCluster, 0) <<
"|"
1002 <<
acc.energyBEAcc (inputCluster, 1) <<
"|"
1003 <<
acc.energyBEAcc (inputCluster, 2) <<
"|"
1004 <<
acc.energyBEAcc (inputCluster, 3));
1011 <<
acc.Es0Acc(inputCluster) <<
"|"
1012 <<
acc.Es1Acc(inputCluster) <<
"|"
1013 <<
acc.Es2Acc(inputCluster) <<
"|"
1014 <<
acc.Es3Acc(inputCluster) <<
"|");
1015 if (
acc.Es2Acc(inputCluster) == 0 and
acc.Es1Acc(inputCluster) == 0 and
1016 acc.Es3Acc(inputCluster) == 0 and
acc.Es0Acc(inputCluster) == 0 and
1017 (std::abs(
acc.etaAcc (input)) < 1.37 or (std::abs(
acc.etaAcc (input)) > 1.55 and std::abs(
acc.etaAcc (input)) < 2.47)))
1024 double energy =
acc.momAcc.e (input);
1028 if (
acc.authorAcc (input) ==
1035 unsigned int npv(0);
1036 for (
const auto *vtx : *pVtxCont) {
1041 gei.
acmu =
acc.actIntPerXingAcc(event_info);
1044 if (
acc.authorAcc (input) !=
1046 if (
m_MVACalibSvc->getEnergy(inputCluster.getXAODObject(), input.getXAODObject(), energy, gei)
1051 ATH_MSG_DEBUG(
"energy after MVA calibration = " << std::format(
"{:.2f}", energy));
1056 acc.decEmva(input) = energy;
1060 if (
acc.authorAcc (input) ==
1062 setPt(input, energy);
1069 const double etaden =
1071 ?
static_cast<const xAOD::Electron&
>(input.getXAODObject()).trackParticle()->eta()
1072 :
acc.clusterEtaAcc(inputCluster);
1073 energy *=
m_rootTool->applyMCCalibration(
acc.clusterEtaAcc(inputCluster),
1074 energy / cosh(etaden), ptype);
1076 << std::format(
"{:.2f}", energy));
1088 unsigned int runNumber_for_tool = 0;
1093 runNumber_for_tool =
acc.runNumberAcc(event_info);
1095 const auto cl_eta =
acc.clusterEtaAcc(inputCluster);
1096 double etaCalo = 0, phiCalo = 0;
1098 etaCalo =
acc.etaCaloAcc(inputCluster,
acc.authorAcc(input),
false);
1101 acc.phiCaloAcc(inputCluster,
acc.authorAcc(input),
false);
1110 << std::format(
"{:.2f}", energy));
1118 double etaC =
acc.clusterEtaAcc(inputCluster);
1119 double phiC =
acc.clusterPhiAcc(inputCluster);
1121 ieta = ieta == 0 ? 1
1126 iphi = iphi == 0 ? 1
1132 "energy after phi uniformity correction (for calo distortion) = "
1133 << std::format(
"{:.2f}", energy));
1140 << std::format(
"{:.2f}", energy));
1145 double et = energy / std::cosh(cl_eta);
1150 << std::format(
"{:.2f}", energy));
1155 const auto es2 =
acc.Es2Acc.isAvailable(inputCluster)
1156 ?
acc.Es2Acc(inputCluster)
1157 :
acc.energyBEAcc (inputCluster,2);
1158 if (!(std::abs(cl_eta) < 1.52 and std::abs(cl_eta) > 1.37) and
1159 std::abs(cl_eta) < 2.4)
1161 cl_eta, energy /
GeV, es2 /
GeV,
1164 double et = energy / std::cosh(cl_eta);
1167 energy /= (1 + corr);
1169 ATH_MSG_DEBUG(
"energy after gain correction = " << std::format(
"{:.2f}", energy));
1172 if (
acc.randomrunnumber_getter.isAvailable(event_info)) {
1173 runNumber_for_tool =
acc.randomrunnumber_getter(event_info);
1176 "Pileup tool not run before using "
1177 "ElectronPhotonFourMomentumCorrection! Assuming it is 2016. If you "
1178 "want to force a specific period set the property randomRunNumber "
1179 "of the tool, e.g. in the job option: "
1180 "tool.randomRunNumber = 123456 or "
1181 "tool.randomRunNumber = "
1182 "EgammaCalibrationAndSmearingToolRunNumbersExample.run_2016");
1190 const double eraw = ((
acc.Es0Acc.isAvailable(inputCluster)
1191 ?
acc.Es0Acc(inputCluster)
1192 :
acc.energyBEAcc(inputCluster,0)) +
1193 (
acc.Es1Acc.isAvailable(inputCluster)
1194 ?
acc.Es1Acc(inputCluster)
1195 :
acc.energyBEAcc(inputCluster,1)) +
1196 (
acc.Es2Acc.isAvailable(inputCluster)
1197 ?
acc.Es2Acc(inputCluster)
1198 :
acc.energyBEAcc(inputCluster,2)) +
1199 (
acc.Es3Acc.isAvailable(inputCluster)
1200 ?
acc.Es3Acc(inputCluster)
1201 :
acc.energyBEAcc(inputCluster,3)));
1213 runNumber_for_tool, dataType,
xAOD2ptype(input),
1214 inputCluster(
acc.clusterEtaAcc),
1215 inputCluster(
acc.clusterEtaBEAcc,2),
1216 acc.etaCaloAcc(inputCluster,
acc.authorAcc (input),
false), energy,
1217 acc.Es2Acc.isAvailable(inputCluster)
1218 ?
acc.Es2Acc(inputCluster)
1219 : inputCluster(
acc.energyBEAcc,2),
1224 ATH_MSG_DEBUG(
"energy after scale/systematic correction = " << std::format(
"{:.2f}", energy));
1227 setPt(input, energy);
1232 const double new_energy2 = energy * energy;
1234 const double m2 = m * m;
1235 const double p2 = new_energy2 > m2 ? new_energy2 - m2 : 0.;
1278 const float el_tracketa = eTrack->
eta();
1279 const float el_trackmomentum = eTrack->
pt() * cosh(el->eta());
1289 return sys.find(systematic) != sys.end();
1296 affecting_systematics.
insert(it.first);
1299 affecting_systematics.
insert(it.first);
1302 return affecting_systematics;
1446 "EG_SCALE_S12EXTRALASTETABINRUN2", +1)] =
1449 "EG_SCALE_S12EXTRALASTETABINRUN2", -1)] =
1455 ScaleDecorrelation::FULL_ETA_CORRELATED or
1494 ScaleDecorrelation::FULL_ETA_CORRELATED) {
1497#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1498 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1499 SysInfo{always, flagup}; \
1500 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1501 SysInfo{always, flagdown};
1502#include "ElectronPhotonFourMomentumCorrection/systematics_es2024_Run3_v0.def"
1507#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1508 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1509 SysInfo{always, flagup}; \
1510 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1511 SysInfo{always, flagdown};
1512#include "ElectronPhotonFourMomentumCorrection/systematics_S12_2022.def"
1540 "EG_SCALE_LARCALIB_EXTRA2015PRE", +1)] =
1543 "EG_SCALE_LARCALIB_EXTRA2015PRE", -1)] =
1554 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE", +1)] =
1557 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE", -1)] =
1564 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE", +1)] =
1567 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE", -1)] =
1644 ScaleDecorrelation::ONENP_PLUS_UNCONR) {
1649#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1650 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1651 SysInfo{always, flagup}; \
1652 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1653 SysInfo{always, flagdown};
1654#include "ElectronPhotonFourMomentumCorrection/systematics_1NPCOR_PLUS_UNCOR.def"
1664 "EG_SCALE_S12EXTRALASTETABINRUN2", +1)] =
1667 "EG_SCALE_S12EXTRALASTETABINRUN2", -1)] =
1672 using pairvector = std::vector<std::pair<double, double>>;
1673 const pairvector decorrelation_bins_BE = {{0., 1.45}, {1.52, 2.5}};
1674 const std::vector<double> decorrelation_edges_TWELVE = {
1675 0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4};
1676 std::vector<double> decorrelation_edges_MODULE = {
1677 0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.37, 1.52, 1.8};
1678 const std::vector<double> decorrelation_edges_MATERIAL = {0.0, 1.1, 1.5,
1680 std::vector<double> decorrelation_edges_S12_EXTRARUN3 = {
1683 std::vector<double> decorrelation_edges_S12;
1686 decorrelation_edges_S12.resize(5);
1687 decorrelation_edges_S12 = {0., 1.35, 1.5, 2.4, 2.5};
1691 decorrelation_edges_S12.resize(8);
1692 decorrelation_edges_S12 = {0., 0.6, 1.0, 1.35, 1.5, 1.8, 2.4, 2.5};
1695 decorrelation_edges_MODULE[7] = 1.4;
1696 decorrelation_edges_MODULE[8] = 1.5;
1701 decorrelation_edges_S12.resize(6);
1702 decorrelation_edges_S12 = {0., 0.6, 1.4, 1.5, 2.4, 2.5};
1716#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1717 if (bool(fullcorrelated)) { \
1718 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1719 SysInfo{always, flagup}; \
1720 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1721 SysInfo{always, flagdown}; \
1724 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1725 m_syst_description[CP::SystematicVariation( \
1726 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1727 m_syst_description[CP::SystematicVariation( \
1728 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1732#include "ElectronPhotonFourMomentumCorrection/systematics.def"
1736#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1737 if (bool(fullcorrelated)) { \
1738 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1739 SysInfo{always, flagup}; \
1740 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1741 SysInfo{always, flagdown}; \
1744 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1745 m_syst_description[CP::SystematicVariation( \
1746 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1747 m_syst_description[CP::SystematicVariation( \
1748 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1752#include "ElectronPhotonFourMomentumCorrection/systematics_S12_2022.def"
1755#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1756 if (bool(fullcorrelated)) { \
1757 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1758 SysInfo{always, flagup}; \
1759 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1760 SysInfo{always, flagdown}; \
1763 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1764 m_syst_description[CP::SystematicVariation( \
1765 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1766 m_syst_description[CP::SystematicVariation( \
1767 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1771#include "ElectronPhotonFourMomentumCorrection/systematics_es2024_Run3_v0.def"
1774#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1775 if (bool(fullcorrelated)) { \
1776 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1777 SysInfo{always, flagup}; \
1778 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1779 SysInfo{always, flagdown}; \
1782 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1783 m_syst_description[CP::SystematicVariation( \
1784 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1785 m_syst_description[CP::SystematicVariation( \
1786 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1790#include "ElectronPhotonFourMomentumCorrection/systematics_S12.def"
1797 const TAxis& axis_statistical_error(
m_rootTool->get_ZeeStat_eta_axis());
1798 for (
int ibin = 1; ibin <= axis_statistical_error.GetNbins(); ++ibin) {
1800 axis_statistical_error.GetBinLowEdge(ibin),
1801 axis_statistical_error.GetBinLowEdge(ibin + 1));
1803 "EG_SCALE_ZEESTAT__ETABIN" + std::to_string(i), +1)] =
1806 "EG_SCALE_ZEESTAT__ETABIN" + std::to_string(i), -1)] =
1823 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN0", +1)] =
1827 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN0", -1)] =
1831 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN1", +1)] =
1835 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN1", -1)] =
1839 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN2", +1)] =
1843 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN2", -1)] =
1855 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN0", +1)] =
1859 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN0", -1)] =
1863 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN1", +1)] =
1867 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN1", -1)] =
1875 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN0", +1)] =
1879 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN1", +1)] =
1883 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN0", -1)] =
1887 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN1", -1)] =
1984 "EG_SCALE_E4SCINTILLATOR__ETABIN0", +1)] =
1988 "EG_SCALE_E4SCINTILLATOR__ETABIN1", +1)] =
1992 "EG_SCALE_E4SCINTILLATOR__ETABIN2", +1)] =
1996 "EG_SCALE_E4SCINTILLATOR__ETABIN0", -1)] =
2000 "EG_SCALE_E4SCINTILLATOR__ETABIN1", -1)] =
2004 "EG_SCALE_E4SCINTILLATOR__ETABIN2", -1)] =
2009 "EG_SCALE_E4SCINTILLATOR__ETABIN3", +1)] =
2013 "EG_SCALE_E4SCINTILLATOR__ETABIN3", -1)] =
2036 "EG_RESOLUTION_ZSMEARING", -1)] =
2039 "EG_RESOLUTION_SAMPLINGTERM", +1)] =
2042 "EG_RESOLUTION_SAMPLINGTERM", -1)] =
2045 "EG_RESOLUTION_MATERIALID", +1)] =
2048 "EG_RESOLUTION_MATERIALID", -1)] =
2051 "EG_RESOLUTION_MATERIALCALO", +1)] =
2054 "EG_RESOLUTION_MATERIALCALO", -1)] =
2057 "EG_RESOLUTION_MATERIALGAP", +1)] =
2060 "EG_RESOLUTION_MATERIALGAP", -1)] =
2063 "EG_RESOLUTION_MATERIALCRYO", +1)] =
2066 "EG_RESOLUTION_MATERIALCRYO", -1)] =
2088 "EG_RESOLUTION_MATERIALIBL", +1)] =
2091 "EG_RESOLUTION_MATERIALIBL", -1)] =
2094 "EG_RESOLUTION_MATERIALPP0", +1)] =
2097 "EG_RESOLUTION_MATERIALPP0", -1)] =
2157 if (systConfig.
empty())
2158 return StatusCode::SUCCESS;
2163 bool first_scale =
true;
2164 bool first_resolution =
true;
2165 for (
const auto& it : systConfig) {
2168 if (not first_scale) {
2170 throw std::runtime_error(
"multiple scale variations not supported");
2172 first_scale =
false;
2179 if (not first_resolution) {
2180 ATH_MSG_ERROR(
"multiple resolution variations not supported");
2181 throw std::runtime_error(
2182 "multiple resolution variations not supported");
2184 first_resolution =
false;
2189 return StatusCode::SUCCESS;
2193 double Ecl,
double phi,
double eta)
const {
2199 double Ecl_corr = 0.;
2218 phi_mod = fmod(
phi, 2 *
pi / 16.) +
pi / 8.;
2220 phi_mod = fmod(
phi, 2 *
pi / 16.);
2223 if (std::abs(
eta) <= 1.37) {
2229 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 175.2759))) *
2230 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-189.3612))))));
2231 if (
phi < (-6 *
pi / 8) &&
phi > (-7 *
pi / 8))
2235 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 170.8305))) *
2236 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-233.3782))))));
2237 if (
phi < (-5 *
pi / 8) &&
phi > (-6 *
pi / 8))
2241 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 147.1451))) *
2242 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-139.3386))))));
2243 if (
phi < (-4 *
pi / 8) &&
phi > (-5 *
pi / 8))
2247 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 168.4644))) *
2248 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-246.2897))))));
2249 if (
phi < (-3 *
pi / 8) &&
phi > (-4 *
pi / 8))
2253 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 177.6703))) *
2254 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-198.3227))))));
2255 if (
phi < (-2 *
pi / 8) &&
phi > (-3 *
pi / 8))
2259 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 145.0693))) *
2260 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-242.1771))))));
2261 if (
phi < (-1 *
pi / 8) &&
phi > (-2 *
pi / 8))
2265 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 132.3303))) *
2266 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-166.1833))))));
2267 if (
phi < (0 *
pi / 8) &&
phi > (-1 *
pi / 8))
2271 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 127.6780))) *
2272 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-150.0700))))));
2273 if (
phi < (1 *
pi / 8) &&
phi > (0 *
pi / 8))
2277 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 172.0679))) *
2278 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-235.3293))))));
2279 if (
phi < (2 *
pi / 8) &&
phi > (1 *
pi / 8))
2283 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 190.3524))) *
2284 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-198.9400))))));
2285 if (
phi < (3 *
pi / 8) &&
phi > (2 *
pi / 8))
2289 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 158.0540))) *
2290 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-165.3893))))));
2291 if (
phi < (4 *
pi / 8) &&
phi > (3 *
pi / 8))
2295 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 162.2793))) *
2296 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-133.5131))))));
2297 if (
phi < (5 *
pi / 8) &&
phi > (4 *
pi / 8))
2301 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 180.5270))) *
2302 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-168.5074))))));
2303 if (
phi < (6 *
pi / 8) &&
phi > (5 *
pi / 8))
2307 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 128.2277))) *
2308 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-154.4455))))));
2309 if (
phi < (7 *
pi / 8) &&
phi > (6 *
pi / 8))
2313 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 192.1216))) *
2314 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-198.0727))))));
2315 if (
phi < (8 *
pi / 8) &&
phi > (7 *
pi / 8))
2319 ((1 / (1 + exp((phi_mod - 2 *
pi / 32.) * 199.1735))) *
2320 (1 / (1 + exp((phi_mod - 2 *
pi / 32.) * (-176.4056))))));
2335 DivInt = (
int)(
phi / ((2 *
pi) / 16.));
2336 double phi_mod =
phi - DivInt * (2 *
pi / 16.);
2343 if (std::abs(
eta) <= 1.4) {
2348 Ecl / (1 - 0.131 * ((1 / (1 + exp((phi_mod - 0.2) * 199.08))) *
2349 (1 / (1 + exp((phi_mod - 0.2) * (-130.36))))));
2355 Ecl / (1 - 0.0879 * ((1 / (1 + exp((phi_mod - 0.2) * 221.01))) *
2356 (1 / (1 + exp((phi_mod - 0.2) * (-149.51))))));
2361 Ecl / (1 - 0.0605 * ((1 / (1 + exp((phi_mod - 0.2) * 281.37))) *
2362 (1 / (1 + exp((phi_mod - 0.2) * (-170.29))))));
2365 if ((
phi < (-3 *
pi) / 4.) || (
phi >= (3 *
pi) / 4.)) {
2367 Ecl / (1 - 0.102 * ((1 / (1 + exp((phi_mod - 0.2) * 235.37))) *
2368 (1 / (1 + exp((phi_mod - 0.2) * (-219.04))))));
2383 constexpr double PI =
M_PI;
2389 if (
phi < (14 *
PI / 32.) &&
phi > (13 *
PI / 32.)) {
2391 }
else if (
phi < (13 *
PI / 32.) &&
phi > (12 *
PI / 32.)) {
2411 if (
phi < (-7 * 2 *
PI / 32.) &&
phi > (-8 * 2 *
PI / 32.)) {
2419 }
else if (
phi < (-4 * 2 *
PI / 32.) &&
phi > (-5 * 2 *
PI / 32.)) {
2425 if (
phi < (7 * 2 *
PI / 32.) &&
phi > (6 * 2 *
PI / 32.)) {
2431 if (
phi < (-9 * 2 *
PI / 32.) &&
phi > (-10 * 2 *
PI / 32.)) {
2433 }
else if (
phi < (-11 * 2 *
PI / 32.) &&
phi > (-12 * 2 *
PI / 32.)) {
2439 if (
phi < (-12 * 2 *
PI / 32.) &&
phi > (-13 * 2 *
PI / 32.)) {
2445 if (
phi < (-12 * 2 *
PI / 32.) &&
phi > (-13 * 2 *
PI / 32.)) {
2447 }
else if (
phi < (-8 * 2 *
PI / 32.) &&
phi > (-9 * 2 *
PI / 32.)) {
2453 if (
phi < (-9 * 2 *
PI / 32.) &&
phi > (-10 * 2 *
PI / 32.)) {
2459 if (
phi < (-6 * 2 *
PI / 32.) &&
phi > (-7 * 2 *
PI / 32.)) {
2465 if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2471 if (
phi < (-8 * 2 *
PI / 32.) &&
phi > (-9 * 2 *
PI / 32.)) {
2473 }
else if (
phi < (5 * 2 *
PI / 32.) &&
phi > (4 * 2 *
PI / 32.)) {
2475 }
else if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2477 }
else if (
phi < (10 * 2 *
PI / 32.) &&
phi > (9 * 2 *
PI / 32.)) {
2479 }
else if (
phi < (11 * 2 *
PI / 32.) &&
phi > (10 * 2 *
PI / 32.)) {
2490 }
else if (
phi < (-4 * 2 *
PI / 32.) &&
phi > (-5 * 2 *
PI / 32.)) {
2496 if (
phi < (7 * 2 *
PI / 32.) &&
phi > (6 * 2 *
PI / 32.)) {
2502 if (
phi < (-11 * 2 *
PI / 32.) &&
phi > (-12 * 2 *
PI / 32.)) {
2508 if (
phi < (10 * 2 *
PI / 32.) &&
phi > (9 * 2 *
PI / 32.)) {
2514 if (
phi < (-4 * 2 *
PI / 32.) &&
phi > (-5 * 2 *
PI / 32.)) {
2516 }
else if (
phi < (-6 * 2 *
PI / 32.) &&
phi > (-7 * 2 *
PI / 32.)) {
2522 if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2528 if (
phi < (-8 * 2 *
PI / 32.) &&
phi > (-9 * 2 *
PI / 32.)) {
2530 }
else if (
phi < (5 * 2 *
PI / 32.) &&
phi > (4 * 2 *
PI / 32.)) {
2532 }
else if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2534 }
else if (
phi < (10 * 2 *
PI / 32.) &&
phi > (9 * 2 *
PI / 32.)) {
2536 }
else if (
phi < (11 * 2 *
PI / 32.) &&
phi > (10 * 2 *
PI / 32.)) {
2545void EgammaCalibrationAndSmearingTool ::
2548 for (
auto egamma : egammas) {
2550 throw std::runtime_error (
"EgammaCalibrationAndSmearingTool::callEvents: apply failed");
2554void EgammaCalibrationAndSmearingTool ::
2558 for (
auto event : events) {
2559 auto eventInfo =
acc.m_eventHandle(event);
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
static const Attributes_t empty
ServiceHandle< StoreGateSvc > & evtStore()
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ Ok
The correction was done successfully.
This module implements the central registry for handling systematic uncertainties with CP tools.
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode registerSystematics(const IReentrantSystematicsTool &tool)
effects: register all the systematics from the tool
Class to wrap a set of SystematicVariations.
bool empty() const
returns: whether the set is empty
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
StatusCode setProperty(const std::string &name, const T &value)
set the given property
void setPropertyFromString(const std::string &name, const std::string &value)
set a given property from a string value
an object that can create a AsgService
virtual double e() const override
The total energy of the particle.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
virtual double e() const override final
The total energy of the particle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
void Scale(TH1 *h, double d=1)
Select isolated Photons, Electrons and Muons.
std::unique_ptr< egGain::GainTool > gainToolFactory(egEnergyCorr::ESModel model)
std::string egammaMVAToolFolder(egEnergyCorr::ESModel model)
bool is_after_run1(egEnergyCorr::ESModel model)
bool use_intermodule_correction(egEnergyCorr::ESModel model)
std::unique_ptr< egammaLayerRecalibTool > egammaLayerRecalibToolFactory(egEnergyCorr::ESModel model, int enableSacc)
bool use_phi_uniform_correction(egEnergyCorr::ESModel model)
ObjectId< ContainerId::cluster > ClusterId
ObjectId< ContainerId::egamma > EgammaId
ObjectRange< ContainerId::eventContext > EventContextRange
ObjectRange< ContainerId::mutableEgamma > MutableEgammaRange
ObjectId< ContainerId::mutableEgamma > MutableEgammaId
ObjectId< ContainerId::eventInfo > EventInfoId
@ LArCalibExtra2015PreDown
@ S12ExtraLastEtaBinRun2Down
@ LArTemperature2016PreDown
@ LArTemperature2015PreUp
@ S12ExtraLastEtaBinRun2Up
@ LArTemperature2015PreDown
@ LArTemperature2016PreUp
@ es2015cPRE_res_improved
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Egamma_v1 Egamma
Definition of the current "egamma version".
float get_eta_calo(const xAOD::CaloCluster &cluster, int author, bool do_throw=false)
Photon_v1 Photon
Definition of the current "egamma version".
setBGCode setTAP setLVL2ErrorBits bool
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
Electron_v1 Electron
Definition of the current "egamma version".
A structure holding some global event information.