ATLAS Offline Software
Loading...
Searching...
No Matches
CP::EgammaCalibrationAndSmearingTool Class Referenceabstract

#include <EgammaCalibrationAndSmearingTool.h>

Inheritance diagram for CP::EgammaCalibrationAndSmearingTool:

Classes

struct  AbsEtaCaloPredicate
struct  Accessors
struct  DoubleOrAbsEtaCaloPredicate
struct  EtaCaloPredicate
struct  SysInfo

Public Types

Definition of the StoreGate-like object's definition
typedef ServiceHandle< StoreGateSvcMetaStore_t
 Type of the metadata store object in Athena.
typedef const ServiceHandle< StoreGateSvc > & MetaStorePtr_t
 Type of the metadata store pointer in standalone mode.

Public Member Functions

virtual double getEnergy (xAOD::Egamma *, const xAOD::EventInfo *)
virtual double getElectronMomentum (const xAOD::Electron *, const xAOD::EventInfo *)
double getResolution (const xAOD::Egamma &particle, bool withCT=true) const override
double intermodule_correction (double Ecl, double phi, double eta) const
double correction_phi_unif (double eta, double phi) const
void callSingleEvent (columnar::MutableEgammaRange egammas, columnar::EventInfoId event) const
void callEvents (columnar::EventContextRange events) const override
virtual void print () const =0
 Print the state of the tool.
virtual StatusCode sysInitialize ()
 Function initialising the tool in the correct way in Athena.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Functions providing access to the input/output metadata
MetaStorePtr_t inputMetaStore () const
 Accessor for the input metadata store.
MetaStorePtr_t outputMetaStore () const
 Accessor for the output metadata store.
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Public Attributes

Gaudi::Property< boolm_onlyElectrons {this, "onlyElectrons", false, "the tool will only be applied to electrons"}
Gaudi::Property< boolm_onlyPhotons {this, "onlyPhotons", false, "the tool will only be applied to photons"}
std::unique_ptr< Accessorsm_accessors

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.
Callback functions helping in metadata reading/writing
void setUseIncidents (const bool flag)
virtual void handle (const Incident &inc)
 Function receiving incidents from IncidentSvc/TEvent.
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened.
virtual StatusCode endInputFile ()
 Function called when the currently open input file got completely processed.
virtual StatusCode beginEvent ()
 Function called when a new events is loaded.
virtual StatusCode metaDataStop ()
 Function called when the tool should write out its metadata.

Private Types

enum class  ResolutionDecorrelation { FULL , ONENP }
typedef unsigned int RandomNumber
typedef std::function< int(const EgammaCalibrationAndSmearingTool &, columnar::EgammaId, columnar::EventInfoId)> IdFunction
typedef std::function< bool(const EgammaCalibrationAndSmearingTool &, columnar::EgammaId)> EgammaPredicate
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

 EgammaCalibrationAndSmearingTool (const std::string &name)
 ~EgammaCalibrationAndSmearingTool ()
StatusCode initialize () override
virtual CP::CorrectionCode applyCorrection (xAOD::Egamma &) const override
CP::CorrectionCode applyCorrection (columnar::MutableEgammaId input, columnar::EventInfoId event_info) const
void setPt (columnar::MutableEgammaId input, double energy) const
virtual CP::CorrectionCode correctedCopy (const xAOD::Electron &, xAOD::Electron *&) const override
virtual CP::CorrectionCode correctedCopy (const xAOD::Photon &, xAOD::Photon *&) const override
double getEnergy (const xAOD::Photon &) const
double getEnergy (const xAOD::Electron &) const
virtual CP::SystematicSet affectingSystematics () const override
 the list of all systematics this tool can be affected by
virtual bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const override
 Declare the interface that this class provides.
virtual CP::SystematicSet recommendedSystematics () const override
 the list of all systematics this tool recommends to use
virtual StatusCode applySystematicVariation (const CP::SystematicSet &systConfig) override
 effects: configure this tool for the given list of systematic variations.
virtual void setRandomSeedFunction (const IdFunction &&function)
const IdFunction getRandomSeedFunction () const
virtual double resolution (double energy, double cl_eta, double cl_etaCalo, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron, bool withCT=false) const override
void setupSystematics ()
const EgammaPredicate EtaCaloPredicateFactory (double eta_min, double eta_max) const
const EgammaPredicate AbsEtaCaloPredicateFactory (double eta_min, double eta_max) const
const EgammaPredicate AbsEtaCaloPredicateFactory (std::pair< double, double > edges) const
const std::vector< EgammaPredicateAbsEtaCaloPredicatesFactory (const std::vector< std::pair< double, double > > &edges) const
const std::vector< EgammaPredicateAbsEtaCaloPredicatesFactory (const std::vector< double > &edges) const
const EgammaPredicate DoubleOrAbsEtaCaloPredicateFactory (double eta1_min, double eta1_max, double eta2_min, double eta2_max) const
PATCore::ParticleType::Type xAOD2ptype (columnar::EgammaId particle) const
egEnergyCorr::Scale::Variation oldtool_scale_flag_this_event (columnar::EgammaId p, columnar::EventInfoId event_info) const
egEnergyCorr::Resolution::Variation oldtool_resolution_flag_this_event (columnar::EgammaId p, columnar::EventInfoId event_info) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_ESModel
std::string m_decorrelation_model_name
std::string m_decorrelation_model_scale_name
std::string m_decorrelation_model_resolution_name
ScaleDecorrelation m_decorrelation_model_scale = ScaleDecorrelation::FULL
ResolutionDecorrelation m_decorrelation_model_resolution
egEnergyCorr::ESModel m_TESModel
int m_doScaleCorrection
int m_doSmearing
double m_varSF
std::string m_ResolutionType
egEnergyCorr::Resolution::resolutionType m_TResolutionType
int m_useFastSim
int m_use_AFII
PATCore::ParticleDataType::DataType m_simulation
int m_useIntermoduleCorrection
int m_usePhiUniformCorrection
int m_useCaloDistPhiUnifCorrection
int m_useGainCorrection
int m_doADCLinearityCorrection
int m_doLeakageCorrection
bool m_use_ep_combination
int m_use_mva_calibration
bool m_use_full_statistical_error
int m_use_temp_correction201215
int m_use_uA2MeV_2015_first2weeks_correction
bool m_use_mapping_correction
int m_user_random_run_number
int m_useGainInterpolation
int m_useLayerCorrection
int m_usePSCorrection
int m_useS12Correction
int m_useSaccCorrection
bool m_decorateEmva
std::unique_ptr< TH2 > m_caloDistPhiUnifCorr
Gaudi::Property< boolm_fixForMissingCells
Gaudi::Property< boolm_doFwdCalib
Gaudi::Property< std::string > m_pVtxKey
ServiceHandle< IegammaMVASvcm_MVACalibSvc
std::unique_ptr< egGain::GainUncertaintym_gain_tool_run2
std::shared_ptr< LinearityADCm_ADCLinearity_tool
egGain::GainToolm_gain_tool = nullptr
egammaLayerRecalibToolm_layer_recalibration_tool = nullptr
std::string m_layer_recalibration_tune
std::unique_ptr< AtlasRoot::egammaEnergyCorrectionToolm_rootTool
std::string m_MVAfolder
std::map< CP::SystematicVariation, SysInfom_syst_description
std::map< CP::SystematicVariation, egEnergyCorr::Resolution::Variationm_syst_description_resolution
egEnergyCorr::Scale::Variation m_currentScaleVariation_MC
egEnergyCorr::Scale::Variation m_currentScaleVariation_data
egEnergyCorr::Resolution::Variation m_currentResolutionVariation_MC
egEnergyCorr::Resolution::Variation m_currentResolutionVariation_data
EgammaPredicate m_currentScalePredicate
IdFunction m_set_seed_function
MetaStore_t m_inputMetaStore
 Object accessing the input metadata store.
MetaStore_t m_outputMetaStore
 Object accessing the output metadata store.
bool m_beginInputFileCalled
 Flag helping to discover when the tool misses the opening of the first input file.
bool m_useIncidents
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static const int AUTO = 2
static const unsigned int m_Run2Run3runNumberTransition = 400000

Detailed Description

Definition at line 183 of file EgammaCalibrationAndSmearingTool.h.

Member Typedef Documentation

◆ EgammaPredicate

◆ IdFunction

◆ MetaStore_t

Type of the metadata store object in Athena.

Definition at line 66 of file AsgMetadataTool.h.

◆ MetaStorePtr_t

Type of the metadata store pointer in standalone mode.

Definition at line 68 of file AsgMetadataTool.h.

◆ RandomNumber

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ ResolutionDecorrelation

Enumerator
FULL 
ONENP 

Definition at line 198 of file EgammaCalibrationAndSmearingTool.h.

Constructor & Destructor Documentation

◆ EgammaCalibrationAndSmearingTool()

CP::EgammaCalibrationAndSmearingTool::EgammaCalibrationAndSmearingTool ( const std::string & name)
private

Definition at line 290 of file EgammaCalibrationAndSmearingTool.cxx.

