15#include <TObjString.h>
59 return StatusCode::SUCCESS;
65 const bool removeTRTConvBarrelDefault =
false;
68 std::unique_ptr<TFile> f(TFile::Open(mva_filename.c_str()));
69 if (!f || f->IsZombie()) {
74 TObjString* conversionDefinitionObj =
nullptr;
75 f->GetObject(
"conversionDefinition", conversionDefinitionObj);
76 if (conversionDefinitionObj) {
88 ATH_MSG_ERROR(
"Could not determine if TRT converted photons should be removed in the barrel");
89 return StatusCode::FAILURE;
91 return StatusCode::SUCCESS;
111 ATH_MSG_DEBUG(
"calling egammaMVASvc::getEnergy with cluster and eg");
119 ATH_MSG_FATAL(
"Trying to calibrate an electron, but disabled");
120 return StatusCode::FAILURE;
126 ATH_MSG_FATAL(
"Trying to calibrate a forward electron, but disabled");
127 return StatusCode::FAILURE;
136 ATH_MSG_FATAL(
"Trying to calibrate a converted photon, but disabled");
137 return StatusCode::FAILURE;
143 ATH_MSG_FATAL(
"Trying to calibrate an unconverted photon, but disabled");
144 return StatusCode::FAILURE;
149 return StatusCode::FAILURE;
152 ATH_MSG_DEBUG(
"Calculated MVA calibrated energy = " << mvaE );
153 return StatusCode::SUCCESS;
162 ATH_MSG_DEBUG(
"calling egammaMVASvc::getEnergy with cluster and egType (" << egType <<
")");
170 ATH_MSG_FATAL(
"Trying to calibrate an electron, but disabled");
171 return StatusCode::FAILURE;
178 ATH_MSG_FATAL(
"Trying to calibrate a forward electron, but disabled");
179 return StatusCode::FAILURE;
188 ATH_MSG_FATAL(
"Trying to calibrate an unconverted photon, but disabled");
189 return StatusCode::FAILURE;
193 ATH_MSG_FATAL(
"Egamma object " << egType <<
" is of unsupported type");
194 return StatusCode::FAILURE;
197 ATH_MSG_DEBUG(
"Calculated MVA calibrated energy = " << mvaE );
198 return StatusCode::SUCCESS;
214 ATH_MSG_DEBUG(
"MVA energy (" << mvaE <<
") < particle mass ("
215 << eg.m() <<
"), setting e = cluster energy (" << cluster.
e() <<
")");
218 return StatusCode::SUCCESS;
234 ATH_MSG_DEBUG(
"MVA energy (" << mvaE <<
") < 0, setting e = cluster energy ("
235 << cluster.
e() <<
")");
238 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
ToolHandle< IegammaMVACalibTool > m_mvaElectron
MVA tool for electron.
virtual StatusCode initialize() override
StatusCode execute(xAOD::CaloCluster &cluster, const xAOD::Egamma &eg, const egammaMVACalib::GlobalEventInfo &gei=egammaMVACalib::GlobalEventInfo()) const override final
Main execute.
ToolHandle< IegammaMVACalibTool > m_mvaUnconvertedPhoton
MVA tool for unconverted photon.
Gaudi::Property< float > m_maxConvR
StatusCode resolve_flags()
Gaudi::Property< int > m_removeTRTConvBarrel
StatusCode getEnergy(const xAOD::CaloCluster &cluster, const xAOD::Egamma &eg, double &mvaE, const egammaMVACalib::GlobalEventInfo &gei=egammaMVACalib::GlobalEventInfo()) const override final
Compute the calibrated energy.
ToolHandle< IegammaMVACalibTool > m_mvaConvertedPhoton
MVA tool for converted photon.
ToolHandle< IegammaMVACalibTool > m_mvaFwdElectron
MVA tool for forward electron.
Gaudi::Property< std::string > m_folder
bool isConvCalib(const xAOD::Photon &ph) const
Decide if the photon is converted or not.
virtual double e() const
The total energy of the particle.
void setCalE(flt_t)
Set Energy for signal state CALIBRATED.
bool isFwdElectron(const xAOD::Egamma *eg)
is the object a Fwd electron
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
float conversionRadius(const xAOD::Vertex *vx)
return the conversion radius or 9999.
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Photon_v1 Photon
Definition of the current "egamma version".
A structure holding some global event information.