42 const double GeV = 1000.;
59 "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
61 "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
62 return std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
90 folder =
"egammaMVACalib/v1";
93 folder =
"egammaMVACalib/v1";
99 folder =
"egammaMVACalib/offline/v3";
103 folder =
"egammaMVACalib/offline/v3_E4crack_bis";
112 folder =
"egammaMVACalib/offline/v4.0";
122 folder =
"egammaMVACalib/offline/v7";
126 folder =
"egammaMVACalib/offline/v9";
137 std::string
tune =
"";
142 tune =
"2011_alt_with_layer2";
156 tune =
"2012_alt_with_layer2";
160 tune =
"es2017_20.7_improved";
163 tune =
"es2017_20.7_final";
171 tune =
"es2017_21.0_v0";
174 tune =
"es2018_21.0_v0";
177 tune =
"es2022_22.0_Precision";
180 tune =
"es2022_22.0_Precision_v1";
185 return std::make_unique<egammaLayerRecalibTool>(
tune, enableSacc);
279 const std::string&
name)
283 m_use_mapping_correction(false),
286 m_currentResolutionVariation_MC(
egEnergyCorr::Resolution::Nominal),
287 m_currentResolutionVariation_data(
egEnergyCorr::Resolution::None),
294 std::abs(
egamma.caloCluster()->
phi()) * 1E6 +
295 std::abs(
egamma.caloCluster()->
eta()) * 1E3 +
299 declareProperty(
"ESModel", m_ESModel =
"");
300 declareProperty(
"decorrelationModel", m_decorrelation_model_name =
"");
301 declareProperty(
"decorrelationModelScale",
302 m_decorrelation_model_scale_name =
"");
303 declareProperty(
"decorrelationModelResolution",
304 m_decorrelation_model_resolution_name =
"");
305 declareProperty(
"ResolutionType", m_ResolutionType =
"SigmaEff90");
306 declareProperty(
"varSF", m_varSF = 1.0);
307 declareProperty(
"doScaleCorrection", m_doScaleCorrection = AUTO);
308 declareProperty(
"doSmearing", m_doSmearing = AUTO);
309 declareProperty(
"useLayerCorrection", m_useLayerCorrection = AUTO);
310 declareProperty(
"usePSCorrection", m_usePSCorrection = AUTO);
311 declareProperty(
"useS12Correction", m_useS12Correction = AUTO);
312 declareProperty(
"useSaccCorrection", m_useSaccCorrection = AUTO);
313 declareProperty(
"useIntermoduleCorrection",
314 m_useIntermoduleCorrection = AUTO);
315 declareProperty(
"usePhiUniformCorrection", m_usePhiUniformCorrection = AUTO);
316 declareProperty(
"useCaloDistPhiUnifCorrection",
317 m_useCaloDistPhiUnifCorrection = AUTO);
318 declareProperty(
"useGainCorrection", m_useGainCorrection = AUTO);
319 declareProperty(
"useGainInterpolation", m_useGainInterpolation = AUTO);
320 declareProperty(
"doADCLinearityCorrection",
321 m_doADCLinearityCorrection = AUTO);
322 declareProperty(
"doLeakageCorrection", m_doLeakageCorrection = AUTO);
323 declareProperty(
"MVAfolder", m_MVAfolder =
"");
324 declareProperty(
"layerRecalibrationTune", m_layer_recalibration_tune =
"");
325 declareProperty(
"useEPCombination", m_use_ep_combination =
false);
326 declareProperty(
"useMVACalibration", m_use_mva_calibration = AUTO);
327 declareProperty(
"use_full_statistical_error",
328 m_use_full_statistical_error =
false);
329 declareProperty(
"use_temp_correction201215",
330 m_use_temp_correction201215 = AUTO);
331 declareProperty(
"use_uA2MeV_2015_first2weeks_correction",
332 m_use_uA2MeV_2015_first2weeks_correction = AUTO);
333 declareProperty(
"randomRunNumber", m_user_random_run_number = 0);
336 declareProperty(
"useFastSim", m_useFastSim = -1,
337 "This should be explicitly set by the user depending on the "
338 "data type (int)0=full sim, (int)1=fast sim");
340 "useAFII", m_use_AFII = -1,
341 "This is now deprecated. Kept for explicit error message for now");
342 declareProperty(
"decorateEmva", m_decorateEmva =
false,
"whether to decorate the eMVA value");
377 }
else if (
m_ESModel ==
"es2015PRE_res_improved") {
381 }
else if (
m_ESModel ==
"es2015cPRE_res_improved") {
383 }
else if (
m_ESModel ==
"es2015c_summer") {
387 }
else if (
m_ESModel ==
"es2016data_mc15c") {
389 }
else if (
m_ESModel ==
"es2016data_mc15c_summer") {
391 }
else if (
m_ESModel ==
"es2016data_mc15c_summer_improved") {
393 }
else if (
m_ESModel ==
"es2016data_mc15c_final") {
397 }
else if (
m_ESModel ==
"es2017_R21_PRE") {
399 }
else if (
m_ESModel ==
"es2017_R21_v0") {
401 }
else if (
m_ESModel ==
"es2017_R21_v1") {
403 }
else if (
m_ESModel ==
"es2017_R21_ofc0_v1") {
405 }
else if (
m_ESModel ==
"es2018_R21_v0") {
407 }
else if (
m_ESModel ==
"es2018_R21_v1") {
409 }
else if (
m_ESModel ==
"es2022_R22_PRE") {
411 }
else if (
m_ESModel ==
"es2023_R22_Run2_v0") {
413 }
else if (
m_ESModel ==
"es2023_R22_Run2_v1") {
415 }
else if (
m_ESModel ==
"es2024_Run3_ofc0_v0") {
419 return StatusCode::FAILURE;
422 return StatusCode::FAILURE;
433 return StatusCode::FAILURE;
438 "Property useAFII is deprecated. It is now replaced with useFastSim, "
439 "which should be explicitly configured");
440 return StatusCode::FAILURE;
448 ATH_MSG_ERROR(
"Property useFastSim should be explicitly configured");
449 return StatusCode::FAILURE;
455 "Sample is FastSim but no AF3 calibration is available yet with "
456 "MC23 recommendations. Please get in touch with the EGamma "
457 "CP group in case you are using this");
458 return StatusCode::FAILURE;
477 ATH_MSG_WARNING(
"no decorrelation model specified, assuming full model");
486 return StatusCode::FAILURE;
492 "flag decorrelation model ignored for scale decorrelation model");
503 ATH_MSG_FATAL(
"cannot understand the scale decorrelation model '"
505 return StatusCode::FAILURE;
519 return StatusCode::FAILURE;
523 "not information how to initialize the scale decorrelation model");
524 return StatusCode::FAILURE;
532 "flag decorrelation model ignored for resolution decorrelation "
540 ATH_MSG_FATAL(
"cannot understand the resolution decorrelation model '"
542 return StatusCode::FAILURE;
556 return StatusCode::FAILURE;
563 m_rootTool = std::make_unique<AtlasRoot::egammaEnergyCorrectionTool>();
566 return StatusCode::FAILURE;
573 "Using linear interpolation in the gain tool (uncertainties only)");
591 "egammaMVACalibTool/tool_mva_electron");
600 "egammaMVACalibTool/tool_mva_unconverted");
603 config_mva_unconverted.
setProperty(
"use_layer_corrected",
true));
609 "egammaMVACalibTool/tool_mva_converted");
617 std::ostringstream mva_service_name;
618 mva_service_name <<
"egammaMVASvc/service_mva_egamma_id"
619 << (
void const*)
this;
621 ATH_CHECK(config_mva_service.addPrivateTool(
"ElectronTool",
622 config_mva_electron));
623 ATH_CHECK(config_mva_service.addPrivateTool(
"UnconvertedPhotonTool",
624 config_mva_unconverted));
625 ATH_CHECK(config_mva_service.addPrivateTool(
"ConvertedPhotonTool",
626 config_mva_converted));
627 config_mva_service.setPropertyFromString(
"folder",
m_MVAfolder);
629 config_mva_service.setProperty(
"OutputLevel", this->msg().level()));
642 ATH_MSG_INFO(
"Layer recalibration already applied at cell level");
647 ATH_MSG_DEBUG(
"initializing layer recalibration tool (if needed)");
681 m_rootTool->use_uA2MeV_2015_first2weeks_correction(
690 throw std::runtime_error(
"ep combination not supported yet");
717 "cannot instantiate gain tool for this model (you can only disable "
718 "the gain tool, but not enable it)");
721 "initializing gain tool for run2 final precision recommendations");
723 "Gain corrections required but Zee scales are derived without Gain, "
724 "will cause inconsistency!");
726 "ElectronPhotonFourMomentumCorrection/v29/"
727 "gain_uncertainty_specialRun.root");
729 gain_tool_run_2_filename,
false,
"GainCorrection",
741 "ElectronPhotonFourMomentumCorrection/v25/linearity_ADC.root");
747 m_ESModel +
" recommendations use ADC corrections for scale "
748 "derivation. Disabling the ADCLinearity flag will create "
762 "ElectronPhotonFourMomentumCorrection/v33/"
763 "egammaEnergyCorrectionData.root");
764 std::unique_ptr<TFile> fCorr(
765 TFile::Open(phiUnifCorrfileName.c_str(),
"READ"));
767 dynamic_cast<TH2*
>(fCorr->Get(
"CaloDistortionPhiUniformityCorrection/"
768 "es2023_R22_Run2_v0/h2DcorrPhiUnif")));
772 m_ESModel +
" recommendations use CaloDistPhiUnif for scale "
773 "derivation. Disabling the CaloDistPhiUnif flag will create "
813 if (
registry.registerSystematics(*
this) != StatusCode::SUCCESS)
814 return StatusCode::FAILURE;
816 return StatusCode::SUCCESS;
834 throw std::runtime_error(
"particle is not electron or photon");
842 const auto cl_etaCalo =
845 return m_rootTool->resolution(particle.e(), particle.caloCluster()->eta(),
846 cl_etaCalo, ptype, withCT,
851 double energy,
double cl_eta,
double cl_etaCalo,
873 "Non-null pointer received. "
874 "There's a possible memory leak!");
877 output->makePrivateStore(input);
886 "Non-null pointer received. "
887 "There's a possible memory leak!");
890 output->makePrivateStore(input);
898 const double e = new_particle->
e();
907 const double e = new_particle->
e();
924 ATH_MSG_DEBUG(
"applying energy recalibration before E0|E1|E2|E3 = "
925 << input.caloCluster()->energyBE(0) <<
"|"
926 << input.caloCluster()->energyBE(1) <<
"|"
927 << input.caloCluster()->energyBE(2) <<
"|"
928 << input.caloCluster()->energyBE(3));
934 ATH_MSG_DEBUG(
"eta|phi = " << input.eta() <<
"|" << input.phi());
937 << Es0Acc(*input.caloCluster()) <<
"|"
938 << Es1Acc(*input.caloCluster()) <<
"|"
939 << Es2Acc(*input.caloCluster()) <<
"|"
940 << Es3Acc(*input.caloCluster()) <<
"|");
941 if (Es2Acc(*input.caloCluster()) == 0 and
942 Es1Acc(*input.caloCluster()) == 0 and
943 Es3Acc(*input.caloCluster()) == 0 and
944 Es0Acc(*input.caloCluster()) == 0 and
945 (std::abs(input.eta()) < 1.37 or
946 (std::abs(input.eta()) > 1.55 and std::abs(input.eta()) < 2.47))) {
955 if (input.author() !=
977 const double etaden =
980 : input.caloCluster()->eta();
982 energy / cosh(etaden), ptype);
996 unsigned int runNumber_for_tool = 0;
1001 runNumber_for_tool = event_info.
runNumber();
1003 const auto cl_eta = input.caloCluster()->eta();
1004 double etaCalo = 0, phiCalo = 0;
1024 double etaC = input.caloCluster()->eta();
1025 double phiC = input.caloCluster()->phi();
1027 ieta = ieta == 0 ? 1
1032 iphi = iphi == 0 ? 1
1038 "energy after phi uniformity correction (for calo distortion) = "
1051 double et =
energy / std::cosh(cl_eta);
1061 const auto es2 = Es2Acc.
isAvailable(*input.caloCluster())
1062 ? Es2Acc(*input.caloCluster())
1063 : input.caloCluster()->energyBE(2);
1064 if (!(std::abs(cl_eta) < 1.52 and std::abs(cl_eta) > 1.37) and
1065 std::abs(cl_eta) < 2.4)
1070 double et =
energy / std::cosh(cl_eta);
1079 randomrunnumber_getter(
"RandomRunNumber");
1080 if (randomrunnumber_getter.
isAvailable(event_info)) {
1081 runNumber_for_tool = randomrunnumber_getter(event_info);
1084 "Pileup tool not run before using "
1085 "ElectronPhotonFourMomentumCorrection! Assuming it is 2016. If you "
1086 "want to force a specific period set the property randomRunNumber "
1087 "of the tool, e.g. in the job option: "
1088 "tool.randomRunNumber = 123456 or "
1089 "tool.randomRunNumber = "
1090 "EgammaCalibrationAndSmearingToolRunNumbersExample.run_2016");
1098 const double eraw = ((Es0Acc.
isAvailable(*input.caloCluster())
1099 ? Es0Acc(*input.caloCluster())
1100 : input.caloCluster()->energyBE(0)) +
1102 ? Es1Acc(*input.caloCluster())
1103 : input.caloCluster()->energyBE(1)) +
1105 ? Es2Acc(*input.caloCluster())
1106 : input.caloCluster()->energyBE(2)) +
1108 ? Es3Acc(*input.caloCluster())
1109 : input.caloCluster()->energyBE(3)));
1122 input.caloCluster()->eta(),
1123 input.caloCluster()->etaBE(2),
1126 ? Es2Acc(*input.caloCluster())
1127 : input.caloCluster()->energyBE(2),
1136 const double m2 = input.m() * input.m();
1137 const double p2 = new_energy2 >
m2 ? new_energy2 -
m2 : 0.;
1138 input.setPt(sqrt(
p2) / cosh(input.eta()));
1179 const float el_tracketa = eTrack->
eta();
1180 const float el_trackmomentum = eTrack->
pt() * cosh(
el->eta());
1190 return sys.find(systematic) !=
sys.end();
1197 affecting_systematics.
insert(
it.first);
1200 affecting_systematics.
insert(
it.first);
1203 return affecting_systematics;
1342 "EG_SCALE_S12EXTRALASTETABINRUN2", +1)] =
1345 "EG_SCALE_S12EXTRALASTETABINRUN2", -1)] =
1351 ScaleDecorrelation::FULL_ETA_CORRELATED or
1391 ScaleDecorrelation::FULL_ETA_CORRELATED) {
1395 #define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1396 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1397 SysInfo{always, flagup}; \
1398 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1399 SysInfo{always, flagdown};
1400 #include "ElectronPhotonFourMomentumCorrection/systematics_S12_2022.def"
1426 "EG_SCALE_LARCALIB_EXTRA2015PRE", +1)] =
1429 "EG_SCALE_LARCALIB_EXTRA2015PRE", -1)] =
1440 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE", +1)] =
1443 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE", -1)] =
1450 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE", +1)] =
1453 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE", -1)] =
1527 ScaleDecorrelation::ONENP_PLUS_UNCONR) {
1532 #define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1533 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1534 SysInfo{always, flagup}; \
1535 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1536 SysInfo{always, flagdown};
1537 #include "ElectronPhotonFourMomentumCorrection/systematics_1NPCOR_PLUS_UNCOR.def"
1547 "EG_SCALE_S12EXTRALASTETABINRUN2", +1)] =
1550 "EG_SCALE_S12EXTRALASTETABINRUN2", -1)] =
1555 using pairvector = std::vector<std::pair<double, double>>;
1556 const pairvector decorrelation_bins_BE = {{0., 1.45}, {1.52, 2.5}};
1557 const std::vector<double> decorrelation_edges_TWELVE = {
1558 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};
1559 std::vector<double> decorrelation_edges_MODULE = {
1560 0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.37, 1.52, 1.8};
1561 const std::vector<double> decorrelation_edges_MATERIAL = {0.0, 1.1, 1.5,
1564 std::vector<double> decorrelation_edges_S12;
1567 decorrelation_edges_S12.resize(5);
1568 decorrelation_edges_S12 = {0., 1.35, 1.5, 2.4, 2.5};
1571 decorrelation_edges_S12.resize(8);
1572 decorrelation_edges_S12 = {0., 0.6, 1.0, 1.35, 1.5, 1.8, 2.4, 2.5};
1575 decorrelation_edges_MODULE[7] = 1.4;
1576 decorrelation_edges_MODULE[8] = 1.5;
1581 decorrelation_edges_S12.resize(6);
1582 decorrelation_edges_S12 = {0., 0.6, 1.4, 1.5, 2.4, 2.5};
1595 #define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1596 if (bool(fullcorrelated)) { \
1597 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1598 SysInfo{always, flagup}; \
1599 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1600 SysInfo{always, flagdown}; \
1603 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1604 m_syst_description[CP::SystematicVariation( \
1605 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1606 m_syst_description[CP::SystematicVariation( \
1607 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1611 #include "ElectronPhotonFourMomentumCorrection/systematics.def"
1615 #define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1616 if (bool(fullcorrelated)) { \
1617 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1618 SysInfo{always, flagup}; \
1619 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1620 SysInfo{always, flagdown}; \
1623 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1624 m_syst_description[CP::SystematicVariation( \
1625 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1626 m_syst_description[CP::SystematicVariation( \
1627 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1631 #include "ElectronPhotonFourMomentumCorrection/systematics_S12_2022.def"
1634 #define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1635 if (bool(fullcorrelated)) { \
1636 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1637 SysInfo{always, flagup}; \
1638 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1639 SysInfo{always, flagdown}; \
1642 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1643 m_syst_description[CP::SystematicVariation( \
1644 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1645 m_syst_description[CP::SystematicVariation( \
1646 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1650 #include "ElectronPhotonFourMomentumCorrection/systematics_S12.def"
1657 const TAxis& axis_statistical_error(
m_rootTool->get_ZeeStat_eta_axis());
1658 for (
int ibin = 1; ibin <= axis_statistical_error.GetNbins(); ++ibin) {
1660 axis_statistical_error.GetBinLowEdge(ibin),
1661 axis_statistical_error.GetBinLowEdge(ibin + 1));
1683 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN0", +1)] =
1687 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN0", -1)] =
1691 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN1", +1)] =
1695 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN1", -1)] =
1699 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN2", +1)] =
1703 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN2", -1)] =
1715 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN0", +1)] =
1719 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN0", -1)] =
1723 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN1", +1)] =
1727 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN1", -1)] =
1735 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN0", +1)] =
1739 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN1", +1)] =
1743 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN0", -1)] =
1747 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN1", -1)] =
1841 "EG_SCALE_E4SCINTILLATOR__ETABIN0", +1)] =
1845 "EG_SCALE_E4SCINTILLATOR__ETABIN1", +1)] =
1849 "EG_SCALE_E4SCINTILLATOR__ETABIN2", +1)] =
1853 "EG_SCALE_E4SCINTILLATOR__ETABIN0", -1)] =
1857 "EG_SCALE_E4SCINTILLATOR__ETABIN1", -1)] =
1861 "EG_SCALE_E4SCINTILLATOR__ETABIN2", -1)] =
1880 "EG_RESOLUTION_ZSMEARING", -1)] =
1883 "EG_RESOLUTION_SAMPLINGTERM", +1)] =
1886 "EG_RESOLUTION_SAMPLINGTERM", -1)] =
1889 "EG_RESOLUTION_MATERIALID", +1)] =
1892 "EG_RESOLUTION_MATERIALID", -1)] =
1895 "EG_RESOLUTION_MATERIALCALO", +1)] =
1898 "EG_RESOLUTION_MATERIALCALO", -1)] =
1901 "EG_RESOLUTION_MATERIALGAP", +1)] =
1904 "EG_RESOLUTION_MATERIALGAP", -1)] =
1907 "EG_RESOLUTION_MATERIALCRYO", +1)] =
1910 "EG_RESOLUTION_MATERIALCRYO", -1)] =
1931 "EG_RESOLUTION_MATERIALIBL", +1)] =
1934 "EG_RESOLUTION_MATERIALIBL", -1)] =
1937 "EG_RESOLUTION_MATERIALPP0", +1)] =
1940 "EG_RESOLUTION_MATERIALPP0", -1)] =
1999 if (systConfig.
empty())
2000 return StatusCode::SUCCESS;
2005 bool first_scale =
true;
2006 bool first_resolution =
true;
2007 for (
const auto&
it : systConfig) {
2010 if (not first_scale) {
2012 throw std::runtime_error(
"multiple scale variations not supported");
2014 first_scale =
false;
2021 if (not first_resolution) {
2022 ATH_MSG_ERROR(
"multiple resolution variations not supported");
2023 throw std::runtime_error(
2024 "multiple resolution variations not supported");
2026 first_resolution =
false;
2031 return StatusCode::SUCCESS;
2035 double Ecl,
double phi,
double eta)
const {
2041 double Ecl_corr = 0.;
2059 phi_mod = fmod(
phi, 2 *
pi / 16.) +
pi / 8.;
2061 phi_mod = fmod(
phi, 2 *
pi / 16.);
2064 if (std::abs(eta) <= 1.37) {
2070 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 175.2759))) *
2071 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-189.3612))))));
2072 if (
phi < (-6 *
pi / 8) &&
phi > (-7 *
pi / 8))
2076 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 170.8305))) *
2077 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-233.3782))))));
2078 if (
phi < (-5 *
pi / 8) &&
phi > (-6 *
pi / 8))
2082 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 147.1451))) *
2083 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-139.3386))))));
2084 if (
phi < (-4 *
pi / 8) &&
phi > (-5 *
pi / 8))
2088 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 168.4644))) *
2089 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-246.2897))))));
2090 if (
phi < (-3 *
pi / 8) &&
phi > (-4 *
pi / 8))
2094 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 177.6703))) *
2095 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-198.3227))))));
2096 if (
phi < (-2 *
pi / 8) &&
phi > (-3 *
pi / 8))
2100 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 145.0693))) *
2101 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-242.1771))))));
2102 if (
phi < (-1 *
pi / 8) &&
phi > (-2 *
pi / 8))
2106 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 132.3303))) *
2107 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-166.1833))))));
2108 if (
phi < (0 *
pi / 8) &&
phi > (-1 *
pi / 8))
2112 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 127.6780))) *
2113 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-150.0700))))));
2114 if (
phi < (1 *
pi / 8) &&
phi > (0 *
pi / 8))
2118 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 172.0679))) *
2119 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-235.3293))))));
2120 if (
phi < (2 *
pi / 8) &&
phi > (1 *
pi / 8))
2124 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 190.3524))) *
2125 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-198.9400))))));
2126 if (
phi < (3 *
pi / 8) &&
phi > (2 *
pi / 8))
2130 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 158.0540))) *
2131 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-165.3893))))));
2132 if (
phi < (4 *
pi / 8) &&
phi > (3 *
pi / 8))
2136 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 162.2793))) *
2137 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-133.5131))))));
2138 if (
phi < (5 *
pi / 8) &&
phi > (4 *
pi / 8))
2142 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 180.5270))) *
2143 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-168.5074))))));
2144 if (
phi < (6 *
pi / 8) &&
phi > (5 *
pi / 8))
2148 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 128.2277))) *
2149 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-154.4455))))));
2150 if (
phi < (7 *
pi / 8) &&
phi > (6 *
pi / 8))
2154 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 192.1216))) *
2155 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-198.0727))))));
2156 if (
phi < (8 *
pi / 8) &&
phi > (7 *
pi / 8))
2160 ((1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * 199.1735))) *
2161 (1 / (1 +
exp((phi_mod - 2 *
pi / 32.) * (-176.4056))))));
2176 DivInt = (
int)(
phi / ((2 *
pi) / 16.));
2177 double phi_mod =
phi - DivInt * (2 *
pi / 16.);
2184 if (std::abs(eta) <= 1.4) {
2189 Ecl / (1 - 0.131 * ((1 / (1 +
exp((phi_mod - 0.2) * 199.08))) *
2190 (1 / (1 +
exp((phi_mod - 0.2) * (-130.36))))));
2194 if (phi < pi / 4. && phi >= -
pi / 4.) {
2196 Ecl / (1 - 0.0879 * ((1 / (1 +
exp((phi_mod - 0.2) * 221.01))) *
2197 (1 / (1 +
exp((phi_mod - 0.2) * (-149.51))))));
2200 if (phi < -pi / 4. && phi >= (-3 *
pi) / 4.) {
2202 Ecl / (1 - 0.0605 * ((1 / (1 +
exp((phi_mod - 0.2) * 281.37))) *
2203 (1 / (1 +
exp((phi_mod - 0.2) * (-170.29))))));
2206 if ((
phi < (-3 *
pi) / 4.) || (
phi >= (3 *
pi) / 4.)) {
2208 Ecl / (1 - 0.102 * ((1 / (1 +
exp((phi_mod - 0.2) * 235.37))) *
2209 (1 / (1 +
exp((phi_mod - 0.2) * (-219.04))))));
2224 constexpr
double PI =
M_PI;
2229 if (eta < -0.4 && eta > -0.6) {
2230 if (
phi < (14 *
PI / 32.) &&
phi > (13 *
PI / 32.)) {
2232 }
else if (
phi < (13 *
PI / 32.) &&
phi > (12 *
PI / 32.)) {
2250 if (eta < 0.2 && eta > 0.) {
2251 if (
phi < (-7 * 2 *
PI / 32.) &&
phi > (-8 * 2 *
PI / 32.)) {
2256 else if (eta < 0.6 && eta > 0.4) {
2257 if (phi < 0 && phi > (-2 *
PI / 32.)) {
2259 }
else if (
phi < (-4 * 2 *
PI / 32.) &&
phi > (-5 * 2 *
PI / 32.)) {
2264 else if (eta < 0.8 && eta > 0.6) {
2265 if (
phi < (7 * 2 *
PI / 32.) &&
phi > (6 * 2 *
PI / 32.)) {
2270 else if (eta < 1.4 && eta > 1.2) {
2271 if (
phi < (-9 * 2 *
PI / 32.) &&
phi > (-10 * 2 *
PI / 32.)) {
2273 }
else if (
phi < (-11 * 2 *
PI / 32.) &&
phi > (-12 * 2 *
PI / 32.)) {
2278 else if (eta < 2.3 && eta > 2.1) {
2279 if (
phi < (-12 * 2 *
PI / 32.) &&
phi > (-13 * 2 *
PI / 32.)) {
2284 else if (eta < 0. && eta > -0.2) {
2285 if (
phi < (-12 * 2 *
PI / 32.) &&
phi > (-13 * 2 *
PI / 32.)) {
2287 }
else if (
phi < (-8 * 2 *
PI / 32.) &&
phi > (-9 * 2 *
PI / 32.)) {
2292 else if (eta < -0.2 && eta > -0.4) {
2293 if (
phi < (-9 * 2 *
PI / 32.) &&
phi > (-10 * 2 *
PI / 32.)) {
2298 else if (eta < -1.2 && eta > -1.4) {
2299 if (
phi < (-6 * 2 *
PI / 32.) &&
phi > (-7 * 2 *
PI / 32.)) {
2304 else if (eta < -1.6 && eta > -1.8) {
2305 if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2310 else if (eta < -2.3 && eta > -2.5) {
2311 if (
phi < (-8 * 2 *
PI / 32.) &&
phi > (-9 * 2 *
PI / 32.)) {
2313 }
else if (
phi < (5 * 2 *
PI / 32.) &&
phi > (4 * 2 *
PI / 32.)) {
2315 }
else if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2317 }
else if (
phi < (10 * 2 *
PI / 32.) &&
phi > (9 * 2 *
PI / 32.)) {
2319 }
else if (
phi < (11 * 2 *
PI / 32.) &&
phi > (10 * 2 *
PI / 32.)) {
2327 if (eta < 0.6 && eta > 0.4) {
2328 if (phi < 0 && phi > (-2 *
PI / 32.)) {
2330 }
else if (
phi < (-4 * 2 *
PI / 32.) &&
phi > (-5 * 2 *
PI / 32.)) {
2335 else if (eta < 0.8 && eta > 0.6) {
2336 if (
phi < (7 * 2 *
PI / 32.) &&
phi > (6 * 2 *
PI / 32.)) {
2341 else if (eta < 1.4 && eta > 1.2) {
2342 if (
phi < (-11 * 2 *
PI / 32.) &&
phi > (-12 * 2 *
PI / 32.)) {
2347 else if (eta < 2.0 && eta > 1.9) {
2348 if (
phi < (10 * 2 *
PI / 32.) &&
phi > (9 * 2 *
PI / 32.)) {
2353 else if (eta < -1.2 && eta > -1.4) {
2354 if (
phi < (-4 * 2 *
PI / 32.) &&
phi > (-5 * 2 *
PI / 32.)) {
2356 }
else if (
phi < (-6 * 2 *
PI / 32.) &&
phi > (-7 * 2 *
PI / 32.)) {
2361 else if (eta < -1.6 && eta > -1.8) {
2362 if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2367 else if (eta < -2.3 && eta > -2.5) {
2368 if (
phi < (-8 * 2 *
PI / 32.) &&
phi > (-9 * 2 *
PI / 32.)) {
2370 }
else if (
phi < (5 * 2 *
PI / 32.) &&
phi > (4 * 2 *
PI / 32.)) {
2372 }
else if (
phi < (9 * 2 *
PI / 32.) &&
phi > (8 * 2 *
PI / 32.)) {
2374 }
else if (
phi < (10 * 2 *
PI / 32.) &&
phi > (9 * 2 *
PI / 32.)) {
2376 }
else if (
phi < (11 * 2 *
PI / 32.) &&
phi > (10 * 2 *
PI / 32.)) {