292 : asg::AsgMetadataTool(name),
301 columnar::EgammaId egamma,
303 const Accessors& acc = *tool.m_accessors;
304 // avoid 0 as result, see
305 // https://root.cern.ch/root/html/TRandom3.html#TRandom3:SetSeed
306 auto cluster = acc.caloClusterAcc(egamma)[0].value();
307 return 1 + static_cast<RandomNumber>(
308 std::abs(acc.clusterPhiAcc(cluster)) * 1E6 +
309 std::abs(acc.clusterEtaAcc(cluster)) * 1E3 +
310 acc.eventNumberAcc(ei));
311 }),
312 m_accessors(std::make_unique<Accessors>(*this)) {
313
314 declareProperty("ESModel", m_ESModel = "");
315 declareProperty("decorrelationModel", m_decorrelation_model_name = "");
316 declareProperty("decorrelationModelScale",
318 declareProperty("decorrelationModelResolution",
320 declareProperty("ResolutionType", m_ResolutionType = "SigmaEff90");
321 declareProperty("varSF", m_varSF = 1.0);
322 declareProperty("doScaleCorrection", m_doScaleCorrection = AUTO);
323 declareProperty("doSmearing", m_doSmearing = AUTO);
324 declareProperty("useLayerCorrection", m_useLayerCorrection = AUTO);
325 declareProperty("usePSCorrection", m_usePSCorrection = AUTO);
326 declareProperty("useS12Correction", m_useS12Correction = AUTO);
327 declareProperty("useSaccCorrection", m_useSaccCorrection = AUTO);
328 declareProperty("useIntermoduleCorrection",
330 declareProperty("usePhiUniformCorrection", m_usePhiUniformCorrection = AUTO);
331 declareProperty("useCaloDistPhiUnifCorrection",
333 declareProperty("useGainCorrection", m_useGainCorrection = AUTO);
334 declareProperty("useGainInterpolation", m_useGainInterpolation = AUTO);
335 declareProperty("doADCLinearityCorrection",
337 declareProperty("doLeakageCorrection", m_doLeakageCorrection = AUTO);
338 declareProperty("MVAfolder", m_MVAfolder = "");
339 declareProperty("layerRecalibrationTune", m_layer_recalibration_tune = "");
340 declareProperty("useEPCombination", m_use_ep_combination = false);
341 declareProperty("useMVACalibration", m_use_mva_calibration = AUTO);
342 declareProperty("use_full_statistical_error",
344 declareProperty("use_temp_correction201215",
346 declareProperty("use_uA2MeV_2015_first2weeks_correction",
348 declareProperty("randomRunNumber", m_user_random_run_number = 0);
349 // this is the user input, it is never changed by the tool. The tool uses
350 // m_simulation.
351 declareProperty("useFastSim", m_useFastSim = -1,
352 "This should be explicitly set by the user depending on the "
353 "data type (int)0=full sim, (int)1=fast sim");
355 "useAFII", m_use_AFII = -1,
356 "This is now deprecated. Kept for explicit error message for now");
357 declareProperty("decorateEmva", m_decorateEmva = false, "whether to decorate the eMVA value");
358}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
egEnergyCorr::Resolution::Variation m_currentResolutionVariation_MC
egEnergyCorr::Scale::Variation m_currentScaleVariation_data
egEnergyCorr::Scale::Variation m_currentScaleVariation_MC
egEnergyCorr::Resolution::resolutionType m_TResolutionType
egEnergyCorr::Resolution::Variation m_currentResolutionVariation_data
ObjectId< ContainerId::egamma > EgammaId
Definition EgammaDef.h:50
ObjectId< ContainerId::eventInfo > EventInfoId
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.

◆ ~EgammaCalibrationAndSmearingTool()

CP::EgammaCalibrationAndSmearingTool::~EgammaCalibrationAndSmearingTool ( )
private

Definition at line 360 of file EgammaCalibrationAndSmearingTool.cxx.

360 {
361 ATH_MSG_DEBUG("destructor");
363 delete m_gain_tool;
364}
#define ATH_MSG_DEBUG(x)

Member Function Documentation

◆ AbsEtaCaloPredicateFactory() [1/2]

const EgammaPredicate CP::EgammaCalibrationAndSmearingTool::AbsEtaCaloPredicateFactory ( double eta_min,
double eta_max ) const
inlineprivate

Definition at line 341 of file EgammaCalibrationAndSmearingTool.h.

342 {
343 /*return [eta_min, eta_max](const xAOD::Egamma& p) {
344 const double aeta = std::abs(xAOD::get_eta_calo(*p.caloCluster()));
345 return (aeta >= eta_min and aeta < eta_max); };*/
346 return AbsEtaCaloPredicate(eta_min, eta_max);
347 }

◆ AbsEtaCaloPredicateFactory() [2/2]

const EgammaPredicate CP::EgammaCalibrationAndSmearingTool::AbsEtaCaloPredicateFactory ( std::pair< double, double > edges) const
inlineprivate

Definition at line 349 of file EgammaCalibrationAndSmearingTool.h.

350 {
351 return AbsEtaCaloPredicateFactory(edges.first, edges.second);
352 }
const EgammaPredicate AbsEtaCaloPredicateFactory(double eta_min, double eta_max) const

◆ AbsEtaCaloPredicatesFactory() [1/2]

const std::vector< EgammaPredicate > CP::EgammaCalibrationAndSmearingTool::AbsEtaCaloPredicatesFactory ( const std::vector< double > & edges) const
inlineprivate

Definition at line 364 of file EgammaCalibrationAndSmearingTool.h.

365 {
366 std::vector<EgammaPredicate> result;
367 result.reserve(edges.size() - 1);
368 auto it2 = edges.begin();
369 auto it = it2++;
370 for (; it2 != edges.end(); ++it, ++it2) {
371 result.push_back(AbsEtaCaloPredicateFactory(*it, *it2));
372 }
373 return result;
374 }

◆ AbsEtaCaloPredicatesFactory() [2/2]

const std::vector< EgammaPredicate > CP::EgammaCalibrationAndSmearingTool::AbsEtaCaloPredicatesFactory ( const std::vector< std::pair< double, double > > & edges) const
inlineprivate

Definition at line 354 of file EgammaCalibrationAndSmearingTool.h.

355 {
356 std::vector<EgammaPredicate> result;
357 result.reserve(edges.size());
358 for (const auto& it : edges) {
359 result.push_back(AbsEtaCaloPredicateFactory(it.first, it.second));
360 }
361 return result;
362 }

◆ affectingSystematics()

CP::SystematicSet CP::EgammaCalibrationAndSmearingTool::affectingSystematics ( ) const
overrideprivatevirtual

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 1314 of file EgammaCalibrationAndSmearingTool.cxx.

1315 {
1316 CP::SystematicSet affecting_systematics;
1317 for (const auto& it : m_syst_description) {
1318 affecting_systematics.insert(it.first);
1319 }
1320 for (const auto& it : m_syst_description_resolution) {
1321 affecting_systematics.insert(it.first);
1322 }
1323
1324 return affecting_systematics;
1325}
std::map< CP::SystematicVariation, SysInfo > m_syst_description
std::map< CP::SystematicVariation, egEnergyCorr::Resolution::Variation > m_syst_description_resolution
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set

◆ applyCorrection() [1/2]

CP::CorrectionCode CP::EgammaCalibrationAndSmearingTool::applyCorrection ( columnar::MutableEgammaId input,
columnar::EventInfoId event_info ) const
private

Definition at line 999 of file EgammaCalibrationAndSmearingTool.cxx.

1000 {
1001 const Accessors& acc = *m_accessors;
1002
1003 // only used in simulation (for the smearing)
1004 RandomNumber seed = m_set_seed_function(*this, input, event_info);
1005
1006 columnar::ClusterId inputCluster = acc.caloClusterAcc (input)[0].value();
1007
1008 if (m_layer_recalibration_tool && acc.authorAcc (input) !=
1010 ATH_MSG_DEBUG("applying energy recalibration before E0|E1|E2|E3 = "
1011 << acc.energyBEAcc (inputCluster, 0) << "|"
1012 << acc.energyBEAcc (inputCluster, 1) << "|"
1013 << acc.energyBEAcc (inputCluster, 2) << "|"
1014 << acc.energyBEAcc (inputCluster, 3));
1015 // for now just go back to the xAOD object to access the subtool
1016 const CP::CorrectionCode status_layer_recalibration = m_layer_recalibration_tool->applyCorrection(input.getXAODObject(), event_info.getXAODObject());
1017 if (status_layer_recalibration == CP::CorrectionCode::Error) { return CP::CorrectionCode::Error; }
1018 ATH_MSG_DEBUG("eta|phi = " << acc.etaAcc (input) << "|" << acc.phiAcc (input));
1019 if (status_layer_recalibration == CP::CorrectionCode::Ok) {
1020 ATH_MSG_DEBUG("decoration E0|E1|E2|E3 = "
1021 << acc.Es0Acc(inputCluster) << "|"
1022 << acc.Es1Acc(inputCluster) << "|"
1023 << acc.Es2Acc(inputCluster) << "|"
1024 << acc.Es3Acc(inputCluster) << "|");
1025 if (acc.Es2Acc(inputCluster) == 0 and acc.Es1Acc(inputCluster) == 0 and
1026 acc.Es3Acc(inputCluster) == 0 and acc.Es0Acc(inputCluster) == 0 and
1027 (std::abs(acc.etaAcc (input)) < 1.37 or (std::abs(acc.etaAcc (input)) > 1.55 and std::abs(acc.etaAcc (input)) < 2.47)))
1028 {
1029 ATH_MSG_WARNING("all layer energies are zero");
1030 }
1031 }
1032 }
1033
1034 double energy = acc.momAcc.e (input);
1035 // apply MVA calibration
1036 if (!m_MVACalibSvc.empty()) {
1037 egammaMVACalib::GlobalEventInfo gei;
1038 if (acc.authorAcc (input) ==
1040 const xAOD::VertexContainer* pVtxCont = nullptr;
1041 if (evtStore()->retrieve(pVtxCont, m_pVtxKey).isFailure()) {
1042 ATH_MSG_ERROR("No primary vertex container " << m_pVtxKey << " could be retrieved");
1044 }
1045 unsigned int npv(0);
1046 for (const auto *vtx : *pVtxCont) {
1047 if (vtx->vertexType() == xAOD::VxType::PriVtx ||
1048 vtx->vertexType() == xAOD::VxType::PileUp) { ++npv; }
1049 }
1050 gei.nPV = npv;
1051 gei.acmu = acc.actIntPerXingAcc(event_info);
1052 ATH_MSG_DEBUG("Retrieved nPV = " << gei.nPV << " and mu = " << gei.acmu);
1053 }
1054 if (acc.authorAcc (input) !=
1056 if (m_MVACalibSvc->getEnergy(inputCluster.getXAODObject(), input.getXAODObject(), energy, gei)
1057 .isFailure()) {
1058 ATH_MSG_ERROR("Failure in MVACalib service");
1060 }
1061 ATH_MSG_DEBUG("energy after MVA calibration = " << std::format("{:.2f}", energy));
1062 }
1063 }
1065 // for now assume the input has already the layer calibration applied
1066 // and just take the decorated gnn_energy
1067 if (!acc.gnn_energy_Acc.isAvailable(input)) {
1068 ATH_MSG_ERROR("GNN energy requested but decoration TransformerEnergy not found");
1070 }
1071 energy = acc.gnn_energy_Acc(input);
1072 ATH_MSG_DEBUG("energy after GNN calibration = " << std::format("{:.2f}", energy));
1073
1074 }
1075 if (m_decorateEmva)
1076 {
1077 acc.decEmva(input) = energy;
1078 }
1079
1080 // For the time being, it is just the MVA calib
1081 if (acc.authorAcc (input) ==
1083 setPt(input, energy);
1085 }
1086
1088 // Crack calibation correction for es2011c (calibration hits calibration)
1089 const auto ptype = xAOD2ptype(input);
1090 const double etaden =
1092 ? static_cast<const xAOD::Electron&>(input.getXAODObject()).trackParticle()->eta()
1093 : acc.clusterEtaAcc(inputCluster);
1094 energy *= m_rootTool->applyMCCalibration(acc.clusterEtaAcc(inputCluster),
1095 energy / cosh(etaden), ptype);
1096 ATH_MSG_DEBUG("energy after crack calibration es2011c = "
1097 << std::format("{:.2f}", energy));
1098 }
1099
1100 /*
1101 * Here we check for each event the kind of data DATA vs FullSim
1102 * The m_simulation flavour has already been configured
1103 */
1105 (acc.eventTypeAcc(event_info,xAOD::EventInfo::IS_SIMULATION))
1106 ? m_simulation
1108
1109 unsigned int runNumber_for_tool = 0;
1110
1111 // apply uniformity corrections to data
1112 if (dataType == PATCore::ParticleDataType::Data) {
1113 // Get run number
1114 runNumber_for_tool = acc.runNumberAcc(event_info);
1115 // Get etaCalo, phiCalo
1116 const auto cl_eta = acc.clusterEtaAcc(inputCluster);
1117 double etaCalo = 0, phiCalo = 0;
1119 etaCalo = acc.etaCaloAcc(inputCluster, acc.authorAcc(input), false);
1121 phiCalo =
1122 acc.phiCaloAcc(inputCluster, acc.authorAcc(input), false);
1123 }
1124 }
1125
1126 // Intermodule
1128 energy =
1129 intermodule_correction(energy, acc.clusterPhiAcc(inputCluster), cl_eta);
1130 ATH_MSG_DEBUG("energy after intermodule correction = "
1131 << std::format("{:.2f}", energy));
1132 }
1133
1134 // Calo distortion
1140 double etaC = acc.clusterEtaAcc(inputCluster);
1141 double phiC = acc.clusterPhiAcc(inputCluster);
1142 int ieta = m_caloDistPhiUnifCorr->GetXaxis()->FindBin(etaC);
1143 ieta = ieta == 0 ? 1
1144 : (ieta > m_caloDistPhiUnifCorr->GetNbinsX()
1145 ? m_caloDistPhiUnifCorr->GetNbinsX()
1146 : ieta);
1147 int iphi = m_caloDistPhiUnifCorr->GetYaxis()->FindBin(phiC);
1148 iphi = iphi == 0 ? 1
1149 : (iphi > m_caloDistPhiUnifCorr->GetNbinsY()
1150 ? m_caloDistPhiUnifCorr->GetNbinsY()
1151 : iphi);
1152 energy *= m_caloDistPhiUnifCorr->GetBinContent(ieta, iphi);
1154 "energy after phi uniformity correction (for calo distortion) = "
1155 << std::format("{:.2f}", energy));
1156 }
1157
1158 // Phi
1160 energy *= correction_phi_unif(etaCalo, phiCalo);
1161 ATH_MSG_DEBUG("energy after uniformity correction = "
1162 << std::format("{:.2f}", energy));
1163 }
1164
1165 // ADC
1166 if (m_ADCLinearity_tool) {
1167 double et = energy / std::cosh(cl_eta);
1168 double corr =
1169 m_ADCLinearity_tool->getCorr(etaCalo, et, xAOD2ptype(input));
1170 energy *= corr;
1171 ATH_MSG_DEBUG("energy after ADC linearity correction = "
1172 << std::format("{:.2f}", energy));
1173 }
1174
1175 // Gain
1176 if (m_gain_tool) {
1177 const auto es2 = acc.Es2Acc.isAvailable(inputCluster)
1178 ? acc.Es2Acc(inputCluster)
1179 : acc.energyBEAcc (inputCluster,2);
1180 if (!(std::abs(cl_eta) < 1.52 and std::abs(cl_eta) > 1.37) and
1181 std::abs(cl_eta) < 2.4)
1182 energy = m_gain_tool->CorrectionGainTool(
1183 cl_eta, energy / GeV, es2 / GeV,
1184 xAOD2ptype(input)); // cl_eta ok, TODO: check corrected E2
1185 } else if (m_gain_tool_run2) {
1186 double et = energy / std::cosh(cl_eta);
1187 double corr = m_gain_tool_run2->getUncertainty(etaCalo, et,
1188 xAOD2ptype(input), true);
1189 energy /= (1 + corr);
1190 }
1191 ATH_MSG_DEBUG("energy after gain correction = " << std::format("{:.2f}", energy));
1192 } else {
1193 if (m_user_random_run_number == 0) {
1194 if (acc.randomrunnumber_getter.isAvailable(event_info)) {
1195 runNumber_for_tool = acc.randomrunnumber_getter(event_info);
1196 } else {
1198 "Pileup tool not run before using "
1199 "ElectronPhotonFourMomentumCorrection! Assuming it is 2016. If you "
1200 "want to force a specific period set the property randomRunNumber "
1201 "of the tool, e.g. in the job option: "
1202 "tool.randomRunNumber = 123456 or "
1203 "tool.randomRunNumber = "
1204 "EgammaCalibrationAndSmearingToolRunNumbersExample.run_2016");
1206 }
1207 } else {
1208 runNumber_for_tool = m_user_random_run_number;
1209 }
1210 }
1211
1212 const double eraw = ((acc.Es0Acc.isAvailable(inputCluster)
1213 ? acc.Es0Acc(inputCluster)
1214 : acc.energyBEAcc(inputCluster,0)) +
1215 (acc.Es1Acc.isAvailable(inputCluster)
1216 ? acc.Es1Acc(inputCluster)
1217 : acc.energyBEAcc(inputCluster,1)) +
1218 (acc.Es2Acc.isAvailable(inputCluster)
1219 ? acc.Es2Acc(inputCluster)
1220 : acc.energyBEAcc(inputCluster,2)) +
1221 (acc.Es3Acc.isAvailable(inputCluster)
1222 ? acc.Es3Acc(inputCluster)
1223 : acc.energyBEAcc(inputCluster,3)));
1224
1225
1226 if (dataType == PATCore::ParticleDataType::Fast)
1227 ATH_MSG_DEBUG("is fast");
1228 else if (dataType == PATCore::ParticleDataType::Full)
1229 ATH_MSG_DEBUG("is full");
1230 else if (dataType == PATCore::ParticleDataType::Data)
1231 ATH_MSG_DEBUG("is data");
1232
1233 // apply scale factors or systematics
1234 energy = m_rootTool->getCorrectedEnergy(
1235 runNumber_for_tool, dataType, xAOD2ptype(input),
1236 inputCluster(acc.clusterEtaAcc),
1237 inputCluster(acc.clusterEtaBEAcc,2),
1238 acc.etaCaloAcc(inputCluster, acc.authorAcc (input), false), energy,
1239 acc.Es2Acc.isAvailable(inputCluster)
1240 ? acc.Es2Acc(inputCluster)
1241 : inputCluster(acc.energyBEAcc,2),
1242 eraw, seed, oldtool_scale_flag_this_event(input, event_info),
1244 m_varSF);
1245
1246 ATH_MSG_DEBUG("energy after scale/systematic correction = " << std::format("{:.2f}", energy));
1247
1248 // TODO: this check should be done before systematics variations
1249 setPt(input, energy);
1251}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
ServiceHandle< StoreGateSvc > & evtStore()
@ Error
Some error happened during the object correction.
@ Ok
The correction was done successfully.
PATCore::ParticleDataType::DataType m_simulation
void setPt(columnar::MutableEgammaId input, double energy) const
double intermodule_correction(double Ecl, double phi, double eta) const
egEnergyCorr::Scale::Variation oldtool_scale_flag_this_event(columnar::EgammaId p, columnar::EventInfoId event_info) const
std::unique_ptr< egGain::GainUncertainty > m_gain_tool_run2
PATCore::ParticleType::Type xAOD2ptype(columnar::EgammaId particle) const
double correction_phi_unif(double eta, double phi) const
egEnergyCorr::Resolution::Variation oldtool_resolution_flag_this_event(columnar::EgammaId p, columnar::EventInfoId event_info) const
std::unique_ptr< AtlasRoot::egammaEnergyCorrectionTool > m_rootTool
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
@ IS_SIMULATION
true: simulation, false: data
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
ObjectId< ContainerId::cluster > ClusterId
Definition ClusterDef.h:26
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition EgammaDefs.h:30
@ PileUp
Pile-up vertex.
@ PriVtx
Primary vertex.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Electron_v1 Electron
Definition of the current "egamma version".

◆ applyCorrection() [2/2]

CP::CorrectionCode CP::EgammaCalibrationAndSmearingTool::applyCorrection ( xAOD::Egamma & input) const
overrideprivatevirtual

Implements CP::IEgammaCalibrationAndSmearingTool.

Definition at line 944 of file EgammaCalibrationAndSmearingTool.cxx.

945 {
946 // Retrieve the event information:
947 const xAOD::EventInfo* event_info = nullptr;
948 if (evtStore()->retrieve(event_info, "EventInfo").isFailure()) {
949 ATH_MSG_ERROR("No EventInfo object could be retrieved");
951 }
952 return applyCorrection(input, *event_info);
953}
virtual CP::CorrectionCode applyCorrection(xAOD::Egamma &) const override
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ applySystematicVariation()

StatusCode CP::EgammaCalibrationAndSmearingTool::applySystematicVariation ( const CP::SystematicSet & systConfig)
overrideprivatevirtual

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

Implements CP::ISystematicsTool.

Definition at line 2165 of file EgammaCalibrationAndSmearingTool.cxx.

