diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/ATLAS_CHECK_THREAD_SAFETY b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..72028a2909fb2f6fe1f78771e2c533d55d1ad909 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h index b21125e1d9696cb8fb0b864cdcd06177de4127a9..c99faa4d49ac8669d3c1231de0f7914d6829bcb5 100644 --- a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h +++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h @@ -18,8 +18,8 @@ class TEnv; namespace AsgConfigHelper{ - std::string findConfigFile (std::string input, const std::map<std::string,std::string>& configmap); - unsigned int findMask (std::string input, const std::map<std::string,unsigned int>& maskmap); + std::string findConfigFile (const std::string& input, const std::map<std::string,std::string>& configmap); + unsigned int findMask (const std::string& input, const std::map<std::string,unsigned int>& maskmap); std::vector<double> HelperDouble(const std::string& input, TEnv& env); std::vector<float> HelperFloat(const std::string& input, TEnv& env); std::vector<int> HelperInt(const std::string& input, TEnv& env); diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx index 09211e9ad376cc05a6bf782a28715cf8d44f7910..545b8e4b20bcc9d35e9c470dd700313e6db1220d 100644 --- a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx @@ -10,7 +10,7 @@ namespace AsgConfigHelper{ - std::string findConfigFile (std::string input, const std::map<std::string,std::string>& configmap){ + std::string findConfigFile (const std::string& input, const std::map<std::string,std::string>& configmap){ auto confFile_itr=configmap.find(input); if(confFile_itr == configmap.end()){ static const asg::AsgMessaging msg("Egamma::AsgConfigHelper"); @@ -20,7 +20,7 @@ namespace AsgConfigHelper{ return confFile_itr->second; } - unsigned int findMask (std::string input, const std::map<std::string,unsigned int>& maskmap){ + unsigned int findMask (const std::string& input, const std::map<std::string,unsigned int>& maskmap){ auto mask_itr=maskmap.find(input); if(mask_itr==maskmap.end()){ static const asg::AsgMessaging msg("Egamma::AsgConfigHelper"); @@ -37,7 +37,7 @@ namespace AsgConfigHelper{ std::string tmp = input; std::string::size_type first(0); std::string::size_type last(0); - first = ( input.find("#") ) ; + first = ( input.find('#') ) ; //if we do not find a comment character "#" we are fine if (first == std::string::npos) { @@ -47,7 +47,7 @@ namespace AsgConfigHelper{ } else { //if we have found comment character check if it is inlined between two "#" - last = (input.find("#",first+1) ); + last = (input.find('#',first+1) ); //if nor error if (last == std::string::npos) { static const asg::AsgMessaging msg("Egamma::AsgConfigHelper"); @@ -67,10 +67,10 @@ namespace AsgConfigHelper{ std::vector<T> Helper (const std::string& input, TEnv& env){ std::vector<T> CutVector; std::string env_input(env.GetValue(input.c_str(), "")); - if (env_input.size() > 0) { + if (!env_input.empty()) { std::string::size_type end; do { - end = env_input.find(";"); + end = env_input.find(';'); T myValue(0); if(AsgConfigHelper::strtof(env_input.substr(0,end),myValue)){ CutVector.push_back(myValue); @@ -98,10 +98,10 @@ std::vector<int> AsgConfigHelper::HelperInt(const std::string& input, TEnv& env) std::vector<std::string> AsgConfigHelper::HelperString(const std::string& input, TEnv& env){ std::vector<std::string> CutVector; std::string env_input(env.GetValue(input.c_str(), "")); - if (env_input.size() > 0) { + if (!env_input.empty()) { std::string::size_type end; do { - end = env_input.find(";"); + end = env_input.find(';'); std::string myValue(""); if(AsgConfigHelper::strtof(env_input.substr(0,end),myValue)){ CutVector.push_back(myValue); diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/PhotonHelpers.cxx b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/PhotonHelpers.cxx index 099e380af8bac7f4b6b04d6dd7aa3bb58049e65f..59ce81007146658674278e3bf04fece2a86bc290 100644 --- a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/PhotonHelpers.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/PhotonHelpers.cxx @@ -17,15 +17,17 @@ bool PhotonHelpers::passOQquality(const xAOD::Photon *ph){ return 0; } - if( !( ( ph->OQ() & 1073741824 )!=0 || + return !( ( ph->OQ() & 1073741824 )!=0 || + ( ( ph->OQ() & 134217728 )!=0 && + ( ph->showerShapeValue(xAOD::EgammaParameters::Reta) > 0.98 + || ph->showerShapeValue(xAOD::EgammaParameters::f1) > 0.4 + || (ph->OQ() & 67108864) !=0) - ) ) ){ - return true; - } - return false; + + ) ); } // ================================================================== bool PhotonHelpers::passOQqualityDelayed(const xAOD::Photon *ph){ @@ -36,12 +38,13 @@ bool PhotonHelpers::passOQqualityDelayed(const xAOD::Photon *ph){ return 0; } - if( !( ( ph->OQ() & 1073741824)!=0 || + return !( ( ph->OQ() & 1073741824)!=0 || + ( ( ph->OQ() & 134217728)!=0 && + ( ph->showerShapeValue(xAOD::EgammaParameters::Reta) > 0.98 + || ph->showerShapeValue(xAOD::EgammaParameters::f1) > 0.4 - ) ) ) ) { - return true; - } - return false; + + ) ) ); } diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ATLAS_CHECK_THREAD_SAFETY b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..274b45e446739e2a710594569b6579daa9c13820 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h index 522c3439f88453b5b41b5d1abce619561f4d5d43..995ee9db9669ea9fdbfdf5cac3e8afe9684411b3 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h @@ -141,7 +141,7 @@ namespace CP { /// Truth charge - mutable int m_truthCharge; + int m_truthCharge; //const xAOD::TruthParticle *m_truthparticle; diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ATLAS_CHECK_THREAD_SAFETY b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..0792ec7bbaf31109d44fed9b91ca9c5adda0d20b --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h index 0692194f0e041194289bb62e49032d2900210b9a..eacb4da6421ab5319d5eb70ab30e5288cb6f1f6f 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h @@ -36,20 +36,23 @@ public: public: /** Gaudi Service Interface method implementations */ - virtual StatusCode initialize(); + virtual StatusCode initialize() override final; - /** Gaudi Service Interface method implementations */ - virtual StatusCode finalize(); public: + virtual const CP::CorrectionCode applyCorrection( + xAOD::Photon& ph) const override final; - virtual const CP::CorrectionCode applyCorrection(xAOD::Photon& ph ) const; - - virtual const CP::CorrectionCode applyCorrection(xAOD::Electron& el ) const; + virtual const CP::CorrectionCode applyCorrection( + xAOD::Electron& el) const override final; - virtual const CP::CorrectionCode correctedCopy( const xAOD::Photon& ph, xAOD::Photon*& output ) const ; + virtual const CP::CorrectionCode correctedCopy( + const xAOD::Photon& ph, + xAOD::Photon*& output) const override final; - virtual const CP::CorrectionCode correctedCopy( const xAOD::Electron& el, xAOD::Electron*& output) const; + virtual const CP::CorrectionCode correctedCopy( + const xAOD::Electron& el, + xAOD::Electron*& output) const override final; private: diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx index 327f39e0bc269ad8c06014d158ffee587ee0450e..da8ee467dd3b2b62cfb2f5b599e4011351e6c6ab 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx @@ -40,10 +40,6 @@ ElectronPhotonShowerShapeFudgeTool::ElectronPhotonShowerShapeFudgeTool(const std // Standard Destructor ElectronPhotonShowerShapeFudgeTool::~ElectronPhotonShowerShapeFudgeTool() { - if(finalize().isFailure()){ - ATH_MSG_ERROR ( "Failure in ElectronPhotonShowerShapeFudgeTool finalize()"); - } - if ( m_ph_rootTool ) delete m_ph_rootTool; if ( m_el_rootTool ) delete m_el_rootTool; } @@ -105,12 +101,6 @@ StatusCode ElectronPhotonShowerShapeFudgeTool::initialize() } -StatusCode ElectronPhotonShowerShapeFudgeTool::finalize() -{ - return StatusCode::SUCCESS; -} - - const CP::CorrectionCode ElectronPhotonShowerShapeFudgeTool::applyCorrection( xAOD::Photon& ph) const { //Input vars to the underlying root tool. @@ -364,8 +354,7 @@ bool ElectronPhotonShowerShapeFudgeTool::strtof(const std::string& input, float& else { last = (input.find('#',first+1) ); if (last == std::string::npos) { - static asg::AsgMessaging msg("Egamma::ElectronPhotonShowerShapeFudgeTool"); - msg.msg(MSG::WARNING)<<" Improper comment format , inline comment should be enclosed between two # "<<endmsg; + ATH_MSG_WARNING("Improper comment format , inline comment should be enclosed between two #"); return false; } diff = last - first ; diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx index 71a915e2e875a076fb7ec8e055c7f61ecf99fbee..fad15d52f3cb65e7ea752d0bbe0e5b0080deff9a 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx @@ -151,10 +151,10 @@ void TPhotonMCShifterTool::LoadFFs(int preselection, const std::string& file) throw std::runtime_error( "Couldn't open file: " + m_corr_file ); } if (!f->FindKey(Form("TUNE%d",preselection))) { - std::cout << "Directory TUNE" << preselection << " does not exist in fudge factor file. Aborting" << std::endl; - exit(-1); + throw std::runtime_error("Directory TUNE " + std::to_string(preselection) + + " does not exist in fudge factor file."); } - + h_u_rhad1 = (TH2D*) f->Get(Form("TUNE%d/FF_RHAD1_UNCONV",preselection)); h_u_rhad1->SetDirectory(nullptr);