diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py index 5cdf7d0c7dfb4442ae2dc6cbc489e45a734d0031..ef76b79c89d54b691f06f92f22a13cb860d40448 100755 --- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py +++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py @@ -879,3 +879,5 @@ class TrigMuonEFTrackIsolationMTConfig (TrigMuonEFConf.TrigMuonEFTrackIsolationA # Use offline isolation variables self.useVarIso = True self.MuonContName = "Muons" + self.ptcone02Name = "Muons.ptcone02" + self.ptcone03Name = "Muons.ptcone03" diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.cxx index be4ce19684b4bff36626dd196b7aa9722ee07e7f..1bb25c7c109c473808aa58ec089504709d18c7ed 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.cxx +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.cxx @@ -4,6 +4,7 @@ #include "TrigMuonEFTrackIsolationAlgMT.h" #include "xAODMuon/MuonAuxContainer.h" +#include "StoreGate/WriteDecorHandle.h" TrigMuonEFTrackIsolationAlgMT::TrigMuonEFTrackIsolationAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) @@ -31,6 +32,8 @@ StatusCode TrigMuonEFTrackIsolationAlgMT::initialize() ATH_CHECK( m_trackParticleKey.initialize() ); ATH_CHECK( m_efMuonContainerKey.initialize() ); ATH_CHECK( m_muonContainerKey.initialize() ); + ATH_CHECK( m_muonIso20Key.initialize() ); + ATH_CHECK( m_muonIso30Key.initialize() ); @@ -84,6 +87,7 @@ StatusCode TrigMuonEFTrackIsolationAlgMT::execute() // get input objects const xAOD::TrackParticleContainer *idTrackParticles = nullptr; const xAOD::MuonContainer *efMuonContainer = nullptr; + auto idTrackHandle = SG::makeHandle( m_trackParticleKey, ctx ); if( !idTrackHandle.isValid() ) { ATH_MSG_ERROR("Failed to retrieve inner detector track particles"); @@ -110,12 +114,15 @@ StatusCode TrigMuonEFTrackIsolationAlgMT::execute() std::vector<double> dzvals; // for monitoring std::vector<double> drvals; // for monitoring std::vector<double> selfremoval; - + SG::WriteHandle<xAOD::MuonContainer> muonOutput(m_muonContainerKey); ATH_CHECK(muonOutput.record(std::make_unique<xAOD::MuonContainer>(), std::make_unique<xAOD::MuonAuxContainer>())); ATH_MSG_DEBUG("Record EF isolation muon : " << m_muonContainerKey.key()); muonContainer = muonOutput.ptr(); + SG::WriteDecorHandle<xAOD::MuonContainer, double> muonptCone20(m_muonIso20Key); + SG::WriteDecorHandle<xAOD::MuonContainer, double> muonptCone30(m_muonIso30Key); + for ( auto muon : *efMuonContainer ) { const xAOD::Muon::MuonType muonType = muon->muonType(); if ( muonType!=xAOD::Muon::MuonType::Combined) { @@ -142,22 +149,12 @@ StatusCode TrigMuonEFTrackIsolationAlgMT::execute() ATH_MSG_WARNING("Isolation will not be set for this muon. result.isFailure: "<<result.isFailure()<<" isoResults.size: "<<isoResults.size()); } else { // isolation tool was ok - store results - const float ptcone20 = isoResults[0]; - const float ptcone30 = isoResults[1]; - ini_cone2.push_back(ptcone20*1e-3); // convert to GeV - ini_cone3.push_back(ptcone30*1e-3); // convert to GeV - muonContainer->push_back( new xAOD::Muon(*muon) ); xAOD::Muon* outputmuon = muonContainer->back(); - - // set isolation info into output muon object - if ( m_useVarIso ) { - outputmuon->setIsolation( ptcone20, xAOD::Iso::ptvarcone20 ); - outputmuon->setIsolation( ptcone30, xAOD::Iso::ptvarcone30 ); - } else { - outputmuon->setIsolation( ptcone20, xAOD::Iso::ptcone20 ); - outputmuon->setIsolation( ptcone30, xAOD::Iso::ptcone30 ); - } + muonptCone20(*outputmuon) = isoResults[0]; + muonptCone30(*outputmuon) = isoResults[1]; + ini_cone2.push_back(isoResults[0]*1e-3); // convert to GeV + ini_cone3.push_back(isoResults[1]*1e-3); // convert to GeV } }//loop over muons diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.h b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.h index da307890cccc01190016fc5dd8dc4d8a5bf08565..9bbe645a224aaf19b5fb39266ab67844bede70b9 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.h +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFTrackIsolationAlgMT.h @@ -56,6 +56,12 @@ class TrigMuonEFTrackIsolationAlgMT : public AthAlgorithm SG::WriteHandleKey<xAOD::MuonContainer> m_muonContainerKey { this, "MuonContName", "MuonEFInfo", "Name of output objects for EF" }; + SG::WriteDecorHandleKey<xAOD::MuonContainer> m_muonIso20Key { + this, "ptcone02Name", "Muons.ptcone02", "Isolation for ptcone 0.2" }; + + SG::WriteDecorHandleKey<xAOD::MuonContainer> m_muonIso30Key { + this, "ptcone03Name", "Muons.ptcone03", "Isolation for ptcone 0.3" }; + // Require that EF muons are combined Gaudi::Property<bool> m_requireCombined { this, "requireCombinedMuon", true, "Require that EF Muons are combined"}; diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.cxx index 9f7df029c98abeaccd6a3a34a7e22935b4822314..9707340f71e5ad47fc26f06032b943309a76d5a1 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.cxx @@ -4,6 +4,7 @@ #include "TrigMuonEFTrackIsolationHypoAlg.h" #include "AthViews/ViewHelper.h" +#include "StoreGate/ReadDecorHandle.h" using namespace TrigCompositeUtils; @@ -24,7 +25,11 @@ StatusCode TrigMuonEFTrackIsolationHypoAlg::initialize() ATH_CHECK( m_hypoTools.retrieve() ); renounce( m_muonKey ); + renounce( m_muonIso20Key ); + renounce( m_muonIso30Key ); ATH_CHECK( m_muonKey.initialize() ); + ATH_CHECK( m_muonIso20Key.initialize() ); + ATH_CHECK( m_muonIso30Key.initialize() ); return StatusCode::SUCCESS; } @@ -58,15 +63,17 @@ StatusCode TrigMuonEFTrackIsolationHypoAlg::execute( const EventContext& context auto viewEL = previousDecision->objectLink<ViewContainer>(viewString()); ATH_CHECK( viewEL.isValid() ); - // get Muon + // get Muon and isolation auto muonHandle = ViewHelper::makeHandle( *viewEL, m_muonKey, context ); + SG::ReadDecorHandle<xAOD::MuonContainer, double> muonIso20 ( m_muonIso20Key, context ); + SG::ReadDecorHandle<xAOD::MuonContainer, double> muonIso30 ( m_muonIso30Key, context ); ATH_CHECK( muonHandle.isValid() ); ATH_MSG_DEBUG( "Muinfo handle size: " << muonHandle->size() << " ..." ); // It is posisble that no muons are found, in this case we go to the next decision if ( muonHandle->size()==0 ) continue; - // this code only gets muon 0. The EF algorithms can potentially make more than 1 muon, so may need to revisit this + // this code only gets muon 0, since we build the views centered on a single muon auto muonEL = ViewHelper::makeLink( *viewEL, muonHandle, 0 ); ATH_CHECK( muonEL.isValid() ); const xAOD::Muon* muon = *muonEL; @@ -74,7 +81,7 @@ StatusCode TrigMuonEFTrackIsolationHypoAlg::execute( const EventContext& context // create new dicions auto newd = newDecisionIn( decisions ); - toolInput.emplace_back( newd, roi, muon, previousDecision ); + toolInput.emplace_back( newd, roi, muon, previousDecision, muonIso20(*muon), muonIso30(*muon) ); newd -> setObjectLink( featureString(), muonEL ); TrigCompositeUtils::linkToPrevious( newd, previousDecision, context ); diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.h b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.h index 6e309c09a1cb91a9056141ff5d0e208e203ba26c..86de0d8e80944affa11d621b0174eee72bb3c3e0 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.h +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoAlg.h @@ -28,6 +28,12 @@ class TrigMuonEFTrackIsolationHypoAlg SG::ReadHandleKey<xAOD::MuonContainer> m_muonKey { this, "EFMuonsName", "MuonEFInfo", "Name of EF muons conatiner" }; + SG::ReadDecorHandleKey<xAOD::MuonContainer> m_muonIso20Key { + this, "MuonIso02Name", "Muons.ptcone03", "Isolation in ptcone02" }; + + SG::ReadDecorHandleKey<xAOD::MuonContainer> m_muonIso30Key { + this, "MuonIso03Name", "Muons.ptcone03", "Isolation in ptcone03" }; + }; #endif diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.cxx index 8c8f2bf770e1829dfb63ec15db577c8bc2a7f959..54291267a25362785234f27b85a06f000cf5f5fe 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.cxx @@ -69,10 +69,9 @@ bool TrigMuonEFTrackIsolationHypoTool::decideOnSingleObject(TrigMuonEFTrackIsola { ATH_MSG_DEBUG("Decision ..."); - std::vector<float> ini_ptcone02(0); - std::vector<float> ini_ptcone03(0); - auto fex_ptcone02 = Monitored::Collection("PtCone02", ini_ptcone02); - auto fex_ptcone03 = Monitored::Collection("PtCone03", ini_ptcone03); + float ptcone20(-1), ptcone30(-1); + auto fex_ptcone02 = Monitored::Scalar("PtCone02", ptcone20); + auto fex_ptcone03 = Monitored::Scalar("PtCone03", ptcone30); auto monitorIt = Monitored::Group( m_monTool, fex_ptcone02, fex_ptcone03 ); @@ -108,26 +107,9 @@ bool TrigMuonEFTrackIsolationHypoTool::decideOnSingleObject(TrigMuonEFTrackIsola return result; } - float ptcone20(-1), ptcone30(-1); - bool res = false; - if ( m_useVarIso ) { - res = pMuon->isolation( ptcone20, xAOD::Iso::IsolationType::ptvarcone20 ); - if ( !res ) ATH_MSG_WARNING("Problem accessing ptvarcone20, " << ptcone20); - } else { - res = pMuon->isolation( ptcone20, xAOD::Iso::IsolationType::ptcone20 ); - if ( !res ) ATH_MSG_WARNING("Problem accessing ptcone20, " << ptcone20); - } - if( m_useVarIso ){ - res = pMuon->isolation( ptcone30, xAOD::Iso::IsolationType::ptvarcone30 ); - if ( !res ) ATH_MSG_WARNING("Problem accessing ptvarcone30, " << ptcone30); - } else { - res = pMuon->isolation( ptcone30, xAOD::Iso::IsolationType::ptcone30 ); - if ( !res ) ATH_MSG_WARNING("Problem accessing ptcone30, " << ptcone30); - } - - // monitoring - ini_ptcone02.push_back(ptcone20/1000.0); - ini_ptcone03.push_back(ptcone30/1000.0); + ptcone20 = input.ptcone20; + ptcone30 = input.ptcone30; + bool goodmu=true; diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.h b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.h index a4cf8350f5e80462b5b0cc70a1a90515b4713dcf..c62e1ba18f033db6220066db889c639975149ed9 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.h +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFTrackIsolationHypoTool.h @@ -32,18 +32,24 @@ class TrigMuonEFTrackIsolationHypoTool: public ::AthAlgTool { EFIsolationMuonInfo( TrigCompositeUtils::Decision* d, const TrigRoiDescriptor* r, const xAOD::Muon* f, - const TrigCompositeUtils::Decision* previousDecision ) + const TrigCompositeUtils::Decision* previousDecision, + const double cone20, + const double cone30 ) : decision( d ), roi( r ), muEFIso( f ), previousDecisionIDs( TrigCompositeUtils::decisionIDs( previousDecision ).begin(), - TrigCompositeUtils::decisionIDs( previousDecision ).end() ) + TrigCompositeUtils::decisionIDs( previousDecision ).end() ), + ptcone20(cone20), + ptcone30(cone30) {} TrigCompositeUtils::Decision* decision; const TrigRoiDescriptor* roi; const xAOD::Muon* muEFIso; const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs; + const double ptcone20; + const double ptcone30; }; virtual StatusCode initialize() override; diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx index 11c165c4d7f63b4e6f1e4351e0130838efeb5b65..ca51eafbcaede0fb5f978074271be6005355fa26 100644 --- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx +++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx @@ -221,9 +221,13 @@ StatusCode EventViewCreatorAlgorithm::placeRoIInView( const ElementLink<TrigRoiD StatusCode EventViewCreatorAlgorithm::placeMuonInView( const xAOD::Muon* theObject, SG::View* view, const EventContext& context ) const { // fill the Muon output collection ATH_MSG_DEBUG( "Adding Muon To View : " << m_inViewMuons.key()<<" and "<<m_inViewMuonCandidates.key() ); - auto oneObjectCollection = std::make_unique< ConstDataVector< xAOD::MuonContainer > >(); - oneObjectCollection->clear( SG::VIEW_ELEMENTS ); - oneObjectCollection->push_back( theObject ); + auto oneObjectCollection = std::make_unique< xAOD::MuonContainer >(); + auto oneObjectAuxCollection = std::make_unique< xAOD::MuonAuxContainer >(); + oneObjectCollection->setStore( oneObjectAuxCollection.get() ); + + xAOD::Muon* copiedMuon = new xAOD::Muon(); + oneObjectCollection->push_back( copiedMuon ); + *copiedMuon = *theObject; auto muonCandidate = std::make_unique< ConstDataVector< MuonCandidateCollection > >(); muonCandidate->clear( SG::VIEW_ELEMENTS ); @@ -234,7 +238,7 @@ StatusCode EventViewCreatorAlgorithm::placeMuonInView( const xAOD::Muon* theObje //store both in the view auto handleMuon = SG::makeHandle( m_inViewMuons,context ); ATH_CHECK( handleMuon.setProxyDict( view ) ); - ATH_CHECK( handleMuon.record( std::move( oneObjectCollection ) ) ); + ATH_CHECK( handleMuon.record( std::move( oneObjectCollection ), std::move( oneObjectAuxCollection )) ); auto handleCandidate = SG::makeHandle( m_inViewMuonCandidates,context ); ATH_CHECK( handleCandidate.setProxyDict( view ) ); diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h index b393b3b8efca212607cd4cfe35b9162fbc065843..8dc77e2700908e286d7f49b761e43caadcb94395 100644 --- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h +++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h @@ -86,7 +86,7 @@ class EventViewCreatorAlgorithm : public ::InputMakerBase "Muon slice specific option. Place Muon and MuonCandidate inside newly spawned View instance. See also InViewMuons, InViewMuonCandidates" }; // TODO - phase this out by reading the muon from the parent View. Remove any ambiguity. - SG::WriteHandleKey< ConstDataVector<xAOD::MuonContainer> > m_inViewMuons {this,"InViewMuons","", + SG::WriteHandleKey< xAOD::MuonContainer > m_inViewMuons {this,"InViewMuons","", "Name with which the Muon should be inserted into the views"}; SG::WriteHandleKey< ConstDataVector<MuonCandidateCollection> > m_inViewMuonCandidates {this,"InViewMuonCandidates","", diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index f38de5d4a1f1ff2cdec4f5bd583342d696b9fda4..31cf129547c0b00254f46b24fe01ad5c9ebb2fdc 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -208,7 +208,7 @@ TriggerHLTListRun3 = [ # xAOD isolated muon ('xAOD::MuonContainer#HLT_MuonsIso', 'BS ESD AODFULL', 'Muon', 'inViews:MUEFIsoViewRoIs'), - ('xAOD::MuonAuxContainer#HLT_MuonsIsoAux.', 'BS ESD AODFULL', 'Muon'), + ('xAOD::MuonAuxContainer#HLT_MuonsIsoAux.ptcone02.ptcone03', 'BS ESD AODFULL', 'Muon'), # Muon track particle containers (combined (x2: FS+RoI), extrapolated (x2: FS+RoI), MSonly (x1: FS)) ('xAOD::TrackParticleContainer#HLT_CBCombinedMuon_RoITrackParticles', 'BS ESD AODFULL', 'Muon', 'inViews:MUEFCBViewRoIs'), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py index f6793089ff7ce961926a94ff009f073e42c543c0..024e9fd7b8824288056081a674aa404194bc1e70 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py @@ -984,6 +984,8 @@ def efmuisoRecoSequence( RoIs, Muons ): trackParticles = PTTrackParticles[-1] trigEFmuIso.IdTrackParticles = trackParticles trigEFmuIso.MuonContName = muNames.EFIsoMuonName + trigEFmuIso.ptcone02Name = Muons+".ptcone02" + trigEFmuIso.ptcone03Name = Muons+".ptcone03" efmuisoRecoSequence += trigEFmuIso