2166 {
2167
2168 // set the nominal one (no systematics)
2178
2179 if (systConfig.empty())
2180 return StatusCode::SUCCESS;
2181
2182 // the following code allows only ONE systematic variation at a time (1 for
2183 // scale, 1 for resolution)
2184
2185 bool first_scale = true;
2186 bool first_resolution = true;
2187 for (const auto& it : systConfig) {
2188 const auto found_scale = m_syst_description.find(it);
2189 if (found_scale != m_syst_description.end()) {
2190 if (not first_scale) {
2191 ATH_MSG_ERROR("multiple scale variations not supported");
2192 throw std::runtime_error("multiple scale variations not supported");
2193 }
2194 first_scale = false;
2195 m_currentScaleVariation_MC = found_scale->second.effect;
2196 m_currentScalePredicate = found_scale->second.predicate;
2197 }
2198
2199 const auto found_resolution = m_syst_description_resolution.find(it);
2200 if (found_resolution != m_syst_description_resolution.end()) {
2201 if (not first_resolution) {
2202 ATH_MSG_ERROR("multiple resolution variations not supported");
2203 throw std::runtime_error(
2204 "multiple resolution variations not supported");
2205 }
2206 first_resolution = false;
2207 m_currentResolutionVariation_MC = found_resolution->second;
2208 }
2209 }
2210
2211 return StatusCode::SUCCESS;
2212}
bool empty() const
returns: whether the set is empty

◆ beginEvent()

StatusCode asg::AsgMetadataTool::beginEvent ( )
protectedvirtualinherited

◆ beginInputFile()

StatusCode asg::AsgMetadataTool::beginInputFile ( )
protectedvirtualinherited

Function called when a new input file is opened.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, BookkeeperDumperTool, BookkeeperTool, PMGTools::PMGTruthWeightTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, TauAnalysisTools::TauSmearingTool, Trig::TrigDecisionTool, Trig::xAODBunchCrossingTool, TrigConf::xAODConfigTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 185 of file AsgMetadataTool.cxx.

185 {
186
187 // Return gracefully:
188 return StatusCode::SUCCESS;
189 }

◆ callEvents()

void CP::EgammaCalibrationAndSmearingTool::callEvents ( columnar::EventContextRange events) const
override

Definition at line 2578 of file EgammaCalibrationAndSmearingTool.cxx.

2580{
2581 const Accessors& acc = *m_accessors;
2582 for (auto event : events) {
2583 auto eventInfo = acc.m_eventHandle(event);
2584 callSingleEvent (acc.m_egammaHandle(event), eventInfo);
2585 }
2586}
void callSingleEvent(columnar::MutableEgammaRange egammas, columnar::EventInfoId event) const

◆ callSingleEvent()

void CP::EgammaCalibrationAndSmearingTool::callSingleEvent ( columnar::MutableEgammaRange egammas,
columnar::EventInfoId event ) const

Definition at line 2569 of file EgammaCalibrationAndSmearingTool.cxx.

2571{
2572 for (auto egamma : egammas) {
2573 if (applyCorrection (egamma, event) != CP::CorrectionCode::Ok)
2574 throw std::runtime_error ("EgammaCalibrationAndSmearingTool::callEvents: apply failed");
2575 }
2576}

◆ correctedCopy() [1/2]

CP::CorrectionCode CP::EgammaCalibrationAndSmearingTool::correctedCopy ( const xAOD::Electron & input,
xAOD::Electron *& output ) const
overrideprivatevirtual

Implements CP::IEgammaCalibrationAndSmearingTool.

Definition at line 955 of file EgammaCalibrationAndSmearingTool.cxx.

956 {
957 // A sanity check:
958 if (output)
960 "Non-null pointer received. "
961 "There's a possible memory leak!");
962
963 output = new xAOD::Electron();
964 output->makePrivateStore(input);
965 return applyCorrection(*output);
966}
output
Definition merge.py:16

◆ correctedCopy() [2/2]

CP::CorrectionCode CP::EgammaCalibrationAndSmearingTool::correctedCopy ( const xAOD::Photon & input,
xAOD::Photon *& output ) const
overrideprivatevirtual

Implements CP::IEgammaCalibrationAndSmearingTool.

Definition at line 968 of file EgammaCalibrationAndSmearingTool.cxx.

969 {
970 // A sanity check:
971 if (output)
973 "Non-null pointer received. "
974 "There's a possible memory leak!");
975
976 output = new xAOD::Photon();
977 output->makePrivateStore(input);
978 return applyCorrection(*output);
979}
Photon_v1 Photon
Definition of the current "egamma version".

◆ correction_phi_unif()

double CP::EgammaCalibrationAndSmearingTool::correction_phi_unif ( double eta,
double phi ) const

Definition at line 2404 of file EgammaCalibrationAndSmearingTool.cxx.

2405 {
2406 constexpr double PI = M_PI;
2407 double Fcorr = 1.0;
2408
2410 // wrong mapping HV -> sectors in run1
2411 if (eta < -0.4 && eta > -0.6) {
2412 if (phi < (14 * PI / 32.) && phi > (13 * PI / 32.)) {
2413 Fcorr += 0.035;
2414 } else if (phi < (13 * PI / 32.) && phi > (12 * PI / 32.)) {
2415 Fcorr -= 0.035;
2416 }
2417 }
2418 }
2419
2433
2434 if (eta < 0.2 && eta > 0.) {
2435 if (phi < (-7 * 2 * PI / 32.) && phi > (-8 * 2 * PI / 32.)) {
2436 Fcorr = 1.016314;
2437 }
2438 }
2439
2440 else if (eta < 0.6 && eta > 0.4) {
2441 if (phi < 0 && phi > (-2 * PI / 32.)) {
2442 Fcorr = 1.041591;
2443 } else if (phi < (-4 * 2 * PI / 32.) && phi > (-5 * 2 * PI / 32.)) {
2444 Fcorr = 1.067346;
2445 }
2446 }
2447
2448 else if (eta < 0.8 && eta > 0.6) {
2449 if (phi < (7 * 2 * PI / 32.) && phi > (6 * 2 * PI / 32.)) {
2450 Fcorr = 1.027980;
2451 }
2452 }
2453
2454 else if (eta < 1.4 && eta > 1.2) {
2455 if (phi < (-9 * 2 * PI / 32.) && phi > (-10 * 2 * PI / 32.)) {
2456 Fcorr = 1.020299;
2457 } else if (phi < (-11 * 2 * PI / 32.) && phi > (-12 * 2 * PI / 32.)) {
2458 Fcorr = 1.051426;
2459 }
2460 }
2461
2462 else if (eta < 2.3 && eta > 2.1) {
2463 if (phi < (-12 * 2 * PI / 32.) && phi > (-13 * 2 * PI / 32.)) {
2464 Fcorr = 1.071695;
2465 }
2466 }
2467
2468 else if (eta < 0. && eta > -0.2) {
2469 if (phi < (-12 * 2 * PI / 32.) && phi > (-13 * 2 * PI / 32.)) {
2470 Fcorr = 1.008227;
2471 } else if (phi < (-8 * 2 * PI / 32.) && phi > (-9 * 2 * PI / 32.)) {
2472 Fcorr = 1.013929;
2473 }
2474 }
2475
2476 else if (eta < -0.2 && eta > -0.4) {
2477 if (phi < (-9 * 2 * PI / 32.) && phi > (-10 * 2 * PI / 32.)) {
2478 Fcorr = 1.015749;
2479 }
2480 }
2481
2482 else if (eta < -1.2 && eta > -1.4) {
2483 if (phi < (-6 * 2 * PI / 32.) && phi > (-7 * 2 * PI / 32.)) {
2484 Fcorr = 1.064954;
2485 }
2486 }
2487
2488 else if (eta < -1.6 && eta > -1.8) {
2489 if (phi < (9 * 2 * PI / 32.) && phi > (8 * 2 * PI / 32.)) {
2490 Fcorr = 1.027448;
2491 }
2492 }
2493
2494 else if (eta < -2.3 && eta > -2.5) {
2495 if (phi < (-8 * 2 * PI / 32.) && phi > (-9 * 2 * PI / 32.)) {
2496 Fcorr = 1.025882;
2497 } else if (phi < (5 * 2 * PI / 32.) && phi > (4 * 2 * PI / 32.)) {
2498 Fcorr = 1.036616;
2499 } else if (phi < (9 * 2 * PI / 32.) && phi > (8 * 2 * PI / 32.)) {
2500 Fcorr = 1.053838;
2501 } else if (phi < (10 * 2 * PI / 32.) && phi > (9 * 2 * PI / 32.)) {
2502 Fcorr = 1.026856;
2503 } else if (phi < (11 * 2 * PI / 32.) && phi > (10 * 2 * PI / 32.)) {
2504 Fcorr = 0.994382;
2505 }
2506 }
2507
2508 } // es2017_summer_improved end
2509
2510 else {
2511 if (eta < 0.6 && eta > 0.4) {
2512 if (phi < 0 && phi > (-2 * PI / 32.)) {
2513 Fcorr = 1.028;
2514 } else if (phi < (-4 * 2 * PI / 32.) && phi > (-5 * 2 * PI / 32.)) {
2515 Fcorr = 1.044;
2516 }
2517 }
2518
2519 else if (eta < 0.8 && eta > 0.6) {
2520 if (phi < (7 * 2 * PI / 32.) && phi > (6 * 2 * PI / 32.)) {
2521 Fcorr = 1.022;
2522 }
2523 }
2524
2525 else if (eta < 1.4 && eta > 1.2) {
2526 if (phi < (-11 * 2 * PI / 32.) && phi > (-12 * 2 * PI / 32.)) {
2527 Fcorr = 1.038;
2528 }
2529 }
2530
2531 else if (eta < 2.0 && eta > 1.9) {
2532 if (phi < (10 * 2 * PI / 32.) && phi > (9 * 2 * PI / 32.)) {
2533 Fcorr = 1.029;
2534 }
2535 }
2536
2537 else if (eta < -1.2 && eta > -1.4) {
2538 if (phi < (-4 * 2 * PI / 32.) && phi > (-5 * 2 * PI / 32.)) {
2539 Fcorr = 1.048;
2540 } else if (phi < (-6 * 2 * PI / 32.) && phi > (-7 * 2 * PI / 32.)) {
2541 Fcorr = 1.048;
2542 }
2543 }
2544
2545 else if (eta < -1.6 && eta > -1.8) {
2546 if (phi < (9 * 2 * PI / 32.) && phi > (8 * 2 * PI / 32.)) {
2547 Fcorr = 1.024;
2548 }
2549 }
2550
2551 else if (eta < -2.3 && eta > -2.5) {
2552 if (phi < (-8 * 2 * PI / 32.) && phi > (-9 * 2 * PI / 32.)) {
2553 Fcorr = 1.037;
2554 } else if (phi < (5 * 2 * PI / 32.) && phi > (4 * 2 * PI / 32.)) {
2555 Fcorr = 1.031;
2556 } else if (phi < (9 * 2 * PI / 32.) && phi > (8 * 2 * PI / 32.)) {
2557 Fcorr = 1.040;
2558 } else if (phi < (10 * 2 * PI / 32.) && phi > (9 * 2 * PI / 32.)) {
2559 Fcorr = 1.030;
2560 } else if (phi < (11 * 2 * PI / 32.) && phi > (10 * 2 * PI / 32.)) {
2561 Fcorr = 1.020;
2562 }
2563 }
2564 }
2565
2566 return Fcorr;
2567}
#define M_PI
Scalar eta() const
pseudorapidity method
const float PI

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ DoubleOrAbsEtaCaloPredicateFactory()

const EgammaPredicate CP::EgammaCalibrationAndSmearingTool::DoubleOrAbsEtaCaloPredicateFactory ( double eta1_min,
double eta1_max,
double eta2_min,
double eta2_max ) const
inlineprivate

◆ endInputFile()

StatusCode asg::AsgMetadataTool::endInputFile ( )
protectedvirtualinherited

Function called when the currently open input file got completely processed.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 193 of file AsgMetadataTool.cxx.

193 {
194
195 // Return gracefully:
196 return StatusCode::SUCCESS;
197 }

◆ EtaCaloPredicateFactory()

const EgammaPredicate CP::EgammaCalibrationAndSmearingTool::EtaCaloPredicateFactory ( double eta_min,
double eta_max ) const
inlineprivate

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getElectronMomentum()

double CP::EgammaCalibrationAndSmearingTool::getElectronMomentum ( const xAOD::Electron * el,
const xAOD::EventInfo * event_info )
virtual

Definition at line 1290 of file EgammaCalibrationAndSmearingTool.cxx.

1291 {
1294 ? m_simulation
1296
1297 const xAOD::TrackParticle* eTrack = el->trackParticle();
1298
1299 // track momentum and eta
1300 const float el_tracketa = eTrack->eta();
1301 const float el_trackmomentum = eTrack->pt() * cosh(el->eta());
1302
1303 return m_rootTool->getCorrectedMomentum(
1304 dataType, PATCore::ParticleType::Electron, el_trackmomentum, el_tracketa,
1305 oldtool_scale_flag_this_event(*el, *event_info), m_varSF);
1306}
bool eventType(EventType type) const
Check for one particular bitmask value.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ getEnergy() [1/3]

double CP::EgammaCalibrationAndSmearingTool::getEnergy ( const xAOD::Electron & input) const
private

Definition at line 990 of file EgammaCalibrationAndSmearingTool.cxx.

991 {
992 xAOD::Electron* new_particle = nullptr;
993 ANA_CHECK_THROW(correctedCopy(input, new_particle));
994 const double e = new_particle->e();
995 delete new_particle;
996 return e;
997}
#define ANA_CHECK_THROW(EXP)
check whether the given expression was successful, throwing an exception on failure
virtual CP::CorrectionCode correctedCopy(const xAOD::Electron &, xAOD::Electron *&) const override
virtual double e() const override
The total energy of the particle.
Definition Egamma_v1.cxx:86

◆ getEnergy() [2/3]

double CP::EgammaCalibrationAndSmearingTool::getEnergy ( const xAOD::Photon & input) const
private

Definition at line 981 of file EgammaCalibrationAndSmearingTool.cxx.

982 {
983 xAOD::Photon* new_particle = nullptr;
984 ANA_CHECK_THROW(correctedCopy(input, new_particle));
985 const double e = new_particle->e();
986 delete new_particle;
987 return e;
988}
virtual double e() const override final
The total energy of the particle.
Definition Photon_v1.cxx:46

◆ getEnergy() [3/3]

double CP::EgammaCalibrationAndSmearingTool::getEnergy ( xAOD::Egamma * p,
const xAOD::EventInfo * event_info )
virtual

Definition at line 1262 of file EgammaCalibrationAndSmearingTool.cxx.

1263 {
1264 ANA_CHECK_THROW(applyCorrection(*p, *event_info));
1265 ATH_MSG_DEBUG("returning " << p->e());
1266 return p->e();
1267}

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getRandomSeedFunction()

const IdFunction CP::EgammaCalibrationAndSmearingTool::getRandomSeedFunction ( ) const
inlineprivate

Definition at line 241 of file EgammaCalibrationAndSmearingTool.h.

241{ return m_set_seed_function; }

◆ getResolution()

double CP::EgammaCalibrationAndSmearingTool::getResolution ( const xAOD::Egamma & particle,
bool withCT = true ) const
overridevirtual

Implements CP::IEgammaCalibrationAndSmearingTool.

Definition at line 926 of file EgammaCalibrationAndSmearingTool.cxx.

