From aab52236e873803fb578cf6748aa23ea6cb5c794 Mon Sep 17 00:00:00 2001 From: williams <sarah.louise.williams@cern.ch> Date: Thu, 17 Jun 2021 15:10:25 +0100 Subject: [PATCH 1/5] Migrate METEgammaAssociator to DecorHandles --- .../METReconstruction/METEgammaAssociator.h | 11 ++++++++ .../Root/METEgammaAssociator.cxx | 27 ++++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h index 1aac914218e1..85738a7f167a 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h @@ -20,6 +20,7 @@ #include "xAODEgamma/EgammaFwd.h" #include "StoreGate/ReadDecorHandle.h" +#include "StoreGate/WriteDecorHandle.h" #include <set> @@ -119,6 +120,16 @@ namespace met{ SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronNeutralFEReadDecorKey{this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"}; SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronChargedFEReadDecorKey{this,"electronCargedFEReadDecorKey","", "Charged FE links key"}; + + + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","unmatchedFrac", "Unmatched fraction PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","unmatchedFracSumpt", "Unmatched fraction sum pT PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtWriteDecorKey {this,"pfounmatchedFracPtWriteDecorKey","unmatchedFracPt", "Unmatched fraction pT PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEWriteDecorKey {this,"pfounmatchedFracEWriteDecorKey","unmatchedFracE", "Unmatched fraction E PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEClusterPFOWriteDecorKey {this,"pfounmatchedFracEClusterPFOWriteDecorKey","unmatchedFracEClusterPFO", "Unmatched fraction ECluster decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtClusterPFOWriteDecorKey {this,"pfounmatchedFracPtClusterPFOWriteDecorKey","unmatchedFracPtClusterPFO", "Unmatched fraction PtCluster PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedTotEMFracWriteDecorKey {this,"pfounmatchedTotEMFracWriteDecorKey","unmatchedTotEMFrac", "Unmatched total EM fraction PFO decorator"}; + bool m_usePFOElectronLinks; bool m_usePFOPhotonLinks; bool m_useFEElectronLinks; diff --git a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx index 47f0c3fbb00c..882c5c5d1a51 100644 --- a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx @@ -75,7 +75,15 @@ namespace met { ATH_MSG_WARNING( "Invalid topocluster match method configured!" ); return StatusCode::FAILURE; } - + if(m_checkUnmatched){ + ATH_CHECK( m_pfounmatchedFracWriteDecorKey.initialize() ); + ATH_CHECK( m_pfounmatchedFracSumptWriteDecorKey.initialize() ); + ATH_CHECK( m_pfounmatchedFracPtWriteDecorKey.initialize() ); + ATH_CHECK( m_pfounmatchedFracEWriteDecorKey.initialize() ); + ATH_CHECK( m_pfounmatchedFracEClusterPFOWriteDecorKey.initialize() ); + ATH_CHECK( m_pfounmatchedFracPtClusterPFOWriteDecorKey.initialize() ); + ATH_CHECK( m_pfounmatchedTotEMFracWriteDecorKey.initialize() ); + } return StatusCode::SUCCESS; } @@ -598,15 +606,14 @@ namespace met { float unmatchedE=0; float unmatchedTotEMFrac=0; double emfrac=0; - - static SG::AuxElement::Decorator<Float_t> dec_unmatchedFrac("unmatchedFrac"); - static SG::AuxElement::Decorator<Float_t> dec_unmatchedFracSumpt("unmatchedFracSumpt"); - static SG::AuxElement::Decorator<Float_t> dec_unmatchedFracPt("unmatchedFracPt"); - static SG::AuxElement::Decorator<Float_t> dec_unmatchedFracE("unmatchedFracE"); - static SG::AuxElement::Decorator<Float_t> dec_unmatchedFracEClusterPFO("unmatchedFracEClusterPFO"); - static SG::AuxElement::Decorator<Float_t> dec_unmatchedFracPtClusterPFO("unmatchedFracPtClusterPFO"); - static SG::AuxElement::Decorator<Float_t> dec_unmatchedTotEMFrac("unmatchedTotEMFrac"); - + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFrac (m_pfounmatchedFracWriteDecorKey); + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFracSumpt (m_pfounmatchedFracSumptWriteDecorKey); + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFracPt (m_pfounmatchedFracPtWriteDecorKey); + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFracE (m_pfounmatchedFracEWriteDecorKey); + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFracEClusterPFO (m_pfounmatchedFracEClusterPFOWriteDecorKey); + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFracPtClusterPFO (m_pfounmatchedFracEClusterPFOWriteDecorKey); + SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedTotEMFrac (m_pfounmatchedTotEMFracWriteDecorKey); + TLorentzVector totVec(0.,0.,0.,0.), unmatchedVec(0.,0.,0.,0.); const std::vector<const xAOD::CaloCluster*> egClusters = xAOD::EgammaHelpers::getAssociatedTopoClusters(eg->caloCluster()); std::set<const xAOD::CaloCluster*> cPFOClusters; -- GitLab From 6990b2e9f32547ae3f62dbef01038c320a38d782 Mon Sep 17 00:00:00 2001 From: williams <sarah.louise.williams@cern.ch> Date: Tue, 6 Jul 2021 11:01:08 +0100 Subject: [PATCH 2/5] Changing initialisation of the decor handles --- .../METReconstruction/METEgammaAssociator.h | 17 ++++++++--------- .../Root/METEgammaAssociator.cxx | 8 ++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h index 85738a7f167a..68fa36268fd0 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h @@ -120,15 +120,14 @@ namespace met{ SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronNeutralFEReadDecorKey{this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"}; SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronChargedFEReadDecorKey{this,"electronCargedFEReadDecorKey","", "Charged FE links key"}; - - - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","unmatchedFrac", "Unmatched fraction PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","unmatchedFracSumpt", "Unmatched fraction sum pT PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtWriteDecorKey {this,"pfounmatchedFracPtWriteDecorKey","unmatchedFracPt", "Unmatched fraction pT PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEWriteDecorKey {this,"pfounmatchedFracEWriteDecorKey","unmatchedFracE", "Unmatched fraction E PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEClusterPFOWriteDecorKey {this,"pfounmatchedFracEClusterPFOWriteDecorKey","unmatchedFracEClusterPFO", "Unmatched fraction ECluster decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtClusterPFOWriteDecorKey {this,"pfounmatchedFracPtClusterPFOWriteDecorKey","unmatchedFracPtClusterPFO", "Unmatched fraction PtCluster PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedTotEMFracWriteDecorKey {this,"pfounmatchedTotEMFracWriteDecorKey","unmatchedTotEMFrac", "Unmatched total EM fraction PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","", "Unmatched fraction PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","", "Unmatched fraction sum pT PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtWriteDecorKey {this,"pfounmatchedFracPtWriteDecorKey","", "Unmatched fraction pT PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEWriteDecorKey {this,"pfounmatchedFracEWriteDecorKey","", "Unmatched fraction E PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEClusterPFOWriteDecorKey {this,"pfounmatchedFracEClusterPFOWriteDecorKey","", "Unmatched fraction ECluster decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtClusterPFOWriteDecorKey {this,"pfounmatchedFracPtClusterPFOWriteDecorKey","", "Unmatched fraction PtCluster PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedTotEMFracWriteDecorKey {this,"pfounmatchedTotEMFracWriteDecorKey","", "Unmatched total EM fraction PFO decorator"}; + bool m_usePFOElectronLinks; bool m_usePFOPhotonLinks; diff --git a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx index 882c5c5d1a51..696940e7e8f1 100644 --- a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx @@ -76,6 +76,13 @@ namespace met { return StatusCode::FAILURE; } if(m_checkUnmatched){ + if (m_pfounmatchedFracWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracWriteDecorKey.assign(m_input_data_key+".unmatchedFrac"));} + if (m_pfounmatchedFracSumptWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracSumptWriteDecorKey.assign(m_input_data_key+".unmatchedFracSumpt"));} + if (m_pfounmatchedFracPtWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracPtWriteDecorKey.assign(m_input_data_key+".unmatchedFracPt"));} + if (m_pfounmatchedFracEWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracEWriteDecorKey.assign(m_input_data_key+".unmatchedFracE"));} + if (m_pfounmatchedFracEClusterPFOWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracEClusterPFOWriteDecorKey.assign(m_input_data_key+".unmatchedFracEClusterPFO"));} + if (m_pfounmatchedFracPtClusterPFOWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracPtClusterPFOWriteDecorKey.assign(m_input_data_key+".unmatchedFracPtClusterPFO"));} + if (m_pfounmatchedTotEMFracWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedTotEMFracWriteDecorKey.assign(m_input_data_key+".unmatchedTotEMFrac"));} ATH_CHECK( m_pfounmatchedFracWriteDecorKey.initialize() ); ATH_CHECK( m_pfounmatchedFracSumptWriteDecorKey.initialize() ); ATH_CHECK( m_pfounmatchedFracPtWriteDecorKey.initialize() ); @@ -614,6 +621,7 @@ namespace met { SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedFracPtClusterPFO (m_pfounmatchedFracEClusterPFOWriteDecorKey); SG::WriteDecorHandle<xAOD::PFOContainer, Float_t> dec_unmatchedTotEMFrac (m_pfounmatchedTotEMFracWriteDecorKey); + TLorentzVector totVec(0.,0.,0.,0.), unmatchedVec(0.,0.,0.,0.); const std::vector<const xAOD::CaloCluster*> egClusters = xAOD::EgammaHelpers::getAssociatedTopoClusters(eg->caloCluster()); std::set<const xAOD::CaloCluster*> cPFOClusters; -- GitLab From fdf154d608f0f8930167c881e8aa8045e35ae19e Mon Sep 17 00:00:00 2001 From: williams <sarah.louise.williams@cern.ch> Date: Tue, 6 Jul 2021 11:30:11 +0100 Subject: [PATCH 3/5] Improving initialisation of decor handles --- .../METReconstruction/METEgammaAssociator.h | 17 +++++++++-------- .../Root/METEgammaAssociator.cxx | 15 ++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h index 68fa36268fd0..85738a7f167a 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h @@ -120,14 +120,15 @@ namespace met{ SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronNeutralFEReadDecorKey{this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"}; SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronChargedFEReadDecorKey{this,"electronCargedFEReadDecorKey","", "Charged FE links key"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","", "Unmatched fraction PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","", "Unmatched fraction sum pT PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtWriteDecorKey {this,"pfounmatchedFracPtWriteDecorKey","", "Unmatched fraction pT PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEWriteDecorKey {this,"pfounmatchedFracEWriteDecorKey","", "Unmatched fraction E PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEClusterPFOWriteDecorKey {this,"pfounmatchedFracEClusterPFOWriteDecorKey","", "Unmatched fraction ECluster decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtClusterPFOWriteDecorKey {this,"pfounmatchedFracPtClusterPFOWriteDecorKey","", "Unmatched fraction PtCluster PFO decorator"}; - SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedTotEMFracWriteDecorKey {this,"pfounmatchedTotEMFracWriteDecorKey","", "Unmatched total EM fraction PFO decorator"}; - + + + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","unmatchedFrac", "Unmatched fraction PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","unmatchedFracSumpt", "Unmatched fraction sum pT PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtWriteDecorKey {this,"pfounmatchedFracPtWriteDecorKey","unmatchedFracPt", "Unmatched fraction pT PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEWriteDecorKey {this,"pfounmatchedFracEWriteDecorKey","unmatchedFracE", "Unmatched fraction E PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracEClusterPFOWriteDecorKey {this,"pfounmatchedFracEClusterPFOWriteDecorKey","unmatchedFracEClusterPFO", "Unmatched fraction ECluster decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracPtClusterPFOWriteDecorKey {this,"pfounmatchedFracPtClusterPFOWriteDecorKey","unmatchedFracPtClusterPFO", "Unmatched fraction PtCluster PFO decorator"}; + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedTotEMFracWriteDecorKey {this,"pfounmatchedTotEMFracWriteDecorKey","unmatchedTotEMFrac", "Unmatched total EM fraction PFO decorator"}; bool m_usePFOElectronLinks; bool m_usePFOPhotonLinks; diff --git a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx index 696940e7e8f1..fdf64693eecc 100644 --- a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx @@ -76,13 +76,14 @@ namespace met { return StatusCode::FAILURE; } if(m_checkUnmatched){ - if (m_pfounmatchedFracWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracWriteDecorKey.assign(m_input_data_key+".unmatchedFrac"));} - if (m_pfounmatchedFracSumptWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracSumptWriteDecorKey.assign(m_input_data_key+".unmatchedFracSumpt"));} - if (m_pfounmatchedFracPtWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracPtWriteDecorKey.assign(m_input_data_key+".unmatchedFracPt"));} - if (m_pfounmatchedFracEWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracEWriteDecorKey.assign(m_input_data_key+".unmatchedFracE"));} - if (m_pfounmatchedFracEClusterPFOWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracEClusterPFOWriteDecorKey.assign(m_input_data_key+".unmatchedFracEClusterPFO"));} - if (m_pfounmatchedFracPtClusterPFOWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedFracPtClusterPFOWriteDecorKey.assign(m_input_data_key+".unmatchedFracPtClusterPFO"));} - if (m_pfounmatchedTotEMFracWriteDecorKey.key()=="") {ATH_CHECK( m_pfounmatchedTotEMFracWriteDecorKey.assign(m_input_data_key+".unmatchedTotEMFrac"));} + // Prepend container name + m_pfounmatchedFracWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracWriteDecorKey.key(); + m_pfounmatchedFracPtWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracPtWriteDecorKey.key(); + m_pfounmatchedFracSumptWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracSumptWriteDecorKey.key(); + m_pfounmatchedFracEWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracEWriteDecorKey.key(); + m_pfounmatchedFracEClusterPFOWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracEClusterPFOWriteDecorKey.key(); + m_pfounmatchedFracPtClusterPFOWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracPtClusterPFOWriteDecorKey.key(); + m_pfounmatchedTotEMFracWriteDecorKey=m_input_data_key+"."+m_pfounmatchedTotEMFracWriteDecorKey.key(); ATH_CHECK( m_pfounmatchedFracWriteDecorKey.initialize() ); ATH_CHECK( m_pfounmatchedFracSumptWriteDecorKey.initialize() ); ATH_CHECK( m_pfounmatchedFracPtWriteDecorKey.initialize() ); -- GitLab From 8080f3218f4c5aa66e008d2b2a43185ad4872e86 Mon Sep 17 00:00:00 2001 From: williams <sarah.louise.williams@cern.ch> Date: Thu, 22 Jul 2021 13:31:27 +0100 Subject: [PATCH 4/5] committing changes for bill to review --- .../ChargedHadronSubtractionTool.h | 5 ++++- .../Root/ChargedHadronSubtractionTool.cxx | 12 +++++++----- .../METReconstruction/METEgammaAssociator.h | 2 +- .../METReconstruction/METSoftAssociator.h | 4 +++- .../Root/METEgammaAssociator.cxx | 19 +++++++++++++++---- .../Root/METSoftAssociator.cxx | 16 +++++++++++----- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h b/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h index e7a2f6aab335..76f9051125bc 100644 --- a/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h +++ b/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h @@ -25,7 +25,7 @@ #include "xAODPFlow/FlowElementContainer.h" #include "AsgDataHandles/ReadHandleKey.h" - +#include "StoreGate/WriteDecorHandle.h" class ChargedHadronSubtractionTool : public JetConstituentModifierBase{ ASG_TOOL_CLASS(ChargedHadronSubtractionTool, IJetConstituentModifier) @@ -50,6 +50,9 @@ class ChargedHadronSubtractionTool : public JetConstituentModifierBase{ SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainer_key; SG::ReadHandleKey<jet::TrackVertexAssociation> m_trkVtxAssoc_key; + + SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfomatchedToPVWriteDecorKey {this,"pfomatchedToPVWriteDecorKey","CHSParticleFlowObjects.matchedToPV", "Matched to PV"}; + }; #endif diff --git a/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx b/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx index 79a88c10cc14..c48bc5052533 100644 --- a/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx +++ b/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx @@ -34,6 +34,7 @@ StatusCode ChargedHadronSubtractionTool::initialize() { } else { ATH_CHECK( m_vertexContainer_key.initialize() ); } + ATH_CHECK( m_pfomatchedToPVWriteDecorKey.initialize() ); return StatusCode::SUCCESS; } @@ -94,8 +95,8 @@ const xAOD::Vertex* ChargedHadronSubtractionTool::getPrimaryVertex() const { } StatusCode ChargedHadronSubtractionTool::matchToPrimaryVertex(xAOD::PFOContainer& cont) const { - const static SG::AuxElement::Accessor<char> PVMatchedAcc("matchedToPV"); - + SG::WriteDecorHandle<xAOD::PFOContainer, char> dec_matchedToPV (m_pfomatchedToPVWriteDecorKey); + // Use only one of TVA or PV const jet::TrackVertexAssociation* trkVtxAssoc = nullptr; const xAOD::Vertex* vtx = nullptr; @@ -150,14 +151,15 @@ StatusCode ChargedHadronSubtractionTool::matchToPrimaryVertex(xAOD::PFOContainer } } // TVA vs PV decision } - PVMatchedAcc(*ppfo) = matchedToPrimaryVertex; + dec_matchedToPV(*ppfo) = matchedToPrimaryVertex; } return StatusCode::SUCCESS; } StatusCode ChargedHadronSubtractionTool::matchToPrimaryVertex(xAOD::FlowElementContainer& cont) const { - const static SG::AuxElement::Accessor<char> PVMatchedAcc("matchedToPV"); + SG::WriteDecorHandle<xAOD::PFOContainer, char> dec_matchedToPV (m_pfomatchedToPVWriteDecorKey); + // Use only one of TVA or PV const jet::TrackVertexAssociation* trkVtxAssoc = nullptr; @@ -213,7 +215,7 @@ StatusCode ChargedHadronSubtractionTool::matchToPrimaryVertex(xAOD::FlowElementC } } // TVA vs PV decision } - PVMatchedAcc(*ppfo) = matchedToPrimaryVertex; + dec_matchedToPV(*ppfo) = matchedToPrimaryVertex; } return StatusCode::SUCCESS; diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h index 85738a7f167a..5e3e41fbb825 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h @@ -120,7 +120,7 @@ namespace met{ SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronNeutralFEReadDecorKey{this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"}; SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronChargedFEReadDecorKey{this,"electronCargedFEReadDecorKey","", "Charged FE links key"}; - + SG::ReadDecorHandleKey<xAOD::PFOContainer> m_pfomatchedToPVReadDecorKey{this,"pfomatchedToPVReadDecorKey","matchedToPV", "PFO matched to PV key"}; SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","unmatchedFrac", "Unmatched fraction PFO decorator"}; SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","unmatchedFracSumpt", "Unmatched fraction sum pT PFO decorator"}; diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h index d833630d07df..21ce5fd7b44a 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h @@ -17,6 +17,8 @@ // METReconstruction includes #include "METReconstruction/METAssociator.h" +#include "StoreGate/ReadDecorHandle.h" + namespace met{ class METSoftAssociator final : public METAssociator @@ -82,7 +84,7 @@ namespace met{ SG::ReadHandleKey<xAOD::CaloClusterContainer> m_lcmodclus_key; SG::ReadHandleKey<xAOD::CaloClusterContainer> m_emmodclus_key; - + SG::ReadDecorHandleKey<xAOD::PFOContainer> m_pfomatchedToPVReadDecorKey{this,"pfomatchedToPVReadDecorKey","matchedToPV", "PFO matched to PV key"}; }; } diff --git a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx index fdf64693eecc..287a218500af 100644 --- a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx @@ -75,6 +75,17 @@ namespace met { ATH_MSG_WARNING( "Invalid topocluster match method configured!" ); return StatusCode::FAILURE; } + if(m_usePFOElectronLinks || m_usePFOPhotonLinks || m_usePFOLinks){ + if(!m_fecollKey.key().empty()){ + m_pfomatchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); + ATH_CHECK( m_pfomatchedToPVReadDecorKey.initialize() ); + } + else if(m_pflow){ + m_pfomatchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); + ATH_CHECK( m_pfomatchedToPVReadDecorKey.initialize() ); + } + } + if(m_checkUnmatched){ // Prepend container name m_pfounmatchedFracWriteDecorKey=m_input_data_key+"."+m_pfounmatchedFracWriteDecorKey.key(); @@ -213,14 +224,14 @@ namespace met { cPFOLinks=chargedPFOReadDecorHandle(*eg); } - + SG::ReadDecorHandle<xAOD::PFOContainer, char> PVMatchedAcc(m_pfomatchedToPVReadDecorKey); // Charged PFOs for (PFOLink_t pfoLink : cPFOLinks) { if (pfoLink.isValid()){ const xAOD::PFO* pfo_init = *pfoLink; for (const auto pfo : *constits.pfoCont){ if (pfo->index() == pfo_init->index() && pfo->isCharged()){ //index-based match between JetETmiss and CHSParticleFlow collections - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); + //const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV" if( pfo->isCharged() && PVMatchedAcc(*pfo)&& ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) { ATH_MSG_DEBUG("Accept cPFO with pt " << pfo->pt() << ", e " << pfo->e() << ", eta " << pfo->eta() << ", phi " << pfo->phi() ); if (!m_checkUnmatched) {pfolist.push_back(pfo);} @@ -273,11 +284,11 @@ namespace met { // Preselect PFOs based on proximity: dR<0.4 std::vector<const xAOD::PFO*> nearbyPFO; nearbyPFO.reserve(20); + SG::ReadDecorHandle<xAOD::PFOContainer, char> PVMatchedAcc(m_pfomatchedToPVReadDecorKey); for(const auto pfo : *constits.pfoCont) { if(P4Helpers::isInDeltaR(*pfo, *swclus, 0.4, m_useRapidity)) { // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if( ( !pfo->isCharged() && pfo->e() > FLT_MIN ) || ( pfo->isCharged() && PVMatchedAcc(*pfo) && ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) @@ -443,7 +454,7 @@ namespace met { if(P4Helpers::isInDeltaR(*fe, *swclus, 0.4, m_useRapidity)) { // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); + const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if( ( !fe->isCharged() && fe->e() > FLT_MIN ) || ( fe->isCharged() && PVMatchedAcc(*fe) && ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(fe->chargedObject(0))) ) ) diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx index 3dfb64840243..3aec688863e1 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx @@ -48,7 +48,14 @@ namespace met { ATH_MSG_VERBOSE ("Initializing " << name() << "..."); ATH_CHECK( m_lcmodclus_key.initialize()); ATH_CHECK( m_emmodclus_key.initialize()); - + if(!m_fecollKey.key().empty()){ + m_pfomatchedToPVReadDecorKey=m_fecollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); + ATH_CHECK( m_pfomatchedToPVReadDecorKey.initialize() ); + } + else if(m_pflow){ + m_pfomatchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); + ATH_CHECK( m_pfomatchedToPVReadDecorKey.initialize() ); + } return StatusCode::SUCCESS; } @@ -88,8 +95,8 @@ namespace met { ATH_MSG_WARNING("Unable to retrieve constituent containers"); return StatusCode::FAILURE; } - - if(!m_fecollKey.key().empty()){ + if(!m_fecollKey.key().empty()){ + SG::ReadDecorHandle<xAOD::PFOContainer, char> PVMatchedAcc(m_pfomatchedToPVReadDecorKey); // PFOs have been provided as FlowElements const IParticleContainer* uniquePFOs = metMap->getUniqueSignals(constits.feCont,MissingETBase::UsageHandler::Policy::ParticleFlow); if(m_decorateSoftTermConst) { @@ -103,7 +110,6 @@ namespace met { if (pfo->isCharged()) { // Charged PFOs // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if (PVMatchedAcc(*pfo) && ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(pfo->chargedObject(0))) ) ) { // For the TST, we add the track pt, as this need not be // corrected for nearby energy in the calo @@ -128,6 +134,7 @@ namespace met { delete uniquePFOs; } else if (m_pflow) { + SG::ReadDecorHandle<xAOD::PFOContainer, char> PVMatchedAcc(m_pfomatchedToPVReadDecorKey); const IParticleContainer* uniquePFOs = metMap->getUniqueSignals(constits.pfoCont,MissingETBase::UsageHandler::Policy::ParticleFlow); if(m_decorateSoftTermConst) { dec_softConst(*metCoreTrk) = std::vector<ElementLink<IParticleContainer> >(); @@ -140,7 +147,6 @@ namespace met { if (pfo->isCharged()) { // Charged PFOs // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if (PVMatchedAcc(*pfo) && ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) { // For the TST, we add the track pt, as this need not be // corrected for nearby energy in the calo -- GitLab From 879302b43621c53340a39243b6ebf1b1398a2c44 Mon Sep 17 00:00:00 2001 From: williams <sarah.louise.williams@cern.ch> Date: Mon, 23 Aug 2021 11:39:08 +0100 Subject: [PATCH 5/5] Committing fixes to distinguish between PFOs and flow elements when creating decorations --- .../JetRecTools/ChargedHadronSubtractionTool.h | 2 +- .../JetRecTools/Root/ChargedHadronSubtractionTool.cxx | 5 +++-- .../METReconstruction/METEgammaAssociator.h | 1 + .../METReconstruction/METSoftAssociator.h | 1 + .../MET/METReconstruction/Root/METEgammaAssociator.cxx | 9 ++++----- .../MET/METReconstruction/Root/METSoftAssociator.cxx | 8 ++++---- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h b/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h index 76f9051125bc..1bf258f572c5 100644 --- a/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h +++ b/Reconstruction/Jet/JetRecTools/JetRecTools/ChargedHadronSubtractionTool.h @@ -52,7 +52,7 @@ class ChargedHadronSubtractionTool : public JetConstituentModifierBase{ SG::ReadHandleKey<jet::TrackVertexAssociation> m_trkVtxAssoc_key; SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfomatchedToPVWriteDecorKey {this,"pfomatchedToPVWriteDecorKey","CHSParticleFlowObjects.matchedToPV", "Matched to PV"}; - + SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_fematchedToPVWriteDecorKey {this,"fematchedToPVWriteDecorKey","CHSParticleFlowObjects.matchedToPV", "Matched to PV"}; }; #endif diff --git a/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx b/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx index c48bc5052533..84639a1a04a5 100644 --- a/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx +++ b/Reconstruction/Jet/JetRecTools/Root/ChargedHadronSubtractionTool.cxx @@ -34,7 +34,8 @@ StatusCode ChargedHadronSubtractionTool::initialize() { } else { ATH_CHECK( m_vertexContainer_key.initialize() ); } - ATH_CHECK( m_pfomatchedToPVWriteDecorKey.initialize() ); + if(m_inputType==xAOD::Type::ParticleFlow){ ATH_CHECK( m_pfomatchedToPVWriteDecorKey.initialize() );} + else if(m_inputType==xAOD::Type::FlowElement){ ATH_CHECK( m_fematchedToPVWriteDecorKey.initialize() );} return StatusCode::SUCCESS; } @@ -158,7 +159,7 @@ StatusCode ChargedHadronSubtractionTool::matchToPrimaryVertex(xAOD::PFOContainer } StatusCode ChargedHadronSubtractionTool::matchToPrimaryVertex(xAOD::FlowElementContainer& cont) const { - SG::WriteDecorHandle<xAOD::PFOContainer, char> dec_matchedToPV (m_pfomatchedToPVWriteDecorKey); + SG::WriteDecorHandle<xAOD::FlowElementContainer, char> dec_matchedToPV (m_fematchedToPVWriteDecorKey); // Use only one of TVA or PV diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h index 5e3e41fbb825..5b190257f880 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METEgammaAssociator.h @@ -121,6 +121,7 @@ namespace met{ SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_electronChargedFEReadDecorKey{this,"electronCargedFEReadDecorKey","", "Charged FE links key"}; SG::ReadDecorHandleKey<xAOD::PFOContainer> m_pfomatchedToPVReadDecorKey{this,"pfomatchedToPVReadDecorKey","matchedToPV", "PFO matched to PV key"}; + SG::ReadDecorHandleKey<xAOD::FlowElementContainer> m_fematchedToPVReadDecorKey{this,"fematchedToPVReadDecorKey","matchedToPV", "FE matched to PV key"}; SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracWriteDecorKey {this,"pfounmatchedFracWriteDecorKey","unmatchedFrac", "Unmatched fraction PFO decorator"}; SG::WriteDecorHandleKey<xAOD::PFOContainer> m_pfounmatchedFracSumptWriteDecorKey {this,"pfounmatchedFracSumptWriteDecorKey","unmatchedFracSumpt", "Unmatched fraction sum pT PFO decorator"}; diff --git a/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h b/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h index 21ce5fd7b44a..93d6797da5b6 100644 --- a/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h +++ b/Reconstruction/MET/METReconstruction/METReconstruction/METSoftAssociator.h @@ -85,6 +85,7 @@ namespace met{ SG::ReadHandleKey<xAOD::CaloClusterContainer> m_lcmodclus_key; SG::ReadHandleKey<xAOD::CaloClusterContainer> m_emmodclus_key; SG::ReadDecorHandleKey<xAOD::PFOContainer> m_pfomatchedToPVReadDecorKey{this,"pfomatchedToPVReadDecorKey","matchedToPV", "PFO matched to PV key"}; + SG::ReadDecorHandleKey<xAOD::FlowElementContainer> m_fematchedToPVReadDecorKey{this,"fematchedToPVReadDecorKey","matchedToPV", "FE matched to PV key"}; }; } diff --git a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx index 287a218500af..3936945f8045 100644 --- a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx @@ -77,8 +77,8 @@ namespace met { } if(m_usePFOElectronLinks || m_usePFOPhotonLinks || m_usePFOLinks){ if(!m_fecollKey.key().empty()){ - m_pfomatchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); - ATH_CHECK( m_pfomatchedToPVReadDecorKey.initialize() ); + m_fematchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_fematchedToPVReadDecorKey.key(); + ATH_CHECK( m_fematchedToPVReadDecorKey.initialize() ); } else if(m_pflow){ m_pfomatchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); @@ -231,7 +231,6 @@ namespace met { const xAOD::PFO* pfo_init = *pfoLink; for (const auto pfo : *constits.pfoCont){ if (pfo->index() == pfo_init->index() && pfo->isCharged()){ //index-based match between JetETmiss and CHSParticleFlow collections - //const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV" if( pfo->isCharged() && PVMatchedAcc(*pfo)&& ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) { ATH_MSG_DEBUG("Accept cPFO with pt " << pfo->pt() << ", e " << pfo->e() << ", eta " << pfo->eta() << ", phi " << pfo->phi() ); if (!m_checkUnmatched) {pfolist.push_back(pfo);} @@ -392,12 +391,12 @@ namespace met { // Charged FEs + SG::ReadDecorHandle<xAOD::FlowElementContainer, char> PVMatchedAcc(m_fematchedToPVReadDecorKey); for (FELink_t feLink : cFELinks) { if (feLink.isValid()){ const xAOD::FlowElement* fe_init = *feLink; for (const auto fe : *constits.feCont){ if (fe->index() == fe_init->index() && fe->isCharged()){ //index-based match between JetETmiss and CHSFlowElements collections - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if( fe->isCharged() && PVMatchedAcc(*fe)&& ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(fe->chargedObject(0))) ) ) { ATH_MSG_DEBUG("Accept cFE with pt " << fe->pt() << ", e " << fe->e() << ", eta " << fe->eta() << ", phi " << fe->phi() ); felist.push_back(fe); @@ -446,6 +445,7 @@ namespace met { // Preselect PFOs based on proximity: dR<0.4 std::vector<const xAOD::FlowElement*> nearbyFE; nearbyFE.reserve(20); + SG::ReadDecorHandle<xAOD::FlowElementContainer, char> PVMatchedAcc(m_fematchedToPVReadDecorKey); for(const xAOD::FlowElement* fe : *constits.feCont) { if(!(fe->signalType() & xAOD::FlowElement::PFlow)){ ATH_MSG_ERROR("Attempted to extract non-PFlow FlowElements. This is not supported!"); @@ -454,7 +454,6 @@ namespace met { if(P4Helpers::isInDeltaR(*fe, *swclus, 0.4, m_useRapidity)) { // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if( ( !fe->isCharged() && fe->e() > FLT_MIN ) || ( fe->isCharged() && PVMatchedAcc(*fe) && ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(fe->chargedObject(0))) ) ) diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx index 6943be1c9a75..7107664139ad 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx @@ -49,8 +49,8 @@ namespace met { ATH_CHECK( m_lcmodclus_key.initialize()); ATH_CHECK( m_emmodclus_key.initialize()); if(!m_fecollKey.key().empty()){ - m_pfomatchedToPVReadDecorKey=m_fecollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); - ATH_CHECK( m_pfomatchedToPVReadDecorKey.initialize() ); + m_fematchedToPVReadDecorKey=m_fecollKey.key()+"."+m_fematchedToPVReadDecorKey.key(); + ATH_CHECK( m_fematchedToPVReadDecorKey.initialize() ); } else if(m_pflow){ m_pfomatchedToPVReadDecorKey=m_pfcollKey.key()+"."+m_pfomatchedToPVReadDecorKey.key(); @@ -99,6 +99,7 @@ namespace met { if(m_pflow){ if(!m_fecollKey.key().empty()){ // PFOs have been provided as FlowElements + SG::ReadDecorHandle<xAOD::FlowElementContainer, char> PVMatchedAcc(m_fematchedToPVReadDecorKey); const IParticleContainer* uniquePFOs = metMap->getUniqueSignals(constits.feCont,MissingETBase::UsageHandler::Policy::ParticleFlow); if(m_decorateSoftTermConst) { dec_softConst(*metCoreTrk) = std::vector<ElementLink<IParticleContainer> >(); @@ -111,7 +112,6 @@ namespace met { if (pfo->isCharged()) { // Charged PFOs // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if (PVMatchedAcc(*pfo) && ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(pfo->chargedObject(0))) ) ) { // For the TST, we add the track pt, as this need not be // corrected for nearby energy in the calo @@ -136,6 +136,7 @@ namespace met { delete uniquePFOs; } else{ + SG::ReadDecorHandle<xAOD::PFOContainer, char> PVMatchedAcc(m_pfomatchedToPVReadDecorKey); const IParticleContainer* uniquePFOs = metMap->getUniqueSignals(constits.pfoCont,MissingETBase::UsageHandler::Policy::ParticleFlow); if(m_decorateSoftTermConst) { dec_softConst(*metCoreTrk) = std::vector<ElementLink<IParticleContainer> >(); @@ -148,7 +149,6 @@ namespace met { if (pfo->isCharged()) { // Charged PFOs // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool - const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); if (PVMatchedAcc(*pfo) && ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) { // For the TST, we add the track pt, as this need not be // corrected for nearby energy in the calo -- GitLab