diff --git a/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt b/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt index ea81b7ad2e607ab3e946a819526e414e9cfed659..1e21b9627aba063b4dc9e721a6fb2f39ec9a2b16 100644 --- a/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt +++ b/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt @@ -68,7 +68,9 @@ endif() # Test(s) in the package: atlas_add_test( mem_test SCRIPT test/mem_test.py ) if( XAOD_STANDALONE ) - atlas_add_test( ut_test SCRIPT test/ut_test.py ) +# Disable until we have reasonable input/to check +# against +# atlas_add_test( ut_test SCRIPT test/ut_test.py) endif() # Install files from the package: diff --git a/Reconstruction/egamma/egammaMVACalib/Root/egammaMVATool.cxx b/Reconstruction/egamma/egammaMVACalib/Root/egammaMVATool.cxx index 50e80a4e7b0501dc0ae52c91da0ff3ca3fea9c9c..3040495613c31c760004fdda35c30fafadcc40c5 100644 --- a/Reconstruction/egamma/egammaMVACalib/Root/egammaMVATool.cxx +++ b/Reconstruction/egamma/egammaMVACalib/Root/egammaMVATool.cxx @@ -191,49 +191,28 @@ StatusCode egammaMVATool::hltexecute(xAOD::CaloCluster* cluster, const std::stri return StatusCode::SUCCESS; } -float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const std::string& egType){ - - // Check for errors... - if ( !cluster ){ - ATH_MSG_WARNING("no xAOD::CaloCluster object provided"); +float egammaMVATool::getEnergy(const xAOD::Egamma* eg){ + if (!eg){ + ATH_MSG_WARNING("no xAOD::Egamma object provided"); return 0; } - - - if (egType == "Electron") { - ATH_MSG_DEBUG("Processing for HLT electron"); - m_MVATreeElectron->update(nullptr, cluster); - return m_mvaElectron->getMVAEnergy(); - } - else if(egType == "Photon"){ - ATH_MSG_DEBUG("Processing for HLT photon"); - m_MVATreePhoton->update(nullptr, cluster); - return m_mvaPhoton->getMVAEnergy(); - } - else { - ATH_MSG_WARNING("Unknown particle type"); - } - return 0; - - + return getEnergy(eg->caloCluster(),eg); } -float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Egamma* eg){ +float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, + const xAOD::Egamma* eg){ ATH_MSG_DEBUG("In execute..."); - // Check for errors... if ( !eg ){ ATH_MSG_WARNING("no xAOD::Egamma object provided"); return 0; } - if( eg->type() == xAOD::Type::Electron ){ - ATH_MSG_DEBUG("Processing for electron..."); + ATH_MSG_DEBUG("Processing for electron"); return getEnergy(cluster, static_cast<const xAOD::Electron*>(eg)); } else if (eg->type() == xAOD::Type::Photon ){ - ATH_MSG_DEBUG("Processing for photon..."); - + ATH_MSG_DEBUG("Processing for photon"); // this is because topo seeded electron (author == 128) have cluster in // another collection, which is not decorated with etaCalo, m_cl_phiCalo // needed by the MVA calibration @@ -245,11 +224,43 @@ float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Ega else{ ATH_MSG_INFO("Unknown Type"); } + return 0; +} + +float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, + const std::string& egType){ + // Check for errors... + if ( !cluster ){ + ATH_MSG_WARNING("no xAOD::CaloCluster object provided"); + return 0; + } + if (egType == "Electron") { + ATH_MSG_DEBUG("Processing for type electron"); + m_MVATreeElectron->update(nullptr, cluster); + return m_mvaElectron->getMVAEnergy(); + } + else if(egType == "Photon"){ + ATH_MSG_DEBUG("Processing for type photon"); + m_MVATreePhoton->update(nullptr, cluster); + return m_mvaPhoton->getMVAEnergy(); + } + else { + ATH_MSG_WARNING("Unknown particle type"); + } return 0; } -float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Electron* el){ +float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, + const xAOD::EgammaParameters::EgammaType egType){ + return ( (egType==xAOD::EgammaParameters::electron) ? + getEnergy(cluster, "Electron") : + getEnergy(cluster, "Photon")); +} + + +float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, + const xAOD::Electron* el){ if(!el){ ATH_MSG_ERROR("No electron passed"); return 0; @@ -259,17 +270,14 @@ float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Ele return m_mvaElectron->getMVAEnergy(); } -float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Photon* ph){ +float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, + const xAOD::Photon* ph){ if(!ph){ ATH_MSG_ERROR("No photon passed"); return 0; } - ATH_MSG_DEBUG("updating variables photon"); m_MVATreePhoton->update(ph, cluster); return m_mvaPhoton->getMVAEnergy(); } -float egammaMVATool::getEnergy(const xAOD::CaloCluster* cluster, const xAOD::EgammaParameters::EgammaType egType){ - return ( (egType==xAOD::EgammaParameters::electron) ? getEnergy(cluster, "Electron") : getEnergy(cluster, "Photon") ); -} diff --git a/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/IegammaMVATool.h b/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/IegammaMVATool.h index 302040aa3cbd39bff9ddd4e43661e2610b2d1c6a..ba2f6f7c45a8f757876becdf3c4c40af4dbc41f0 100644 --- a/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/IegammaMVATool.h +++ b/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/IegammaMVATool.h @@ -33,6 +33,18 @@ public: virtual StatusCode execute(xAOD::CaloCluster* cluster,const xAOD::Egamma* eg)=0; virtual StatusCode execute(xAOD::CaloCluster* cluster,const xAOD::EgammaParameters::EgammaType egType)=0; virtual StatusCode hltexecute(xAOD::CaloCluster* cluster, const std::string& egType)=0; + + virtual float getEnergy(const xAOD::Egamma* eg)=0; + virtual float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Egamma*)=0; + virtual float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::EgammaParameters::EgammaType egType)=0; + + virtual float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Electron*)=0; + virtual float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Photon*)=0; + virtual float getEnergy(const xAOD::CaloCluster* cluster, const std::string&)=0; + + + + }; #endif diff --git a/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/egammaMVATool.h b/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/egammaMVATool.h index 45dade09c4f65395518b49cb2decd4067e35cf3a..fd4f22006d37c35c14f4704b801e5da3f9f5246b 100644 --- a/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/egammaMVATool.h +++ b/Reconstruction/egamma/egammaMVACalib/egammaMVACalib/egammaMVATool.h @@ -46,10 +46,12 @@ public: StatusCode execute(xAOD::CaloCluster* cluster, const xAOD::EgammaParameters::EgammaType egType); StatusCode hltexecute(xAOD::CaloCluster* cluster, const std::string& egType); + float getEnergy(const xAOD::Egamma* eg); float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Egamma*); + float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::EgammaParameters::EgammaType egType); + float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Electron*); float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::Photon*); - float getEnergy(const xAOD::CaloCluster* cluster, const xAOD::EgammaParameters::EgammaType egType); float getEnergy(const xAOD::CaloCluster* cluster, const std::string&); private: diff --git a/Reconstruction/egamma/egammaMVACalib/test/mem_test.py b/Reconstruction/egamma/egammaMVACalib/test/mem_test.py index 399a5bac5756ab48f6700105142a7e5429f1ed93..259ccafe4a7929009960fe3c8b46fd6121d6f652 100755 --- a/Reconstruction/egamma/egammaMVACalib/test/mem_test.py +++ b/Reconstruction/egamma/egammaMVACalib/test/mem_test.py @@ -13,8 +13,7 @@ def Vmem(): memUsage = [Vmem()] # import ROOT and load dictionary -import ROOT, PyCintex, numpy as np -PyCintex.loadDict('egammaMVACalibDict') +import ROOT memUsage.append( Vmem() ) # Electrons @@ -25,4 +24,5 @@ memUsage.append( Vmem() ) m = ROOT.egammaMVACalib(0, True, 'egammaMVACalib/online/v3') memUsage.append( Vmem() ) -print np.diff(memUsage)/1e6, 'GB' +for i in memUsage: + print i/1e6 , 'GB' diff --git a/Reconstruction/egamma/egammaMVACalib/util/mem_test_initialize.cxx b/Reconstruction/egamma/egammaMVACalib/util/mem_test_initialize.cxx index cb3ffef6effcc705a081980793d908bd8c55fb61..47dfe3aa578c04c985880ccaefd35b9ccaca98f3 100644 --- a/Reconstruction/egamma/egammaMVACalib/util/mem_test_initialize.cxx +++ b/Reconstruction/egamma/egammaMVACalib/util/mem_test_initialize.cxx @@ -4,10 +4,12 @@ #include "egammaMVACalib/egammaMVATool.h" + int main() { egammaMVATool myMVATool("myMVATool"); myMVATool.setProperty("folder", "egammaMVACalib/online/v3"); myMVATool.initialize(); + return 0; }