927 {
928 const auto ptype = xAOD2ptype(particle);
929 const auto cl_etaCalo =
930 xAOD::get_eta_calo(*particle.caloCluster(), particle.author());
931
932 return m_rootTool->resolution(particle.e(), particle.caloCluster()->eta(),
933 cl_etaCalo, ptype, withCT,
934 false); // TODO: always for full simulation
935}
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
float get_eta_calo(const xAOD::CaloCluster &cluster, int author, bool do_throw=false)

◆ handle()

void asg::AsgMetadataTool::handle ( const Incident & inc)
protectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent.

Reimplemented in Trig::TrigDecisionTool.

Definition at line 135 of file AsgMetadataTool.cxx.

135 {
136
137 // Tell the user what's happening:
138 ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
139
140 // Call the appropriate member function:
141 if( inc.type() == IncidentType::BeginInputFile ) {
143 if( beginInputFile().isFailure() ) {
144 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
145 throw std::runtime_error( "Couldn't call beginInputFile()" );
146 }
147 } else if( inc.type() == IncidentType::EndInputFile ) {
148 if( endInputFile().isFailure() ) {
149 ATH_MSG_FATAL( "Failed to call endInputFile()" );
150 throw std::runtime_error( "Couldn't call endInputFile()" );
151 }
152 } else if( inc.type() == IncidentType::BeginEvent ) {
153 // If the tool didn't catch the begin input file incident for the
154 // first input file of the job, then call the appropriate function
155 // now.
156 if( ! m_beginInputFileCalled ) {
158 if( beginInputFile().isFailure() ) {
159 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
160 throw std::runtime_error( "Couldn't call beginInputFile()" );
161 }
162 }
163 if( beginEvent().isFailure() ) {
164 ATH_MSG_FATAL( "Failed to call beginEvent()" );
165 throw std::runtime_error( "Couldn't call beginEvent()" );
166 }
167
168 #ifdef XAOD_STANDALONE
169 } else if( inc.type() == IncidentType::MetaDataStop ) {
170 if( metaDataStop().isFailure() ) {
171 ATH_MSG_FATAL( "Failed to call metaDataStop()" );
172 throw std::runtime_error( "Couldn't call metaDataStop()" );
173 }
174
175 #endif // XAOD_STANDALONE
176 } else {
177 ATH_MSG_WARNING( "Unknown incident type received in AsgMetaDataTool: " << inc.type() );
178 }
179
180 return;
181 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
virtual StatusCode beginInputFile()
Function called when a new input file is opened.
virtual StatusCode beginEvent()
Function called when a new events is loaded.
bool m_beginInputFileCalled
Flag helping to discover when the tool misses the opening of the first input file.
virtual StatusCode endInputFile()
Function called when the currently open input file got completely processed.
virtual StatusCode metaDataStop()
Function called when the tool should write out its metadata.

◆ initialize()

StatusCode CP::EgammaCalibrationAndSmearingTool::initialize ( void )
overrideprivatevirtual

Implements CP::IEgammaCalibrationAndSmearingTool.

Definition at line 366 of file EgammaCalibrationAndSmearingTool.cxx.

366 {
367 ATH_MSG_INFO("Initialization");
368
369 if (m_ESModel == "es2015XX") {
370 ATH_MSG_ERROR("es2015XX is deprecated. Use es2015PRE");
371 }
372
373 if (m_ESModel == "es2010") {
375 } // legacy
376 else if (m_ESModel == "es2011c") {
378 } // mc11c : faulty G4; old geometry
379 else if (m_ESModel == "es2011d") {
381 } // mc11d : corrected G4; new geometry == final Run1 scheme
382 else if (m_ESModel == "es2012a") {
384 } // mc12a : "crude" G4 fix; old geometry
385 else if (m_ESModel == "es2012c") {
387 } // mc12c : corrected G4; new geometry == final Run1 scheme
388 else if (m_ESModel == "es2012XX") {
390 } else if (m_ESModel == "es2015PRE") {
392 } else if (m_ESModel == "es2015PRE_res_improved") {
394 } else if (m_ESModel == "es2015cPRE") {
396 } else if (m_ESModel == "es2015cPRE_res_improved") {
398 } else if (m_ESModel == "es2015c_summer") {
400 } else if (m_ESModel == "es2016PRE") {
402 } else if (m_ESModel == "es2016data_mc15c") {
404 } else if (m_ESModel == "es2016data_mc15c_summer") {
406 } else if (m_ESModel == "es2016data_mc15c_summer_improved") {
408 } else if (m_ESModel == "es2016data_mc15c_final") {
410 } else if (m_ESModel == "es2015_5TeV") {
412 } else if (m_ESModel == "es2017_R21_PRE") {
414 } else if (m_ESModel == "es2017_R21_v0") {
416 } else if (m_ESModel == "es2017_R21_v1") {
418 } else if (m_ESModel == "es2017_R21_ofc0_v1") {
420 } else if (m_ESModel == "es2018_R21_v0") {
422 } else if (m_ESModel == "es2018_R21_v1") {
424 } else if (m_ESModel == "es2022_R22_PRE") {
426 } else if (m_ESModel == "es2023_R22_Run2_v0") {
428 } else if (m_ESModel == "es2023_R22_Run2_v1") {
430 } else if (m_ESModel == "es2024_Run3_ofc0_v0") {
432 } else if (m_ESModel == "es2024_Run3_v0") {
434 } else if (m_ESModel == "es2025_Run3_GNN_v0") {
436 } else if (m_ESModel.empty()) {
437 ATH_MSG_ERROR("you must set ESModel property");
438 return StatusCode::FAILURE;
439 } else {
440 ATH_MSG_ERROR("Cannot understand model " << m_ESModel);
441 return StatusCode::FAILURE;
442 }
443
444 if (m_ResolutionType == "Gaussian") {
446 } else if (m_ResolutionType == "SigmaEff80") {
448 } else if (m_ResolutionType == "SigmaEff90") {
450 } else {
451 ATH_MSG_ERROR("Cannot understand resolution " << m_ResolutionType);
452 return StatusCode::FAILURE;
453 }
454
455 if (m_use_AFII != -1) {
457 "Property useAFII is deprecated. It is now replaced with useFastSim, "
458 "which should be explicitly configured");
459 return StatusCode::FAILURE;
460 }
461
462 if (m_useFastSim == 1) {
464 } else if (m_useFastSim == 0) {
466 } else {
467 ATH_MSG_ERROR("Property useFastSim should be explicitly configured");
468 return StatusCode::FAILURE;
469 }
470
474 "Sample is FastSim but no AF3 calibration is supported with "
475 "MC23 pre-recommendations (es2022_R22_PRE and es2024_Run3_ofc0_v0). "
476 "Please swtich to Run3 consolidated recommendations (es2024_Run3_v0), "
477 "or get in touch with the EGamma CP group in case you are using this");
478 return StatusCode::FAILURE;
479 }
480
481 // configure decorrelation model, translate string property to internal class
482 // enum
483 /* S R SR
484 0. 0 0 0 WARNING Full, Full (this is the default without configuration)
485 1. 0 0 1 SR
486 2. 0 1 0 FATAL
487 3. 0 1 1 WARNING SR then R
488 4. 1 0 0 FATAL
489 5. 1 0 1 WARNING SR then S
490 6. 1 1 0 S, R
491 7. 1 1 1 FATAL
492 */
493 if (m_decorrelation_model_name.empty() and
496 // case 0
497 ATH_MSG_WARNING("no decorrelation model specified, assuming full model");
498 m_decorrelation_model_scale = ScaleDecorrelation::FULL;
500 m_decorrelation_model_name = "FULL_v1";
501 } else if (not m_decorrelation_model_name.empty() and
504 // case 7
505 ATH_MSG_FATAL("too many flags for the decorrelation model");
506 return StatusCode::FAILURE;
507 } else {
508 // set scale decorrelation model
509 if (not m_decorrelation_model_scale_name.empty()) { // case 4, 5, 6, (7)
510 if (not m_decorrelation_model_name.empty()) {
512 "flag decorrelation model ignored for scale decorrelation model");
513 } // case 5
514 if (m_decorrelation_model_scale_name == "1NP_v1")
515 m_decorrelation_model_scale = ScaleDecorrelation::ONENP;
516 else if (m_decorrelation_model_scale_name == "FULL_ETACORRELATED_v1")
517 m_decorrelation_model_scale = ScaleDecorrelation::FULL_ETA_CORRELATED;
518 else if (m_decorrelation_model_scale_name == "1NPCOR_PLUS_UNCOR")
519 m_decorrelation_model_scale = ScaleDecorrelation::ONENP_PLUS_UNCONR;
520 else if (m_decorrelation_model_scale_name == "FULL_v1")
521 m_decorrelation_model_scale = ScaleDecorrelation::FULL;
522 else {
523 ATH_MSG_FATAL("cannot understand the scale decorrelation model '"
524 << m_decorrelation_model_scale_name << "'(typo?)");
525 return StatusCode::FAILURE;
526 }
527 } else if (not m_decorrelation_model_name.empty()) { // case 1, 3
528 if (m_decorrelation_model_name == "1NP_v1")
529 m_decorrelation_model_scale = ScaleDecorrelation::ONENP;
530 else if (m_decorrelation_model_name == "FULL_ETACORRELATED_v1")
531 m_decorrelation_model_scale = ScaleDecorrelation::FULL_ETA_CORRELATED;
532 else if (m_decorrelation_model_name == "1NPCOR_PLUS_UNCOR")
533 m_decorrelation_model_scale = ScaleDecorrelation::ONENP_PLUS_UNCONR;
534 else if (m_decorrelation_model_name == "FULL_v1")
535 m_decorrelation_model_scale = ScaleDecorrelation::FULL;
536 else {
537 ATH_MSG_FATAL("cannot understand the decorrelation model '"
538 << m_decorrelation_model_name << "'(typo?)");
539 return StatusCode::FAILURE;
540 }
541 } else { // case 2, (7)
543 "not information how to initialize the scale decorrelation model");
544 return StatusCode::FAILURE;
545 }
546
547 // set resolution decorralation model
549 .empty()) { // case 2, 3, 6, (7)
550 if (not m_decorrelation_model_name.empty()) {
552 "flag decorrelation model ignored for resolution decorrelation "
553 "model");
554 } // case 3
557 else if (m_decorrelation_model_resolution_name == "FULL_v1")
559 else {
560 ATH_MSG_FATAL("cannot understand the resolution decorrelation model '"
562 return StatusCode::FAILURE;
563 }
564 } else if (not m_decorrelation_model_name.empty()) { // case 1, 5
565 if (m_decorrelation_model_name == "1NP_v1")
567 else if (m_decorrelation_model_name == "FULL_ETACORRELATED_v1")
569 else if (m_decorrelation_model_name == "1NPCOR_PLUS_UNCOR")
571 else if (m_decorrelation_model_name == "FULL_v1")
573 else {
574 ATH_MSG_FATAL("cannot understand the decorrelation model '"
575 << m_decorrelation_model_name << "'(typo?)");
576 return StatusCode::FAILURE;
577 }
578 }
579 }
580
581 // create correction tool
582 ATH_MSG_DEBUG("creating internal correction tool");
583 m_rootTool = std::make_unique<AtlasRoot::egammaEnergyCorrectionTool>();
584 if (!m_rootTool) {
585 ATH_MSG_ERROR("Cannot initialize underlying tool");
586 return StatusCode::FAILURE;
587 }
588 m_rootTool->setESModel(m_TESModel);
589
595 "Using linear interpolation in the gain tool (uncertainties only)");
597 m_rootTool->setApplyL2GainInterpolation();
598 }
599 m_rootTool->msg().setLevel(this->msg().level());
600 m_rootTool->initialize();
601
602 // configure MVA calibration
603 if (m_use_mva_calibration != 0) {
604 ATH_MSG_DEBUG("creating MVA calibration tool (if needed)");
605 if (m_MVAfolder.empty()) { // automatically configure MVA tool
607 }
608
609 if (not m_MVAfolder.empty()) {
610
611 // electron MVA tool
612 asg::AsgToolConfig config_mva_electron(
613 "egammaMVACalibTool/tool_mva_electron");
614 config_mva_electron.setPropertyFromString("folder", m_MVAfolder);
615 ATH_CHECK(config_mva_electron.setProperty("use_layer_corrected", true));
616 ATH_CHECK(config_mva_electron.setProperty(
617 "ParticleType", xAOD::EgammaParameters::electron));
618
619 // unconverted photon MVA tool
620 asg::AsgToolConfig config_mva_unconverted(
621 "egammaMVACalibTool/tool_mva_unconverted");
622 config_mva_unconverted.setPropertyFromString("folder", m_MVAfolder);
623 ATH_CHECK(
624 config_mva_unconverted.setProperty("use_layer_corrected", true));
625 ATH_CHECK(config_mva_unconverted.setProperty(
627 ATH_CHECK(config_mva_unconverted.setProperty("OutputLevel",
628 this->msg().level()));
629
630 // converted photon MVA tool
631 asg::AsgToolConfig config_mva_converted(
632 "egammaMVACalibTool/tool_mva_converted");
633 config_mva_converted.setPropertyFromString("folder", m_MVAfolder);
634 ATH_CHECK(config_mva_converted.setProperty("use_layer_corrected", true));
635 ATH_CHECK(config_mva_converted.setProperty(
637 ATH_CHECK(config_mva_converted.setProperty("OutputLevel",
638 this->msg().level()));
639
640 // initialize the ServiceHandler egammaMVASvc
641 // make the name unique
642 std::ostringstream mva_service_name;
643 mva_service_name << "egammaMVASvc/service_mva_egamma_id"
644 << (void const*)this;
645 asg::AsgServiceConfig config_mva_service(mva_service_name.str());
646 ATH_CHECK(config_mva_service.addPrivateTool("ElectronTool",
647 config_mva_electron));
648 ATH_CHECK(config_mva_service.addPrivateTool("UnconvertedPhotonTool",
649 config_mva_unconverted));
650 ATH_CHECK(config_mva_service.addPrivateTool("ConvertedPhotonTool",
651 config_mva_converted));
652 // fwd electron MVA tool
653 if (m_doFwdCalib) {
654 asg::AsgToolConfig config_mva_fwdelectron(
655 "egammaMVACalibTool/tool_mva_fwdelectron");
656 config_mva_fwdelectron.setPropertyFromString("folder", m_MVAfolder);
657 ATH_CHECK(config_mva_fwdelectron.setProperty(
659 ATH_CHECK(config_mva_fwdelectron.setProperty("ShiftType", 0));
660 ATH_CHECK(config_mva_fwdelectron.setProperty("OutputLevel", this->msg().level()));
661 ATH_CHECK(config_mva_service.addPrivateTool("FwdElectronTool",
662 config_mva_fwdelectron));
663 }
664 config_mva_service.setPropertyFromString("folder", m_MVAfolder);
665 ATH_CHECK(
666 config_mva_service.setProperty("OutputLevel", this->msg().level()));
667 ATH_CHECK(config_mva_service.makeService(m_MVACalibSvc));
670 "WIP: testing GNN based calibration for Run3,"
671 "requring decorated GNN energy (gnn_energy) from input,"
672 "which should already have the layer calibration applied");
673 } else {
674 m_use_mva_calibration = false;
675 }
676 }
677
678 // configure layer recalibration tool
679 // For now: layer recalibration not applied to PRE release 21 (using run 1
680 // based calibration applied at reco level)
681 // for following R21 recommendations, need to apply the run2/run1 layer
682 // calibration ratio
683 if (m_ESModel == "es2017_R21_PRE") {
684 ATH_MSG_INFO("Layer recalibration already applied at cell level");
685 m_useLayerCorrection = false;
686 } else if (!m_useLayerCorrection) {
687 ATH_MSG_INFO("Layer corrections disabled!");
688 } else {
689 ATH_MSG_DEBUG("initializing layer recalibration tool (if needed)");
691 .empty()) { // automatically configure layer recalibration tool
694 .release();
696 ATH_MSG_INFO("not using layer recalibration");
697 }
698 } else {
700 new egammaLayerRecalibTool(m_layer_recalibration_tune, m_useSaccCorrection);
701 }
703 m_layer_recalibration_tool->msg().setLevel(this->msg().level());
705 if (!m_usePSCorrection) {
706 ATH_MSG_INFO("PS corrections disabled!");
707 m_layer_recalibration_tool->disable_PSCorrections();
708 }
709 if (!m_useS12Correction) {
710 ATH_MSG_INFO("S12 corrections disabled!");
711 m_layer_recalibration_tool->disable_S12Corrections();
712 }
713 if (!m_useSaccCorrection) {
714 ATH_MSG_INFO("Sacc corrections disabled!");
715 m_layer_recalibration_tool->disable_SaccCorrections();
716 }
717 }
718 }
719
721 m_rootTool->use_temp_correction201215(m_use_temp_correction201215);
723 m_rootTool->use_uA2MeV_2015_first2weeks_correction(
726 m_decorrelation_model_scale == ScaleDecorrelation::FULL) {
727 m_rootTool->useStatErrorScaling(true);
728 }
729
731 ATH_MSG_ERROR("ep combination not supported yet");
732 throw std::runtime_error("ep combination not supported yet");
733 }
734
737 }
740 }
742
743 if (m_useGainCorrection == AUTO) {
748 }
749 else {
750 ATH_MSG_DEBUG("initializing gain tool");
753 }
754 }
755 else if (m_useGainCorrection == 1) {
761 "cannot instantiate gain tool for this model (you can only disable "
762 "the gain tool, but not enable it)");
763 }
764 else {
766 "initializing gain tool for run2 final precision recommendations");
768 "Gain corrections required but Zee scales are derived without Gain, "
769 "will cause inconsistency!");
770 std::string gain_tool_run_2_filename = PathResolverFindCalibFile(
771 "ElectronPhotonFourMomentumCorrection/v29/"
772 "gain_uncertainty_specialRun.root");
773 m_gain_tool_run2 = std::make_unique<egGain::GainUncertainty>(
774 gain_tool_run_2_filename, false, "GainCorrection",
776 m_gain_tool_run2->msg().setLevel(this->msg().level());
777 }
778 }
779
784 // ADC non linearity correction
787 std::string adcLinearityCorr_filename = PathResolverFindCalibFile(
788 "ElectronPhotonFourMomentumCorrection/v25/linearity_ADC.root");
789 m_ADCLinearity_tool = std::make_shared<LinearityADC>(adcLinearityCorr_filename);
790 m_ADCLinearity_tool->msg().setLevel(this->msg().level());
791 m_rootTool->setADCTool(m_ADCLinearity_tool);
792 } else {
794 m_ESModel + " recommendations use ADC corrections for scale "
795 "derivation. Disabling the ADCLinearity flag will create "
796 "inconsistency!");
797 }
798
801 m_rootTool->setApplyLeakageCorrection(true);
802 }
803
804 // Calo distortion phi unif correction
808 std::string phiUnifCorrfileName = PathResolverFindCalibFile(
809 "ElectronPhotonFourMomentumCorrection/v33/"
810 "egammaEnergyCorrectionData.root");
811 std::unique_ptr<TFile> fCorr(
812 TFile::Open(phiUnifCorrfileName.c_str(), "READ"));
814 dynamic_cast<TH2*>(fCorr->Get("CaloDistortionPhiUniformityCorrection/"
815 "es2023_R22_Run2_v0/h2DcorrPhiUnif")));
816 m_caloDistPhiUnifCorr->SetDirectory(nullptr);
817 } else {
819 m_ESModel + " recommendations use CaloDistPhiUnif for scale "
820 "derivation. Disabling the CaloDistPhiUnif flag will create "
821 "inconsistency!");
822 }
823 }
824
825 // No scale correction for release 21 ==> obsolete
826 /*if (m_ESModel == "es2017_R21_PRE"){
827 m_doScaleCorrection = 0;
828 }
829 */
830
831 ATH_MSG_INFO("ESModel: " << m_ESModel);
832 ATH_MSG_INFO("ResolutionType: " << m_ResolutionType);
833 ATH_MSG_INFO("decorrelation Model: " << m_decorrelation_model_name);
834 ATH_MSG_DEBUG("layer correction = " << m_useLayerCorrection);
835 ATH_MSG_DEBUG("PS correction = " << m_usePSCorrection);
836 ATH_MSG_DEBUG("S12 correction = " << m_useS12Correction);
837 ATH_MSG_DEBUG("Sacc correction = " << m_useSaccCorrection);
838 ATH_MSG_DEBUG("intermodule correction = " << m_useIntermoduleCorrection);
839 ATH_MSG_DEBUG("phi uniformity correction = " << m_usePhiUniformCorrection);
840 ATH_MSG_DEBUG("distorted calo phi uniformity correction = "
842 ATH_MSG_DEBUG("gain correction = " << m_useGainCorrection);
843 ATH_MSG_DEBUG("ADC non-linearity correction = " << m_doADCLinearityCorrection);
844 ATH_MSG_DEBUG("leakage correction for photons = " << m_doLeakageCorrection);
845 ATH_MSG_DEBUG("smearing = " << m_doSmearing);
846 ATH_MSG_DEBUG("insitu scales = " << m_doScaleCorrection);
847 ATH_MSG_DEBUG("ep combination = " << m_use_ep_combination);
848 ATH_MSG_DEBUG("use MVA calibration = " << m_use_mva_calibration);
850 "use temperature correction 2015 = " << m_use_temp_correction201215);
851 ATH_MSG_DEBUG("use uA2MeV correction 2015 1/2 week = "
853
855
856 applySystematicVariation(CP::SystematicSet())
857 .ignore(); // this set the flags for the internal tool without
858 // systematics
859 CP::SystematicRegistry& registry = CP::SystematicRegistry::getInstance();
860 if (registry.registerSystematics(*this) != StatusCode::SUCCESS)
861 return StatusCode::FAILURE;
862
863 if (m_onlyElectrons.value() && m_onlyPhotons.value()) {
864 ATH_MSG_ERROR("Cannot select both onlyElectrons and onlyPhotons");
865 return StatusCode::FAILURE;
866 }
867 if (m_onlyElectrons.value()) {
870 resetAccessor (m_accessors->electronTrackAcc, *this, "trackParticleLinks");
871 }
872 }
873 if (m_onlyPhotons.value()) {
875 resetAccessor (m_accessors->photonVertexAcc, *this, "vertexLinks");
876 }
877 if (m_decorateEmva)
878 resetAccessor (m_accessors->decEmva, *this, "E_mva_only");
879
880 ANA_CHECK (initializeColumns ());
881
882 return StatusCode::SUCCESS;
883}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ANA_CHECK(EXP)
check whether the given expression was successful
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
static const Attributes_t empty
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig) override
effects: configure this tool for the given list of systematic variations.
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
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)
void resetElectron(MomentumAccessors< CI, CM > &accessors, ColumnarTool< CM > &columnarTool)
void resetPhoton(MomentumAccessors< CI, CM > &accessors, ColumnarTool< CM > &columnarTool)
void resetAccessor(AccessorTemplate< CI, CT, CAM, CM > &accessor, ColumnarTool< CM > &columnBase, const std::string &name, ColumnAccessorOptions &&options={})
reset a column accessor to point to a new column
setBGCode setTAP setLVL2ErrorBits bool
MsgStream & msg
Definition testRead.cxx:32

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ inputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore ( ) const
inherited

