diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METCaloRegionsTool.h b/Reconstruction/MET/METReconstruction/METReconstruction/METCaloRegionsTool.h index 9185f40be22c4fda77a44a22e87d0f31f11994c2..6b898d45ba6efc2809020f9633ed4964a7ee77c9 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METCaloRegionsTool.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METCaloRegionsTool.h @@ -113,7 +113,7 @@ namespace met{ REGIONS_TOTAL }; // CaloRegions human-readable names for enums - const static std::string CaloRegionNames[]; + const static std::string s_CaloRegionNames[]; private: // Default constructor: diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METTruthAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METTruthAssociator.h index fc5e952721ced230bd16af2dff923bead652ea07..8a748a654220b03c9efebc676f595b52f806d0c3 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METTruthAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METTruthAssociator.h @@ -91,7 +91,7 @@ namespace met{ std::string m_recoMuKey; std::string m_recoGamKey; std::string m_recoTauKey; - std::string m_truthPartKey; + std::string m_truthEventKey; /// Default constructor: METTruthAssociator(); diff --git a/Reconstruction/MET/METReconstruction/Root/METCaloRegionsTool.cxx b/Reconstruction/MET/METReconstruction/Root/METCaloRegionsTool.cxx index afc8070a30bce86fcffde915d2b40eeaeed9d162..09ba9ad41448e3b704d65730a0e55326b4e7e323 100644 --- a/Reconstruction/MET/METReconstruction/Root/METCaloRegionsTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METCaloRegionsTool.cxx @@ -33,8 +33,8 @@ namespace met { using xAOD::MissingET; using xAOD::MissingETContainer; - // Initialize CaloRegionNames - const std::string METCaloRegionsTool::CaloRegionNames[METCaloRegionsTool::REGIONS_TOTAL] = + // Initialize s_CaloRegionNames + const std::string METCaloRegionsTool::s_CaloRegionNames[METCaloRegionsTool::REGIONS_TOTAL] = { "EMB", "EME", @@ -127,7 +127,7 @@ namespace met { metCont->push_back( new MissingET(0.,0.,0.) ); } // Set Name and Source - metCont->at(i)->setName( CaloRegionNames[i] ); + metCont->at(i)->setName( s_CaloRegionNames[i] ); metCont->at(i)->setSource( source ); } // The last term is Trigger MET if asked for by the user diff --git a/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx b/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx index 47ed05704730fcc288340d8c166132ebb7ebaa71..bc64c6b431eb3b7dfe797370766501c00b1ff046 100644 --- a/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx @@ -39,7 +39,6 @@ namespace met { AsgTool(name), METAssociator(name) { - declareProperty( "IgnoreJetConst", m_skipconst = false ); declareProperty( "MatchRadius", m_matchRadius = 0.4 ); } diff --git a/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx index 99d3587634534b5a7390d54f38eaa658db68c10b..f48f1915a9c26950260b05d7f50e9b07ecb3ebdd 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx @@ -22,7 +22,8 @@ #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/PhotonContainer.h" #include "xAODTau/TauJetContainer.h" -#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthEventContainer.h" +#include "AthContainers/ConstDataVector.h" // Helpers #include "xAODEgamma/EgammaxAODHelpers.h" @@ -49,7 +50,7 @@ namespace met { declareProperty("RecoGamKey", m_recoGamKey = "Photons" ); declareProperty("RecoTauKey", m_recoTauKey = "TauJets" ); - declareProperty("TruthPartKey", m_truthPartKey = "TruthParticles" ); + declareProperty("TruthEventKey", m_truthEventKey = "TruthEvents" ); } // Destructor @@ -211,14 +212,22 @@ namespace met { ATH_MSG_VERBOSE("Added core terms."); - const TruthParticleContainer* truthParticleCont(0); - if( evtStore()->retrieve(truthParticleCont, m_truthPartKey).isFailure() ) { - ATH_MSG_WARNING("Unable to retrieve input truthParticle container " << m_truthPartKey); + const TruthEventContainer* truthEventCont(0); + if( evtStore()->retrieve(truthEventCont, m_truthEventKey).isFailure() ) { + ATH_MSG_WARNING("Unable to retrieve input truthEvent container " << m_truthEventKey); return StatusCode::FAILURE; } - const IParticleContainer* uniqueTruth = metMap->getUniqueSignals(truthParticleCont,MissingETBase::UsageHandler::TruthParticle); - ATH_MSG_VERBOSE("Extracted " << uniqueTruth->size() << "/" << truthParticleCont->size() + // First truth event is the hard scatter + const TruthEvent* hsevent = truthEventCont->front(); + ConstDataVector<TruthParticleContainer> truthParticleCont(SG::VIEW_ELEMENTS); + for(size_t itp=0; itp<hsevent->nTruthParticles(); ++itp) { + truthParticleCont.push_back(hsevent->truthParticle(itp)); + ATH_MSG_VERBOSE("Extracted truth particle with index " << hsevent->truthParticle(itp)->index() ); + } + + const IParticleContainer* uniqueTruth = metMap->getUniqueSignals(truthParticleCont.asDataVector(),MissingETBase::UsageHandler::TruthParticle); + ATH_MSG_VERBOSE("Extracted " << uniqueTruth->size() << "/" << truthParticleCont.size() << " unique truth particles."); for(const auto& part : *uniqueTruth) { const xAOD::TruthParticle* truth = static_cast<const xAOD::TruthParticle*>(part); @@ -279,13 +288,20 @@ namespace met { // if(truth && truth!=eltruth) truthlist.push_back(truth); // } - const TruthParticleContainer* truthParticleCont(0); - if( evtStore()->retrieve(truthParticleCont, m_truthPartKey).isFailure() ) { - ATH_MSG_WARNING("Unable to retrieve input truthParticle container " << m_truthPartKey); + const TruthEventContainer* truthEventCont(0); + if( evtStore()->retrieve(truthEventCont, m_truthEventKey).isFailure() ) { + ATH_MSG_WARNING("Unable to retrieve input truthEvent container " << m_truthEventKey); return StatusCode::FAILURE; } - for(const auto& truth : *truthParticleCont) { + // First truth event is the hard scatter + const TruthEvent* hsevent = truthEventCont->front(); + ConstDataVector<TruthParticleContainer> truthParticleCont(SG::VIEW_ELEMENTS); + for(size_t itp=0; itp<hsevent->nTruthParticles(); ++itp) { + truthParticleCont.push_back(hsevent->truthParticle(itp)); + } + + for(const auto& truth : truthParticleCont) { if(truth->pt()<1) continue; // stable if(!MC::isGenStable(truth->status(),truth->barcode())) continue; @@ -353,13 +369,20 @@ namespace met { // } // } - const TruthParticleContainer* truthParticleCont(0); - if( evtStore()->retrieve(truthParticleCont, m_truthPartKey).isFailure() ) { - ATH_MSG_WARNING("Unable to retrieve input truthParticle container " << m_truthPartKey); + const TruthEventContainer* truthEventCont(0); + if( evtStore()->retrieve(truthEventCont, m_truthEventKey).isFailure() ) { + ATH_MSG_WARNING("Unable to retrieve input truthEvent container " << m_truthEventKey); return StatusCode::FAILURE; } - for(const auto& truth : *truthParticleCont) { + // First truth event is the hard scatter + const TruthEvent* hsevent = truthEventCont->front(); + ConstDataVector<TruthParticleContainer> truthParticleCont(SG::VIEW_ELEMENTS); + for(size_t itp=0; itp<hsevent->nTruthParticles(); ++itp) { + truthParticleCont.push_back(hsevent->truthParticle(itp)); + } + + for(const auto& truth : truthParticleCont) { if(truth->pt()<1) continue; // stable if(!MC::isGenStable(truth->status(),truth->barcode())) continue; diff --git a/Reconstruction/MET/METReconstruction/Root/METTruthTool.cxx b/Reconstruction/MET/METReconstruction/Root/METTruthTool.cxx index 2f5092309d550e09f26a9337d66f9fecf605b3c1..55bec9104f70e3339c7e0bfe7648585b3183f387 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTruthTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTruthTool.cxx @@ -21,9 +21,13 @@ #include "xAODMissingET/MissingETAuxComponentMap.h" // Truth EDM +#include "xAODTruth/TruthEventContainer.h" #include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthVertex.h" +// Base EDM +#include "AthContainers/ConstDataVector.h" + // Truth Utilities #include "TruthUtils/TruthParticleHelpers.h" @@ -33,6 +37,8 @@ namespace met { // using xAOD::IParticle; // + using xAOD::TruthEvent; + using xAOD::TruthEventContainer; using xAOD::TruthParticle; using xAOD::TruthParticleContainer; // @@ -199,26 +205,34 @@ namespace met { ATH_MSG_DEBUG ("In execute: " << name() << "..."); - const TruthParticleContainer* truthCont = 0; + const TruthEventContainer* truthEvents = 0; metTerm->setSource(m_truth_type); // Retrieve the truth container - if ( evtStore()->retrieve(truthCont, m_input_data_key).isFailure() ) { - ATH_MSG_WARNING("Unable to retrieve input truth particle container"); + if ( evtStore()->retrieve(truthEvents, m_input_data_key).isFailure() ) { + ATH_MSG_WARNING("Unable to retrieve input truth event container"); return StatusCode::SUCCESS; } + // First truth event is the hard scatter + const TruthEvent* hsevent = truthEvents->front(); + ConstDataVector<TruthParticleContainer> truthCont(SG::VIEW_ELEMENTS); + for(size_t itp=0; itp<hsevent->nTruthParticles(); ++itp) { + truthCont.push_back(hsevent->truthParticle(itp)); + ATH_MSG_VERBOSE("Extracted truth particle with index " << hsevent->truthParticle(itp)->index()); + } + vector<const IParticle*> signalList; - signalList.reserve(truthCont->size()); + signalList.reserve(truthCont.size()); // Loop over all truth particles - for( TruthParticleContainer::const_iterator iTruth=truthCont->begin(); iTruth!=truthCont->end(); ++iTruth ) { + for( const auto& truthp : truthCont ) { // Check if truth particles satisfies the requirements - if( this->accept(*iTruth) ) { + if( this->accept(truthp) ) { // Add the selected truth particles to the list - signalList.push_back(*iTruth); + signalList.push_back(truthp); } - } // end loop over truths + } // end loop over truth particles // Loop over the content and add to MET MissingETBase::Types::weight_t unitWeight(1.,1.,1.); diff --git a/Reconstruction/MET/METReconstruction/python/METAssocConfig.py b/Reconstruction/MET/METReconstruction/python/METAssocConfig.py index 9421a9a5082c942801c9643f8456806d05c1efef..ac1ff5794b882cd8a72b38edeebb61e26374e90c 100644 --- a/Reconstruction/MET/METReconstruction/python/METAssocConfig.py +++ b/Reconstruction/MET/METReconstruction/python/METAssocConfig.py @@ -25,7 +25,7 @@ defaultInputKey = { 'ClusColl' :'CaloCalTopoClusters', 'TrkColl' :'InDetTrackParticles', 'PrimVxColl':'PrimaryVertices', - 'Truth' :'TruthParticles', + 'Truth' :'TruthEvents', 'LCOCClusColl':'LCOriginTopoClusters', 'EMOCClusColl':'EMOriginTopoClusters', } diff --git a/Reconstruction/MET/METReconstruction/python/METRecoConfig.py b/Reconstruction/MET/METReconstruction/python/METRecoConfig.py index 012734561499553d0368e641d422ba7690eb2f71..ceea93c5fd540b6f78fd3e7fba776ac349055c5d 100644 --- a/Reconstruction/MET/METReconstruction/python/METRecoConfig.py +++ b/Reconstruction/MET/METReconstruction/python/METRecoConfig.py @@ -31,7 +31,7 @@ defaultInputKey = { 'SoftClus' :'CaloCalTopoClusters', 'SoftPFlow':'JetETMissNeutralParticleFlowObjects', 'PrimaryVx':'PrimaryVertices', - 'Truth' :'TruthParticles', + 'Truth' :'TruthEvents', 'Calo' :'AllCalo', 'LCOCSoftClus':'LCOriginTopoClusters', 'EMOCSoftClus':'EMOriginTopoClusters',