38 return StatusCode::FAILURE;
44 ATH_MSG_ERROR(
"Config file string is empty. Please provide a config file to the tool.");
45 return StatusCode::FAILURE;
52 env.IgnoreDuplicates(
false);
55 if (env.Lookup(
"ElectronConfigs"))
59 if (env.Lookup(
"ConvertedPhotonConfigs"))
63 if (env.Lookup(
"UnconvertedPhotonConfigs"))
71 ANA_MSG_ERROR(
"You did not provide any config files for the ElectronPhotonVariableCorrectionBase to the ElectronPhotonVariableCorrectionTool.");
72 return StatusCode::FAILURE;
84 return StatusCode::SUCCESS;
99 return StatusCode::SUCCESS;
105 for(
unsigned int confFile_itr = 0; confFile_itr < confFiles.size(); confFile_itr++ )
107 std::string tmp_confFile = confFiles.at(confFile_itr);
109 if (confFiles.at(confFile_itr).empty())
111 ATH_MSG_ERROR(
"Could not locate configuration file " << tmp_confFile);
112 return StatusCode::FAILURE;
116 return StatusCode::SUCCESS;
122 toolHolder.resize(confFiles.size());
124 const std::string configFilePropStr{
"ConfigFile"};
125 const std::string opLvlPropStr{
"OutputLevel"};
126 for(
unsigned int confFile_itr = 0; confFile_itr < confFiles.size(); confFile_itr++ )
129 std::string variable =
"";
132 TString toolname = TString::Format(
"%s_%s_%s", this->name().c_str(), name.c_str(), variable.c_str());
134 toolHolder.at(confFile_itr) = std::make_unique<ElectronPhotonVariableCorrectionBase>(toolname.Data());
135 ANA_CHECK(toolHolder.at(confFile_itr)->setProperty(configFilePropStr, confFiles.at(confFile_itr)));
136 ANA_CHECK(toolHolder.at(confFile_itr)->setProperty(opLvlPropStr, this->msg().level()));
137 ANA_CHECK(toolHolder.at(confFile_itr)->initialize());
140 return StatusCode::SUCCESS;
146 for (
unsigned int tool_itr = 0; tool_itr < toolHolder.size(); tool_itr++)
157 ATH_MSG_ERROR(
"In conf " << confFiles.at(tool_itr) <<
": The ApplyTo flag does not match with the container type from the conf file.");
158 return StatusCode::FAILURE;
161 return StatusCode::SUCCESS;
173 if (isConvertedPhoton)
176 for (
unsigned int convertedPhotonTool_itr = 0; convertedPhotonTool_itr <
m_convertedPhotonTools.size(); convertedPhotonTool_itr++)
181 ATH_MSG_ERROR(
"Could not apply correction to converted photon object.");
189 for (
unsigned int unconvertedPhotonTool_itr = 0; unconvertedPhotonTool_itr <
m_unconvertedPhotonTools.size(); unconvertedPhotonTool_itr++)
194 ATH_MSG_ERROR(
"Could not apply correction to unconverted photon object.");
206 for (
unsigned int electronTool_itr = 0; electronTool_itr <
m_electronTools.size(); electronTool_itr++)
211 ATH_MSG_ERROR(
"Could not apply correction to electron object.");
225 ATH_MSG_VERBOSE(
"Will correct photon " << &in_photon <<
" of pT, eta = " << in_photon.
pt() <<
" " << in_photon.
eta());
232 ATH_MSG_VERBOSE(
"Will correct electron " << &in_electron <<
" of pT, eta = " << in_electron.
pt() <<
" " << in_electron.
eta());
245 env.ReadFile(confFile.c_str(), kEnvLocal);
247 env.IgnoreDuplicates(
false);
250 if (env.Lookup(
"Variable"))
252 variableName = env.GetValue(
"Variable",
"");
256 ATH_MSG_ERROR(
"In conf file " << confFile <<
": Correction variable is empty or not in configuration file.");
257 return StatusCode::FAILURE;
260 return StatusCode::SUCCESS;
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_VERBOSE(x,...)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ Ok
The correction was done successfully.
EGammaObjects
Define the categories of EGamma objects tool can be applied to.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
std::vector< std::string > HelperString(const std::string &input, TEnv &env)
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".