Accessor for the input metadata store.

Definition at line 93 of file AsgMetadataTool.cxx.

93 {
94
95#ifdef XAOD_STANDALONE
96 return &m_inputMetaStore;
97#else // XAOD_STANDALONE
98 return m_inputMetaStore;
99#endif // XAOD_STANDALONE
100 }
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.

◆ intermodule_correction()

double CP::EgammaCalibrationAndSmearingTool::intermodule_correction ( double Ecl,
double phi,
double eta ) const

Definition at line 2214 of file EgammaCalibrationAndSmearingTool.cxx.

2215 {
2216
2217 // Intermodule Widening Correction: E_corr = E / (a' - b' * ((1 / (1 +
2218 // exp((phi_mod - 2 * pi / 32) * c))) * (1 / (1 + exp((phi_mod - 2 * pi / 32)
2219 // * (d)))))) (phi_min, phi_max) : [a' = a / a, b' = b / a, c, d]
2220
2221 double Ecl_corr = 0.;
2222 int DivInt = 0;
2223 double pi = M_PI;
2224
2238
2239 double phi_mod = 0;
2240 if (phi < 0)
2241 phi_mod = fmod(phi, 2 * pi / 16.) + pi / 8.;
2242 else
2243 phi_mod = fmod(phi, 2 * pi / 16.);
2244
2245 // The correction concerns only the barrel
2246 if (std::abs(eta) <= 1.37) {
2247
2248 if (phi < (-7 * pi / 8) && phi > (-1 * pi))
2249 Ecl_corr =
2250 Ecl /
2251 (1 - 0.1086 *
2252 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 175.2759))) *
2253 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-189.3612))))));
2254 if (phi < (-6 * pi / 8) && phi > (-7 * pi / 8))
2255 Ecl_corr =
2256 Ecl /
2257 (1 - 0.0596 *
2258 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 170.8305))) *
2259 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-233.3782))))));
2260 if (phi < (-5 * pi / 8) && phi > (-6 * pi / 8))
2261 Ecl_corr =
2262 Ecl /
2263 (1 - 0.0596 *
2264 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 147.1451))) *
2265 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-139.3386))))));
2266 if (phi < (-4 * pi / 8) && phi > (-5 * pi / 8))
2267 Ecl_corr =
2268 Ecl /
2269 (1 - 0.0583 *
2270 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 168.4644))) *
2271 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-246.2897))))));
2272 if (phi < (-3 * pi / 8) && phi > (-4 * pi / 8))
2273 Ecl_corr =
2274 Ecl /
2275 (1 - 0.0530 *
2276 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 177.6703))) *
2277 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-198.3227))))));
2278 if (phi < (-2 * pi / 8) && phi > (-3 * pi / 8))
2279 Ecl_corr =
2280 Ecl /
2281 (1 - 0.0672 *
2282 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 145.0693))) *
2283 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-242.1771))))));
2284 if (phi < (-1 * pi / 8) && phi > (-2 * pi / 8))
2285 Ecl_corr =
2286 Ecl /
2287 (1 - 0.0871 *
2288 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 132.3303))) *
2289 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-166.1833))))));
2290 if (phi < (0 * pi / 8) && phi > (-1 * pi / 8))
2291 Ecl_corr =
2292 Ecl /
2293 (1 - 0.0948 *
2294 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 127.6780))) *
2295 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-150.0700))))));
2296 if (phi < (1 * pi / 8) && phi > (0 * pi / 8))
2297 Ecl_corr =
2298 Ecl /
2299 (1 - 0.1166 *
2300 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 172.0679))) *
2301 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-235.3293))))));
2302 if (phi < (2 * pi / 8) && phi > (1 * pi / 8))
2303 Ecl_corr =
2304 Ecl /
2305 (1 - 0.1172 *
2306 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 190.3524))) *
2307 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-198.9400))))));
2308 if (phi < (3 * pi / 8) && phi > (2 * pi / 8))
2309 Ecl_corr =
2310 Ecl /
2311 (1 - 0.1292 *
2312 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 158.0540))) *
2313 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-165.3893))))));
2314 if (phi < (4 * pi / 8) && phi > (3 * pi / 8))
2315 Ecl_corr =
2316 Ecl /
2317 (1 - 0.1557 *
2318 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 162.2793))) *
2319 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-133.5131))))));
2320 if (phi < (5 * pi / 8) && phi > (4 * pi / 8))
2321 Ecl_corr =
2322 Ecl /
2323 (1 - 0.1659 *
2324 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 180.5270))) *
2325 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-168.5074))))));
2326 if (phi < (6 * pi / 8) && phi > (5 * pi / 8))
2327 Ecl_corr =
2328 Ecl /
2329 (1 - 0.1123 *
2330 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 128.2277))) *
2331 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-154.4455))))));
2332 if (phi < (7 * pi / 8) && phi > (6 * pi / 8))
2333 Ecl_corr =
2334 Ecl /
2335 (1 - 0.1394 *
2336 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 192.1216))) *
2337 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-198.0727))))));
2338 if (phi < (8 * pi / 8) && phi > (7 * pi / 8))
2339 Ecl_corr =
2340 Ecl /
2341 (1 - 0.1001 *
2342 ((1 / (1 + exp((phi_mod - 2 * pi / 32.) * 199.1735))) *
2343 (1 / (1 + exp((phi_mod - 2 * pi / 32.) * (-176.4056))))));
2344 }
2345
2346 // No correction for the EC
2347 else {
2348 Ecl_corr = Ecl;
2349 }
2350
2351 }
2352
2353 else {
2354
2355 // Definitions of module folding into four quarters (top, left, bottom and
2356 // right)
2357
2358 DivInt = (int)(phi / ((2 * pi) / 16.));
2359 double phi_mod = phi - DivInt * (2 * pi / 16.);
2360
2361 // Centring on the intermodule --> phi_mod will now be in [0,0.4]
2362 if (phi_mod < 0)
2363 phi_mod += pi / 8.;
2364
2365 // The correction concerns only the barrel
2366 if (std::abs(eta) <= 1.4) {
2367
2368 // Top quarter
2369 if (phi < (3 * pi) / 4. && phi >= pi / 4.) {
2370 Ecl_corr =
2371 Ecl / (1 - 0.131 * ((1 / (1 + exp((phi_mod - 0.2) * 199.08))) *
2372 (1 / (1 + exp((phi_mod - 0.2) * (-130.36))))));
2373 }
2374
2375 // Right quarter
2376 if (phi < pi / 4. && phi >= -pi / 4.) {
2377 Ecl_corr =
2378 Ecl / (1 - 0.0879 * ((1 / (1 + exp((phi_mod - 0.2) * 221.01))) *
2379 (1 / (1 + exp((phi_mod - 0.2) * (-149.51))))));
2380 }
2381 // Bottom quarter
2382 if (phi < -pi / 4. && phi >= (-3 * pi) / 4.) {
2383 Ecl_corr =
2384 Ecl / (1 - 0.0605 * ((1 / (1 + exp((phi_mod - 0.2) * 281.37))) *
2385 (1 / (1 + exp((phi_mod - 0.2) * (-170.29))))));
2386 }
2387 // Left quarter
2388 if ((phi < (-3 * pi) / 4.) || (phi >= (3 * pi) / 4.)) {
2389 Ecl_corr =
2390 Ecl / (1 - 0.102 * ((1 / (1 + exp((phi_mod - 0.2) * 235.37))) *
2391 (1 / (1 + exp((phi_mod - 0.2) * (-219.04))))));
2392 }
2393 }
2394
2395 // No correction for the EC
2396 else {
2397 Ecl_corr = Ecl;
2398 }
2399 }
2400
2401 return Ecl_corr;
2402}
#define pi
setRawEt setRawPhi int

◆ isAffectedBySystematic()

bool CP::EgammaCalibrationAndSmearingTool::isAffectedBySystematic ( const CP::SystematicVariation & systematic) const
overrideprivatevirtual

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 1308 of file EgammaCalibrationAndSmearingTool.cxx.

1309 {
1310 CP::SystematicSet sys = affectingSystematics();
1311 return sys.find(systematic) != sys.end();
1312}
virtual CP::SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by

◆ metaDataStop()

StatusCode asg::AsgMetadataTool::metaDataStop ( )
protectedvirtualinherited

Function called when the tool should write out its metadata.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 209 of file AsgMetadataTool.cxx.

209 {
210
211 // Return gracefully:
212 return StatusCode::SUCCESS;
213 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ oldtool_resolution_flag_this_event()

egEnergyCorr::Resolution::Variation CP::EgammaCalibrationAndSmearingTool::oldtool_resolution_flag_this_event ( columnar::EgammaId p,
columnar::EventInfoId event_info ) const
inlineprivate

Definition at line 1282 of file EgammaCalibrationAndSmearingTool.cxx.

1283 {
1284 const Accessors& acc = *m_accessors;
1285 return acc.eventTypeAcc (event_info, xAOD::EventInfo::IS_SIMULATION)
1288}

◆ oldtool_scale_flag_this_event()

egEnergyCorr::Scale::Variation CP::EgammaCalibrationAndSmearingTool::oldtool_scale_flag_this_event ( columnar::EgammaId p,
columnar::EventInfoId event_info ) const
inlineprivate

Definition at line 1270 of file EgammaCalibrationAndSmearingTool.cxx.

1271 {
1272 const Accessors& acc = *m_accessors;
1273 if (!acc.eventTypeAcc (event_info, xAOD::EventInfo::IS_SIMULATION))
1275 if (m_currentScalePredicate(*this,p))
1277 else
1279}

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ outputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore ( ) const
inherited

Accessor for the output metadata store.

Definition at line 102 of file AsgMetadataTool.cxx.

102 {
103
104#ifdef XAOD_STANDALONE
105 return &m_outputMetaStore;
106#else // XAOD_STANDALONE
107 return m_outputMetaStore;
108#endif // XAOD_STANDALONE
109 }
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.

◆ print() [1/2]

◆ print() [2/2]

◆ recommendedSystematics()

CP::SystematicSet CP::EgammaCalibrationAndSmearingTool::recommendedSystematics ( ) const
overrideprivatevirtual

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 2160 of file EgammaCalibrationAndSmearingTool.cxx.

2161 {
2162 return affectingSystematics();
2163}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ resolution()

double CP::EgammaCalibrationAndSmearingTool::resolution ( double energy,
double cl_eta,
double cl_etaCalo,
PATCore::ParticleType::Type ptype = PATCore::ParticleType::Electron,
bool withCT = false ) const
overrideprivatevirtual

Implements CP::IEgammaCalibrationAndSmearingTool.

Definition at line 937 of file EgammaCalibrationAndSmearingTool.cxx.

939 {
940 return m_rootTool->resolution(energy, cl_eta, cl_etaCalo, ptype, withCT,
941 false);
942}

◆ setPt()

void CP::EgammaCalibrationAndSmearingTool::setPt ( columnar::MutableEgammaId input,
double energy ) const
private

Definition at line 1253 of file EgammaCalibrationAndSmearingTool.cxx.

1253 {
1254 const double new_energy2 = energy * energy;
1255 const double m = m_accessors->momAcc.m (input);
1256 const double m2 = m * m;
1257 const double p2 = new_energy2 > m2 ? new_energy2 - m2 : 0.;
1258 m_accessors->ptOutDec (input) = sqrt(p2) / cosh(m_accessors->etaAcc (input));
1259 ATH_MSG_DEBUG("after setting pt, energy = " << m_accessors->momAcc.e (input));
1260}

◆ setRandomSeedFunction()

virtual void CP::EgammaCalibrationAndSmearingTool::setRandomSeedFunction ( const IdFunction && function)
inlineprivatevirtual

Definition at line 238 of file EgammaCalibrationAndSmearingTool.h.

238 {
239 m_set_seed_function = function;
240 }

◆ setupSystematics()

void CP::EgammaCalibrationAndSmearingTool::setupSystematics ( )
private

Definition at line 1327 of file EgammaCalibrationAndSmearingTool.cxx.

1327 {
1328 const EgammaPredicate always = [](const EgammaCalibrationAndSmearingTool&, columnar::EgammaId) { return true; };
1329
1330 // Try to simplify a bit for the ones that are fully correlate in eta,
1331 // whatever the model and that are not included in the macros including
1332 // - ADC non linearity
1333 // - L2Gain
1334 // - Leakage
1335 // - Conversion related
1336 // - TopoCluster threshold
1337 // - AF2
1338 // - PS_BARREL_B12
1339 // - S12EXTRALASTETABINRUN2
1340 // - ZEESTAT
1341 // - Run3 pre OFC + EXTRA
1342 if (m_decorrelation_model_scale == ScaleDecorrelation::FULL_ETA_CORRELATED ||
1343 m_decorrelation_model_scale == ScaleDecorrelation::FULL) {
1344 // Electron leakage, ADCLin, convReco only in final run2 recommendations
1348 // systematic related to ADC non linearity correction. Before 2022, there
1349 // was not correction, nor related systematic
1351 m_syst_description[CP::SystematicVariation("EG_SCALE_ADCLIN", +1)] =
1353 m_syst_description[CP::SystematicVariation("EG_SCALE_ADCLIN", -1)] =
1355 }
1356 // Gain splitted uncertainty
1357 m_syst_description[CP::SystematicVariation("EG_SCALE_L2MEDIUMGAIN", +1)] =
1359 m_syst_description[CP::SystematicVariation("EG_SCALE_L2MEDIUMGAIN", -1)] =
1361 m_syst_description[CP::SystematicVariation("EG_SCALE_L2LOWGAIN", +1)] =
1363 m_syst_description[CP::SystematicVariation("EG_SCALE_L2LOWGAIN", -1)] =
1365
1366 // Electron leakage
1367 m_syst_description[CP::SystematicVariation("EG_SCALE_LEAKAGEELEC", +1)] =
1369 m_syst_description[CP::SystematicVariation("EG_SCALE_LEAKAGEELEC", -1)] =
1371
1372 // Conversion related
1373 m_syst_description[CP::SystematicVariation("PH_SCALE_CONVRECO", +1)] =
1375 m_syst_description[CP::SystematicVariation("PH_SCALE_CONVRECO", -1)] =
1377 }
1378 // The equivalent of convReco (convefficiency and convfakerate) for other
1379 // models
1380 else {
1381 m_syst_description[CP::SystematicVariation("PH_SCALE_CONVEFFICIENCY",
1382 +1)] =
1384 m_syst_description[CP::SystematicVariation("PH_SCALE_CONVEFFICIENCY",
1385 -1)] =
1387 m_syst_description[CP::SystematicVariation("PH_SCALE_CONVFAKERATE", +1)] =
1389 m_syst_description[CP::SystematicVariation("PH_SCALE_CONVFAKERATE", -1)] =
1391 }
1392
1393 // additional systematics for R22 OFC and MC21 pre and bulk
1395 m_syst_description[CP::SystematicVariation("EG_SCALE_OFC", +1)] =
1397 m_syst_description[CP::SystematicVariation("EG_SCALE_OFC", -1)] =
1399
1400 m_syst_description[CP::SystematicVariation("EG_SCALE_EXTRARUN3PRE", +1)] =
1402 m_syst_description[CP::SystematicVariation("EG_SCALE_EXTRARUN3PRE", -1)] =
1404 }
1405
1416
1417 // topo clustr threshold systematics aded to release 21 recommendations
1418 m_syst_description[CP::SystematicVariation("EG_SCALE_TOPOCLUSTER_THRES",
1419 +1)] =
1421 m_syst_description[CP::SystematicVariation("EG_SCALE_TOPOCLUSTER_THRES",
1422 -1)] =
1424
1425 // AF3 for run3 models: es2022_R22_PRE and esmodel >= es2023_R22_Run2_v1
1426 // although we prevent AF for es2022_R22_PRE and es2024_Run3_ofc0_v0
1427 // AF3 are still technically added in the tool
1428 // but normally uncertainty will be 0
1430 m_syst_description[CP::SystematicVariation("EG_SCALE_AF3", +1)] =
1432 m_syst_description[CP::SystematicVariation("EG_SCALE_AF3", -1)] =
1434 }
1435 else {
1436 // and extra AF2 systematics for release 21 recommendations - Moriond 2018
1437 // - pending proper AF2 to FullSim correction with release 21
1438 m_syst_description[CP::SystematicVariation("EG_SCALE_AF2", +1)] =
1440 m_syst_description[CP::SystematicVariation("EG_SCALE_AF2", -1)] =
1442 }
1443 }
1444
1445 // PS correlated barrel uncertainty
1454 m_syst_description[CP::SystematicVariation("EG_SCALE_PS_BARREL_B12",
1455 +1)] =
1457 m_syst_description[CP::SystematicVariation("EG_SCALE_PS_BARREL_B12",
1458 -1)] =
1460 }
1461
1462 // additional systematic for S12 last eta bin run2
1467 m_syst_description[CP::SystematicVariation(
1468 "EG_SCALE_S12EXTRALASTETABINRUN2", +1)] =
1470 m_syst_description[CP::SystematicVariation(
1471 "EG_SCALE_S12EXTRALASTETABINRUN2", -1)] =
1473 }
1474
1475 // Zee stat, if for FULL we do not ask for m_use_full_statistical_error
1477 ScaleDecorrelation::FULL_ETA_CORRELATED or
1479 // return 1 variation only, fully correlated in eta, equal to the correct
1480 // value but scaled by sqrt(number of bins) the scaling is done by the old
1481 // tool
1482 m_syst_description[CP::SystematicVariation("EG_SCALE_ZEESTAT", +1)] =
1484 m_syst_description[CP::SystematicVariation("EG_SCALE_ZEESTAT", -1)] =
1486 }
1487 }
1488 if (m_decorrelation_model_scale == ScaleDecorrelation::ONENP) {
1489 // TODO: independet implementation of ALL UP looping on all the variations
1490 m_syst_description[CP::SystematicVariation("EG_SCALE_ALL", +1)] =
1492 m_syst_description[CP::SystematicVariation("EG_SCALE_ALL", -1)] =
1494
1495 // to be consistent with other schemes, we add
1496 // extra AF systematics in addition to the 1NP
1503 m_syst_description[CP::SystematicVariation("EG_SCALE_AF2", +1)] =
1505 m_syst_description[CP::SystematicVariation("EG_SCALE_AF2", -1)] =
1507 }
1509 m_syst_description[CP::SystematicVariation("EG_SCALE_AF3", +1)] =
1511 m_syst_description[CP::SystematicVariation("EG_SCALE_AF3", -1)] =
1513 }
1514 }
1515 else if (m_decorrelation_model_scale ==
1516 ScaleDecorrelation::FULL_ETA_CORRELATED) {
1517// all the physical effects separately, considered as fully correlated in eta
1519#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1520 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1521 SysInfo{always, flagup}; \
1522 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1523 SysInfo{always, flagdown};
1524#include "ElectronPhotonFourMomentumCorrection/systematics_es2024_Run3_v0.def"
1525#undef SYSMACRO
1526 }
1527 else {
1528// common systematics for all the esmodels
1529#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1530 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1531 SysInfo{always, flagup}; \
1532 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1533 SysInfo{always, flagdown};
1534#include "ElectronPhotonFourMomentumCorrection/systematics_S12_2022.def"
1535#undef SYSMACRO
1536 }
1537
1541 m_syst_description[CP::SystematicVariation("EG_SCALE_LARCALIB", +1)] =
1543 m_syst_description[CP::SystematicVariation("EG_SCALE_LARCALIB", -1)] =
1545 m_syst_description[CP::SystematicVariation("EG_SCALE_L2GAIN", +1)] =
1547 m_syst_description[CP::SystematicVariation("EG_SCALE_L2GAIN", -1)] =
1549 }
1550
1551 // additional systematics for S12 run2
1561 m_syst_description[CP::SystematicVariation(
1562 "EG_SCALE_LARCALIB_EXTRA2015PRE", +1)] =
1564 m_syst_description[CP::SystematicVariation(
1565 "EG_SCALE_LARCALIB_EXTRA2015PRE", -1)] =
1567 }
1568
1569 // additional systematics for temperature run1->run2
1575 m_syst_description[CP::SystematicVariation(
1576 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE", +1)] =
1578 m_syst_description[CP::SystematicVariation(
1579 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE", -1)] =
1581 }
1582
1583 // additional systematic for temperature 2015->2016
1585 m_syst_description[CP::SystematicVariation(
1586 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE", +1)] =
1588 m_syst_description[CP::SystematicVariation(
1589 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE", -1)] =
1591 }
1592
1593 // additional systematic for PP0 region
1609 m_syst_description[CP::SystematicVariation("EG_SCALE_MATPP0", +1)] =
1611 m_syst_description[CP::SystematicVariation("EG_SCALE_MATPP0", -1)] =
1613 }
1614
1615 // systematic related to wtots1
1631 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1", +1)] =
1633 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1", -1)] =
1635 }
1636
1637 // systematic for the scintillators
1656 // scintillator systematics
1657 m_syst_description[CP::SystematicVariation("EG_SCALE_E4SCINTILLATOR",
1658 +1)] =
1660 m_syst_description[CP::SystematicVariation("EG_SCALE_E4SCINTILLATOR",
1661 -1)] =
1663 }
1664
1665 } else if (m_decorrelation_model_scale ==
1666 ScaleDecorrelation::ONENP_PLUS_UNCONR) {
1667// qsum of all variations correlated 8/13 TeV + uncorrelated (additional
1668// systematics for 2015PRE or 2016) all the physical effects separately,
1669// considered as fully correlated in eta
1670// TODO: fix for es2017
1671#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1672 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1673 SysInfo{always, flagup}; \
1674 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1675 SysInfo{always, flagdown};
1676#include "ElectronPhotonFourMomentumCorrection/systematics_1NPCOR_PLUS_UNCOR.def"
1677#undef SYSMACRO
1678
1679 // additional systematic for S12 last eta bin run2 - not needed anymore for
1680 // last 20.7 model since it is part of bin per bin E1/E2 uncertainty in root
1681 // file
1685 m_syst_description[CP::SystematicVariation(
1686 "EG_SCALE_S12EXTRALASTETABINRUN2", +1)] =
1688 m_syst_description[CP::SystematicVariation(
1689 "EG_SCALE_S12EXTRALASTETABINRUN2", -1)] =
1691 }
1692
1693 } else if (m_decorrelation_model_scale == ScaleDecorrelation::FULL) {
1694 using pairvector = std::vector<std::pair<double, double>>;
1695 const pairvector decorrelation_bins_BE = {{0., 1.45}, {1.52, 2.5}};
1696 const std::vector<double> decorrelation_edges_TWELVE = {
1697 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};
1698 std::vector<double> decorrelation_edges_MODULE = {
1699 0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.37, 1.52, 1.8};
1700 const std::vector<double> decorrelation_edges_MATERIAL = {0.0, 1.1, 1.5,
1701 2.1, 2.5};
1702 std::vector<double> decorrelation_edges_S12_EXTRARUN3 = {
1703 0., 0.8, 1.5, 2.5};
1704
1705 std::vector<double> decorrelation_edges_S12;
1706 // for es2018_R21_v1 : 4 eta bins for muon E1/E2 uncertainty correlation
1708 decorrelation_edges_S12.resize(5);
1709 decorrelation_edges_S12 = {0., 1.35, 1.5, 2.4, 2.5};
1713 decorrelation_edges_S12.resize(8);
1714 decorrelation_edges_S12 = {0., 0.6, 1.0, 1.35, 1.5, 1.8, 2.4, 2.5};
1715 //
1716 // PS scale from muons, so "crack" is a bit different
1717 decorrelation_edges_MODULE[7] = 1.4;
1718 decorrelation_edges_MODULE[8] = 1.5;
1719 }
1720 // for previous run 2 muon calibration with 20.7, 5 eta bins for E1/E2
1721 // uncertainty correlation
1722 else {
1723 decorrelation_edges_S12.resize(6);
1724 decorrelation_edges_S12 = {0., 0.6, 1.4, 1.5, 2.4, 2.5};
1725 }
1726
1738#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1739 if (bool(fullcorrelated)) { \
1740 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1741 SysInfo{always, flagup}; \
1742 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1743 SysInfo{always, flagdown}; \
1744 } else { \
1745 int i = 0; \
1746 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1747 m_syst_description[CP::SystematicVariation( \
1748 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1749 m_syst_description[CP::SystematicVariation( \
1750 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1751 i += 1; \
1752 } \
1753 }
1754#include "ElectronPhotonFourMomentumCorrection/systematics.def"
1755#undef SYSMACRO
1758#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1759 if (bool(fullcorrelated)) { \
1760 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1761 SysInfo{always, flagup}; \
1762 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1763 SysInfo{always, flagdown}; \
1764 } else { \
1765 int i = 0; \
1766 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1767 m_syst_description[CP::SystematicVariation( \
1768 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1769 m_syst_description[CP::SystematicVariation( \
1770 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1771 i += 1; \
1772 } \
1773 }
1774#include "ElectronPhotonFourMomentumCorrection/systematics_S12_2022.def"
1775#undef SYSMACRO
1777#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1778 if (bool(fullcorrelated)) { \
1779 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1780 SysInfo{always, flagup}; \
1781 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1782 SysInfo{always, flagdown}; \
1783 } else { \
1784 int i = 0; \
1785 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1786 m_syst_description[CP::SystematicVariation( \
1787 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1788 m_syst_description[CP::SystematicVariation( \
1789 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1790 i += 1; \
1791 } \
1792 }
1793#include "ElectronPhotonFourMomentumCorrection/systematics_es2024_Run3_v0.def"
1794#undef SYSMACRO
1795 } else {
1796#define SYSMACRO(name, fullcorrelated, decorrelation, flagup, flagdown) \
1797 if (bool(fullcorrelated)) { \
1798 m_syst_description[CP::SystematicVariation(#name, +1)] = \
1799 SysInfo{always, flagup}; \
1800 m_syst_description[CP::SystematicVariation(#name, -1)] = \
1801 SysInfo{always, flagdown}; \
1802 } else { \
1803 int i = 0; \
1804 for (const auto& p : AbsEtaCaloPredicatesFactory(decorrelation)) { \
1805 m_syst_description[CP::SystematicVariation( \
1806 #name "__ETABIN" + std::to_string(i), +1)] = SysInfo{p, flagup}; \
1807 m_syst_description[CP::SystematicVariation( \
1808 #name "__ETABIN" + std::to_string(i), -1)] = SysInfo{p, flagdown}; \
1809 i += 1; \
1810 } \
1811 }
1812#include "ElectronPhotonFourMomentumCorrection/systematics_S12.def"
1813#undef SYSMACRO
1814 } // else
1815
1817 // statistical error, decorrelate in *all* the bins
1818 int i = 0;
1819 const TAxis& axis_statistical_error(m_rootTool->get_ZeeStat_eta_axis());
1820 for (int ibin = 1; ibin <= axis_statistical_error.GetNbins(); ++ibin) {
1822 axis_statistical_error.GetBinLowEdge(ibin),
1823 axis_statistical_error.GetBinLowEdge(ibin + 1));
1824 m_syst_description[CP::SystematicVariation(
1825 "EG_SCALE_ZEESTAT__ETABIN" + std::to_string(i), +1)] =
1827 m_syst_description[CP::SystematicVariation(
1828 "EG_SCALE_ZEESTAT__ETABIN" + std::to_string(i), -1)] =
1830 ++i;
1831 }
1832 }
1833
1834 // additional systematics for S12 run2
1844 m_syst_description[CP::SystematicVariation(
1845 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN0", +1)] =
1848 m_syst_description[CP::SystematicVariation(
1849 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN0", -1)] =
1852 m_syst_description[CP::SystematicVariation(
1853 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN1", +1)] =
1854 SysInfo{AbsEtaCaloPredicateFactory({1.45, 2.47}),
1856 m_syst_description[CP::SystematicVariation(
1857 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN1", -1)] =
1858 SysInfo{AbsEtaCaloPredicateFactory({1.45, 2.47}),
1860 m_syst_description[CP::SystematicVariation(
1861 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN2", +1)] =
1864 m_syst_description[CP::SystematicVariation(
1865 "EG_SCALE_LARCALIB_EXTRA2015PRE__ETABIN2", -1)] =
1868 }
1869
1870 // additional systematics for temperature run1->run2
1876 m_syst_description[CP::SystematicVariation(
1877 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN0", +1)] =
1878 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[0]),
1880 m_syst_description[CP::SystematicVariation(
1881 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN0", -1)] =
1882 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[0]),
1884 m_syst_description[CP::SystematicVariation(
1885 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN1", +1)] =
1886 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[1]),
1888 m_syst_description[CP::SystematicVariation(
1889 "EG_SCALE_LARTEMPERATURE_EXTRA2015PRE__ETABIN1", -1)] =
1890 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[1]),
1892 }
1893
1894 // additional systematic for temperature 2015->2016
1896 m_syst_description[CP::SystematicVariation(
1897 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN0", +1)] =
1898 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[0]),
1900 m_syst_description[CP::SystematicVariation(
1901 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN1", +1)] =
1902 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[1]),
1904 m_syst_description[CP::SystematicVariation(
1905 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN0", -1)] =
1906 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[0]),
1908 m_syst_description[CP::SystematicVariation(
1909 "EG_SCALE_LARTEMPERATURE_EXTRA2016PRE__ETABIN1", -1)] =
1910 SysInfo{AbsEtaCaloPredicateFactory(decorrelation_bins_BE[1]),
1912 }
1913
1914 // additional systematic for PP0 region
1930 m_syst_description[CP::SystematicVariation("EG_SCALE_MATPP0__ETABIN0",
1931 +1)] = SysInfo{
1933 m_syst_description[CP::SystematicVariation("EG_SCALE_MATPP0__ETABIN1",
1934 +1)] = SysInfo{
1936 m_syst_description[CP::SystematicVariation("EG_SCALE_MATPP0__ETABIN0",
1937 -1)] = SysInfo{
1939 m_syst_description[CP::SystematicVariation("EG_SCALE_MATPP0__ETABIN1",
1940 -1)] =
1943 }
1944
1945 // systematic related to wtots1
1958 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1", +1)] =
1960 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1", -1)] =
1962 }
1963
1964 // systematic related to wtots1, decorrelate eta bin [1.52,1.82] from rest
1968 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1__ETABIN0",
1969 +1)] =
1970 SysInfo{DoubleOrAbsEtaCaloPredicate(0, 1.52, 1.82, 2.47),
1972 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1__ETABIN0",
1973 -1)] =
1974 SysInfo{DoubleOrAbsEtaCaloPredicate(0, 1.52, 1.82, 2.47),
1976 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1__ETABIN1",
1977 +1)] =
1978 SysInfo{AbsEtaCaloPredicateFactory({1.52, 1.82}),
1980 m_syst_description[CP::SystematicVariation("EG_SCALE_WTOTS1__ETABIN1",
1981 -1)] =
1982 SysInfo{AbsEtaCaloPredicateFactory({1.52, 1.82}),
1984 }
1985
1986 // systematic for the scintillators
2005 m_syst_description[CP::SystematicVariation(
2006 "EG_SCALE_E4SCINTILLATOR__ETABIN0", +1)] =
2009 m_syst_description[CP::SystematicVariation(
2010 "EG_SCALE_E4SCINTILLATOR__ETABIN1", +1)] =
2013 m_syst_description[CP::SystematicVariation(
2014 "EG_SCALE_E4SCINTILLATOR__ETABIN2", +1)] =
2017 m_syst_description[CP::SystematicVariation(
2018 "EG_SCALE_E4SCINTILLATOR__ETABIN0", -1)] =
2021 m_syst_description[CP::SystematicVariation(
2022 "EG_SCALE_E4SCINTILLATOR__ETABIN1", -1)] =
2025 m_syst_description[CP::SystematicVariation(
2026 "EG_SCALE_E4SCINTILLATOR__ETABIN2", -1)] =
2029 if (m_TESModel == egEnergyCorr::es2024_Run3_v0) { // extended E4 in Run 3
2030 m_syst_description[CP::SystematicVariation(
2031 "EG_SCALE_E4SCINTILLATOR__ETABIN3", +1)] =
2034 m_syst_description[CP::SystematicVariation(
2035 "EG_SCALE_E4SCINTILLATOR__ETABIN3", -1)] =
2038 }
2039 }
2040 } else {
2041 ATH_MSG_FATAL("scale decorrelation model invalid");
2042 }
2043
2044 // resolution systematics
2046 // ALL will not include AF2/AF3 systematic
2047 // individual AF NP is always provided
2048 // linghua.guo@cern.ch 2025-04-23
2049 m_syst_description_resolution[CP::SystematicVariation(
2050 "EG_RESOLUTION_ALL", +1)] = egEnergyCorr::Resolution::AllUp;
2051 m_syst_description_resolution[CP::SystematicVariation(
2052 "EG_RESOLUTION_ALL", -1)] = egEnergyCorr::Resolution::AllDown;
2055 m_syst_description_resolution[CP::SystematicVariation(
2056 "EG_RESOLUTION_ZSMEARING", +1)] = egEnergyCorr::Resolution::ZSmearingUp;
2057 m_syst_description_resolution[CP::SystematicVariation(
2058 "EG_RESOLUTION_ZSMEARING", -1)] =
2060 m_syst_description_resolution[CP::SystematicVariation(
2061 "EG_RESOLUTION_SAMPLINGTERM", +1)] =
2063 m_syst_description_resolution[CP::SystematicVariation(
2064 "EG_RESOLUTION_SAMPLINGTERM", -1)] =
2066 m_syst_description_resolution[CP::SystematicVariation(
2067 "EG_RESOLUTION_MATERIALID", +1)] =
2069 m_syst_description_resolution[CP::SystematicVariation(
2070 "EG_RESOLUTION_MATERIALID", -1)] =
2072 m_syst_description_resolution[CP::SystematicVariation(
2073 "EG_RESOLUTION_MATERIALCALO", +1)] =
2075 m_syst_description_resolution[CP::SystematicVariation(
2076 "EG_RESOLUTION_MATERIALCALO", -1)] =
2078 m_syst_description_resolution[CP::SystematicVariation(
2079 "EG_RESOLUTION_MATERIALGAP", +1)] =
2081 m_syst_description_resolution[CP::SystematicVariation(
2082 "EG_RESOLUTION_MATERIALGAP", -1)] =
2084 m_syst_description_resolution[CP::SystematicVariation(
2085 "EG_RESOLUTION_MATERIALCRYO", +1)] =
2087 m_syst_description_resolution[CP::SystematicVariation(
2088 "EG_RESOLUTION_MATERIALCRYO", -1)] =
2090 m_syst_description_resolution[CP::SystematicVariation(
2091 "EG_RESOLUTION_PILEUP", +1)] = egEnergyCorr::Resolution::PileUpUp;
2092 m_syst_description_resolution[CP::SystematicVariation(
2093 "EG_RESOLUTION_PILEUP", -1)] = egEnergyCorr::Resolution::PileUpDown;
2109 m_syst_description_resolution[CP::SystematicVariation(
2110 "EG_RESOLUTION_MATERIALIBL", +1)] =
2112 m_syst_description_resolution[CP::SystematicVariation(
2113 "EG_RESOLUTION_MATERIALIBL", -1)] =
2115 m_syst_description_resolution[CP::SystematicVariation(
2116 "EG_RESOLUTION_MATERIALPP0", +1)] =
2118 m_syst_description_resolution[CP::SystematicVariation(
2119 "EG_RESOLUTION_MATERIALPP0", -1)] =
2121
2122 if (m_TESModel == egEnergyCorr::es2022_R22_PRE) { // exta sys. for Run-3
2123 // pre-recommendations
2124 m_syst_description_resolution[CP::SystematicVariation(
2125 "EG_RESOLUTION_OFC", +1)] = egEnergyCorr::Resolution::OFCUp;
2126 m_syst_description_resolution[CP::SystematicVariation(
2127 "EG_RESOLUTION_OFC", -1)] = egEnergyCorr::Resolution::OFCDown;
2128 }
2129 }
2130 } else {
2131 ATH_MSG_FATAL("resolution decorrelation model invalid");
2132 }
2133
2134 // Always use individual AF2/AF3 systematics for resolution
2139 m_syst_description_resolution[CP::SystematicVariation(
2140 "EG_RESOLUTION_AF2", +1)] = egEnergyCorr::Resolution::afUp;
2141 m_syst_description_resolution[CP::SystematicVariation(
2142 "EG_RESOLUTION_AF2", -1)] = egEnergyCorr::Resolution::afDown;
2143 }
2145 m_syst_description_resolution[CP::SystematicVariation(
2146 "EG_RESOLUTION_AF3", +1)] = egEnergyCorr::Resolution::afUp;
2147 m_syst_description_resolution[CP::SystematicVariation(
2148 "EG_RESOLUTION_AF3", -1)] = egEnergyCorr::Resolution::afDown;
2149 }
2150
2151 // ep combination systematics
2153 m_syst_description[CP::SystematicVariation("EL_SCALE_MOMENTUM", +1)] =
2155 m_syst_description[CP::SystematicVariation("EL_SCALE_MOMENTUM", -1)] =
2157 }
2158}
const EgammaPredicate EtaCaloPredicateFactory(double eta_min, double eta_max) const
std::function< bool(const EgammaCalibrationAndSmearingTool &, columnar::EgammaId)> EgammaPredicate

◆ setUseIncidents()

void asg::AsgMetadataTool::setUseIncidents ( const bool flag)
inlineprotectedinherited

Definition at line 132 of file AsgMetadataTool.h.

133 {
135 }
bool flag
Definition master.py:29

◆ sysInitialize()

StatusCode asg::AsgMetadataTool::sysInitialize ( )
virtualinherited

Function initialising the tool in the correct way in Athena.

This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 115 of file AsgMetadataTool.cxx.

115 {
116
117#ifndef XAOD_STANDALONE
118 if (m_useIncidents) {
119 // Connect to the IncidentSvc:
120 ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
121 ATH_CHECK( incSvc.retrieve() );
122
123 // Set up the right callbacks: don't rethrow exceptions, any failure and we should end
124 incSvc->addListener( this, IncidentType::BeginEvent, 0, false );
125 }
126 // Let the base class do its thing:
127 ATH_CHECK( AlgTool::sysInitialize() );
128
129#endif // not XAOD_STANDALONE
130
131 // Return gracefully:
132 return StatusCode::SUCCESS;
133 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ xAOD2ptype()

PATCore::ParticleType::Type CP::EgammaCalibrationAndSmearingTool::xAOD2ptype ( columnar::EgammaId particle) const
private

Definition at line 886 of file EgammaCalibrationAndSmearingTool.cxx.

887{
888 const Accessors& acc = *m_accessors;
889
890 // this is departing from the logic below, as we are now requiring the
891 // user to specify at configuration time whether we run on electrons
892 // or photons. this is necessary to configure the columns we need
893 // correctly.
894 if (m_onlyElectrons.value())
895 {
897 }
898 if (m_onlyPhotons.value())
899 {
900 if (acc.photonVertexAcc(particle).size() > 0)
901 {
903 }
904 else
905 {
907 }
908 }
909
910 // this is the old logic and should not be visited in columnar mode
911 // (disabled by turning on onlyElectrons or onlyPhotons)
913 //no ForwardElectron ptype: consider them as Electron
915 else if (xAOD::EgammaHelpers::isPhoton(&particle.getXAODObject())) {
918 }
919 else {
920 ATH_MSG_ERROR("particle is not electron of photon");
921 throw std::runtime_error("particle is not electron or photon");
922 }
923 return ptype;
924}
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

Member Data Documentation

◆ AUTO

const int CP::EgammaCalibrationAndSmearingTool::AUTO = 2
staticprivate

Definition at line 199 of file EgammaCalibrationAndSmearingTool.h.

◆ m_accessors

std::unique_ptr<Accessors> CP::EgammaCalibrationAndSmearingTool::m_accessors

Definition at line 489 of file EgammaCalibrationAndSmearingTool.h.

◆ m_ADCLinearity_tool

std::shared_ptr<LinearityADC> CP::EgammaCalibrationAndSmearingTool::m_ADCLinearity_tool
private

Definition at line 417 of file EgammaCalibrationAndSmearingTool.h.

◆ m_beginInputFileCalled

bool asg::AsgMetadataTool::m_beginInputFileCalled
privateinherited

Flag helping to discover when the tool misses the opening of the first input file.

Definition at line 126 of file AsgMetadataTool.h.

◆ m_caloDistPhiUnifCorr

std::unique_ptr<TH2> CP::EgammaCalibrationAndSmearingTool::m_caloDistPhiUnifCorr
private

Definition at line 291 of file EgammaCalibrationAndSmearingTool.h.

◆ m_currentResolutionVariation_data

egEnergyCorr::Resolution::Variation CP::EgammaCalibrationAndSmearingTool::m_currentResolutionVariation_data
private

Definition at line 439 of file EgammaCalibrationAndSmearingTool.h.

◆ m_currentResolutionVariation_MC

egEnergyCorr::Resolution::Variation CP::EgammaCalibrationAndSmearingTool::m_currentResolutionVariation_MC
private

Definition at line 438 of file EgammaCalibrationAndSmearingTool.h.

◆ m_currentScalePredicate

EgammaPredicate CP::EgammaCalibrationAndSmearingTool::m_currentScalePredicate
private

Definition at line 441 of file EgammaCalibrationAndSmearingTool.h.

◆ m_currentScaleVariation_data

egEnergyCorr::Scale::Variation CP::EgammaCalibrationAndSmearingTool::m_currentScaleVariation_data
private

Definition at line 437 of file EgammaCalibrationAndSmearingTool.h.

◆ m_currentScaleVariation_MC

egEnergyCorr::Scale::Variation CP::EgammaCalibrationAndSmearingTool::m_currentScaleVariation_MC
private

Definition at line 436 of file EgammaCalibrationAndSmearingTool.h.

◆ m_decorateEmva

bool CP::EgammaCalibrationAndSmearingTool::m_decorateEmva
private

Definition at line 287 of file EgammaCalibrationAndSmearingTool.h.

◆ m_decorrelation_model_name

std::string CP::EgammaCalibrationAndSmearingTool::m_decorrelation_model_name
private

Definition at line 252 of file EgammaCalibrationAndSmearingTool.h.

◆ m_decorrelation_model_resolution

ResolutionDecorrelation CP::EgammaCalibrationAndSmearingTool::m_decorrelation_model_resolution
private
Initial value:

Definition at line 256 of file EgammaCalibrationAndSmearingTool.h.

◆ m_decorrelation_model_resolution_name

std::string CP::EgammaCalibrationAndSmearingTool::m_decorrelation_model_resolution_name
private

Definition at line 254 of file EgammaCalibrationAndSmearingTool.h.

◆ m_decorrelation_model_scale

ScaleDecorrelation CP::EgammaCalibrationAndSmearingTool::m_decorrelation_model_scale = ScaleDecorrelation::FULL
private

Definition at line 255 of file EgammaCalibrationAndSmearingTool.h.

◆ m_decorrelation_model_scale_name

std::string CP::EgammaCalibrationAndSmearingTool::m_decorrelation_model_scale_name
private

Definition at line 253 of file EgammaCalibrationAndSmearingTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doADCLinearityCorrection

int CP::EgammaCalibrationAndSmearingTool::m_doADCLinearityCorrection
private

Definition at line 273 of file EgammaCalibrationAndSmearingTool.h.

◆ m_doFwdCalib

Gaudi::Property<bool> CP::EgammaCalibrationAndSmearingTool::m_doFwdCalib
private
Initial value:
{
this, "DoFwdElectronCalibration", false,
"MVA calibration of the forward electron"}

Definition at line 297 of file EgammaCalibrationAndSmearingTool.h.

297 {
298 this, "DoFwdElectronCalibration", false,
299 "MVA calibration of the forward electron"};

◆ m_doLeakageCorrection

int CP::EgammaCalibrationAndSmearingTool::m_doLeakageCorrection
private

Definition at line 274 of file EgammaCalibrationAndSmearingTool.h.

◆ m_doScaleCorrection

int CP::EgammaCalibrationAndSmearingTool::m_doScaleCorrection
private

Definition at line 259 of file EgammaCalibrationAndSmearingTool.h.

◆ m_doSmearing

int CP::EgammaCalibrationAndSmearingTool::m_doSmearing
private

Definition at line 260 of file EgammaCalibrationAndSmearingTool.h.

◆ m_ESModel

std::string CP::EgammaCalibrationAndSmearingTool::m_ESModel
private

Definition at line 251 of file EgammaCalibrationAndSmearingTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fixForMissingCells

Gaudi::Property<bool> CP::EgammaCalibrationAndSmearingTool::m_fixForMissingCells
private
Initial value:
{
this, "FixForMissingCells", true,
"AOD fix for cell recovery in core egamma cluster"}

Definition at line 293 of file EgammaCalibrationAndSmearingTool.h.

293 {
294 this, "FixForMissingCells", true,
295 "AOD fix for cell recovery in core egamma cluster"};

◆ m_gain_tool

egGain::GainTool* CP::EgammaCalibrationAndSmearingTool::m_gain_tool = nullptr
private

Definition at line 418 of file EgammaCalibrationAndSmearingTool.h.

◆ m_gain_tool_run2

std::unique_ptr<egGain::GainUncertainty> CP::EgammaCalibrationAndSmearingTool::m_gain_tool_run2
private

Definition at line 416 of file EgammaCalibrationAndSmearingTool.h.

◆ m_inputMetaStore

MetaStore_t asg::AsgMetadataTool::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 119 of file AsgMetadataTool.h.

◆ m_layer_recalibration_tool

egammaLayerRecalibTool* CP::EgammaCalibrationAndSmearingTool::m_layer_recalibration_tool = nullptr
private

Definition at line 419 of file EgammaCalibrationAndSmearingTool.h.

◆ m_layer_recalibration_tune

std::string CP::EgammaCalibrationAndSmearingTool::m_layer_recalibration_tune
private

Definition at line 420 of file EgammaCalibrationAndSmearingTool.h.

◆ m_MVACalibSvc

ServiceHandle<IegammaMVASvc> CP::EgammaCalibrationAndSmearingTool::m_MVACalibSvc
private
Initial value:
{this, "MVACalibSvc", "",
"calibration service"}

Definition at line 414 of file EgammaCalibrationAndSmearingTool.h.

414 {this, "MVACalibSvc", "",
415 "calibration service"};

◆ m_MVAfolder

std::string CP::EgammaCalibrationAndSmearingTool::m_MVAfolder
private

Definition at line 424 of file EgammaCalibrationAndSmearingTool.h.

◆ m_onlyElectrons

Gaudi::Property<bool> CP::EgammaCalibrationAndSmearingTool::m_onlyElectrons {this, "onlyElectrons", false, "the tool will only be applied to electrons"}

Definition at line 452 of file EgammaCalibrationAndSmearingTool.h.

452{this, "onlyElectrons", false, "the tool will only be applied to electrons"};

◆ m_onlyPhotons

Gaudi::Property<bool> CP::EgammaCalibrationAndSmearingTool::m_onlyPhotons {this, "onlyPhotons", false, "the tool will only be applied to photons"}

Definition at line 453 of file EgammaCalibrationAndSmearingTool.h.

453{this, "onlyPhotons", false, "the tool will only be applied to photons"};

◆ m_outputMetaStore

MetaStore_t asg::AsgMetadataTool::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 121 of file AsgMetadataTool.h.

◆ m_pVtxKey

Gaudi::Property<std::string> CP::EgammaCalibrationAndSmearingTool::m_pVtxKey
private
Initial value:
{
this, "PrimaryVerticesKey", "PrimaryVertices",
"Name of the primary vertex container"}

Definition at line 301 of file EgammaCalibrationAndSmearingTool.h.

301 {
302 this, "PrimaryVerticesKey", "PrimaryVertices",
303 "Name of the primary vertex container"};

◆ m_ResolutionType

std::string CP::EgammaCalibrationAndSmearingTool::m_ResolutionType
private

Definition at line 262 of file EgammaCalibrationAndSmearingTool.h.

◆ m_rootTool

std::unique_ptr<AtlasRoot::egammaEnergyCorrectionTool> CP::EgammaCalibrationAndSmearingTool::m_rootTool
private

Definition at line 423 of file EgammaCalibrationAndSmearingTool.h.

◆ m_Run2Run3runNumberTransition

const unsigned int CP::EgammaCalibrationAndSmearingTool::m_Run2Run3runNumberTransition = 400000
staticprivate

Definition at line 249 of file EgammaCalibrationAndSmearingTool.h.

◆ m_set_seed_function

IdFunction CP::EgammaCalibrationAndSmearingTool::m_set_seed_function
private

Definition at line 443 of file EgammaCalibrationAndSmearingTool.h.

◆ m_simulation

PATCore::ParticleDataType::DataType CP::EgammaCalibrationAndSmearingTool::m_simulation
private
Initial value:

Definition at line 266 of file EgammaCalibrationAndSmearingTool.h.

◆ m_syst_description

std::map<CP::SystematicVariation, SysInfo> CP::EgammaCalibrationAndSmearingTool::m_syst_description
private

Definition at line 431 of file EgammaCalibrationAndSmearingTool.h.

◆ m_syst_description_resolution

std::map<CP::SystematicVariation, egEnergyCorr::Resolution::Variation> CP::EgammaCalibrationAndSmearingTool::m_syst_description_resolution
private

Definition at line 433 of file EgammaCalibrationAndSmearingTool.h.

◆ m_TESModel

egEnergyCorr::ESModel CP::EgammaCalibrationAndSmearingTool::m_TESModel
private

Definition at line 258 of file EgammaCalibrationAndSmearingTool.h.

◆ m_TResolutionType

egEnergyCorr::Resolution::resolutionType CP::EgammaCalibrationAndSmearingTool::m_TResolutionType
private

Definition at line 263 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_AFII

int CP::EgammaCalibrationAndSmearingTool::m_use_AFII
private

Definition at line 265 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_ep_combination

bool CP::EgammaCalibrationAndSmearingTool::m_use_ep_combination
private

Definition at line 275 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_full_statistical_error

bool CP::EgammaCalibrationAndSmearingTool::m_use_full_statistical_error
private

Definition at line 277 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_mapping_correction

bool CP::EgammaCalibrationAndSmearingTool::m_use_mapping_correction
private

Definition at line 280 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_mva_calibration

int CP::EgammaCalibrationAndSmearingTool::m_use_mva_calibration
private

Definition at line 276 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_temp_correction201215

int CP::EgammaCalibrationAndSmearingTool::m_use_temp_correction201215
private

Definition at line 278 of file EgammaCalibrationAndSmearingTool.h.

◆ m_use_uA2MeV_2015_first2weeks_correction

int CP::EgammaCalibrationAndSmearingTool::m_use_uA2MeV_2015_first2weeks_correction
private

Definition at line 279 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useCaloDistPhiUnifCorrection

int CP::EgammaCalibrationAndSmearingTool::m_useCaloDistPhiUnifCorrection
private

Definition at line 271 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useFastSim

int CP::EgammaCalibrationAndSmearingTool::m_useFastSim
private

Definition at line 264 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useGainCorrection

int CP::EgammaCalibrationAndSmearingTool::m_useGainCorrection
private

Definition at line 272 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useGainInterpolation

int CP::EgammaCalibrationAndSmearingTool::m_useGainInterpolation
private

Definition at line 282 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useIncidents

bool asg::AsgMetadataTool::m_useIncidents
privateinherited

Definition at line 128 of file AsgMetadataTool.h.

◆ m_useIntermoduleCorrection

int CP::EgammaCalibrationAndSmearingTool::m_useIntermoduleCorrection
private

Definition at line 269 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useLayerCorrection

int CP::EgammaCalibrationAndSmearingTool::m_useLayerCorrection
private

Definition at line 283 of file EgammaCalibrationAndSmearingTool.h.

◆ m_usePhiUniformCorrection

int CP::EgammaCalibrationAndSmearingTool::m_usePhiUniformCorrection
private

Definition at line 270 of file EgammaCalibrationAndSmearingTool.h.

◆ m_usePSCorrection

int CP::EgammaCalibrationAndSmearingTool::m_usePSCorrection
private

Definition at line 284 of file EgammaCalibrationAndSmearingTool.h.

◆ m_user_random_run_number

int CP::EgammaCalibrationAndSmearingTool::m_user_random_run_number
private

Definition at line 281 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useS12Correction

int CP::EgammaCalibrationAndSmearingTool::m_useS12Correction
private

Definition at line 285 of file EgammaCalibrationAndSmearingTool.h.

◆ m_useSaccCorrection

int CP::EgammaCalibrationAndSmearingTool::m_useSaccCorrection
private

Definition at line 286 of file EgammaCalibrationAndSmearingTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_varSF

double CP::EgammaCalibrationAndSmearingTool::m_varSF
private

Definition at line 261 of file EgammaCalibrationAndSmearingTool.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: