diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetBtagHypoTool.py b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetBtagHypoTool.py index 91b4c5d824f962c35dd4116763e6033a0782ce70..d039cf5b1ef468620e8f8d9b847669f4aaa33b33 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetBtagHypoTool.py +++ b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetBtagHypoTool.py @@ -1,8 +1,5 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -import re -re_Bjet = re.compile(r'^HLT_(?P<multiplicity>\d+)?j(?P<threshold>\d+)(?:_gsc(?P<gscThreshold>\d+))?(?:_b(?P<bTag>[^_]+)(?:_(?P<bConfig>split))?(?:_(?P<minEta>\d+)eta(?P<maxEta>\d+))?)?(?:_L1(?P<L1>.*))?$') - from AthenaCommon.Logging import logging log = logging.getLogger('TrigBjetBtagHypoTool') @@ -39,7 +36,6 @@ def TrigBjetBtagHypoToolFromDict( chainDict ): chainPart = chainDict['chainParts'][0] conf_dict = { 'threshold' : chainPart['threshold'], 'multiplicity' : '1' if len(chainPart['multiplicity']) == 0 else chainPart['multiplicity'], - 'gscThreshold' : '0' if 'gscThreshold' not in chainPart else chainPart['gscThreshold'].replace('gsc',''), 'bTag' : chainPart['bTag'][1:], 'bConfig' : 'EF' if len(chainPart['bConfig']) == 0 else chainPart['bConfig'][0], 'minEta' : chainPart['etaRange'].split('eta')[0], @@ -115,7 +111,7 @@ if __name__ == "__main__": from TriggerJobOpts.TriggerFlags import TriggerFlags TriggerFlags.enableMonitoring=['Validation'] - t = TrigBjetBtagHypoToolFromName( "HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20","HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20" ) + t = TrigBjetBtagHypoToolFromName( "HLT_j35_ftf_subjesgscIS_boffperf_split_L1J15","HLT_j35_ftf_subjesgscIS_boffperf_split_L1J15" ) assert t, "can't configure boffperf split" log.info( "\n\n TrigBjetBtagHypoToolFromName ALL OK\n\n" ) diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py index 0bf8cdf68464cf98e82515cd3c4f0593f1578c6c..15c21ea2ee12e1fd86d4eada5be1a7e6e2c3f06e 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py +++ b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py @@ -1,7 +1,5 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -import re -re_Bjet = re.compile(r'^HLT_(?P<multiplicity>\d+)?j(?P<threshold>\d+)(?:_gsc(?P<gscThreshold>\d+))?(?:_b(?P<bTag>[^_]+)(?:_(?P<bConfig>split))?(?:_(?P<minEta>\d+)eta(?P<maxEta>\d+))?)?(?:_L1(?P<L1>.*))?$') +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging from AthenaCommon.SystemOfUnits import GeV @@ -24,13 +22,6 @@ def TrigBjetEtHypoToolFromDict( chainDict ): 'maxEta' : chainPart['etaRange'].split('eta')[1], 'L1' : None } - # chain = conf - # match = re_Bjet.match( chain ) - # conf_dict = match.groupdict() - - # for k, v in default_conf.items(): - # if k not in conf_dict: conf_dict[k] = v - # if conf_dict[k] == None: conf_dict[k] = v from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoTool tool = TrigBjetEtHypoTool( name ) @@ -52,11 +43,13 @@ def TrigBjetEtHypoToolFromName( name, conf ): #################################################################################################### + if __name__ == "__main__": from TriggerJobOpts.TriggerFlags import TriggerFlags TriggerFlags.enableMonitoring=['Validation'] - t = TrigBjetEtHypoToolFromName( "HLT_j45_ftf_subjesgscIS_boffperf_split","HLT_j45_ftf_subjesgscIS_boffperf_split" ) + t = TrigBjetEtHypoToolFromName( "HLT_j35_ftf_subjesgscIS_boffperf_split_L1J15","HLT_j35_ftf_subjesgscIS_boffperf_split_L1J15" ) assert t, "can't configure boffperf split" log.info( "\n\n TrigBjetEtHypoToolFromName ALL OK\n\n" ) + diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx index c9b737c276cb152f6cac8c6561ca7cde605fe9d6..949208b57d90861b7936ba3ce737adee1a6e0691 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx @@ -12,11 +12,19 @@ TrigBjetBtagHypoAlgMT::TrigBjetBtagHypoAlgMT( const std::string& name, StatusCode TrigBjetBtagHypoAlgMT::initialize() { + ATH_MSG_DEBUG( "declareProperty review:" ); + ATH_MSG_DEBUG( " " << m_bTagKey ); + ATH_MSG_DEBUG( " " << m_trackKey ); + + // ATH_MSG_DEBUG( " " << m_trackLink ); + ATH_CHECK( m_hypoTools.retrieve() ); + CHECK( m_bTagKey.initialize() ); + CHECK( m_trackKey.initialize() ); - ATH_MSG_DEBUG( "declareProperty review:" ); - ATH_MSG_DEBUG( " " << m_bTagKey ); + renounce( m_bTagKey ); + renounce( m_trackKey ); renounce( m_bTagKey ); @@ -37,7 +45,17 @@ StatusCode TrigBjetBtagHypoAlgMT::execute( const EventContext& context ) const { // Retrieve b-tagging ElementLinkVector< xAOD::BTaggingContainer > btaggingELs; - // CHECK( retrieveBtagging( context,btaggingELs,m_bTagKey,prevDecisionContainer ) ); // TMP + // Retrieve b-tagging here + + // Retrive Precision tracks from Event Views. We get them all in this way! + ElementLinkVector< xAOD::TrackParticleContainer > trackELs; + CHECK( retrieveObjectFromEventView( context,trackELs,m_trackKey,prevDecisionContainer ) ); + ATH_MSG_DEBUG( "Retrieved " << trackELs.size() << " precision tracks..." ); + + for ( const ElementLink< xAOD::TrackParticleContainer >& trackLink : trackELs ) + ATH_MSG_DEBUG( " * pt=" << (*trackLink)->p4().Et() << + " eta=" << (*trackLink)->eta() << + " phi=" << (*trackLink)->phi() ); // ========================================================================================================================== // ** Prepare Outputs @@ -46,6 +64,10 @@ StatusCode TrigBjetBtagHypoAlgMT::execute( const EventContext& context ) const { // Decisions SG::WriteHandle< TrigCompositeUtils::DecisionContainer > handle = TrigCompositeUtils::createAndStore( decisionOutput(), context ); TrigCompositeUtils::DecisionContainer *outputDecisions = handle.ptr(); + + // ========================================================================================================================== + // ** Compute Decisions + // ========================================================================================================================== const unsigned int nDecisions = prevDecisionContainer->size(); @@ -59,18 +81,21 @@ StatusCode TrigBjetBtagHypoAlgMT::execute( const EventContext& context ) const { newDecisions.push_back( toAdd ); } + // Adding Links + // CHECK( attachLinkToDecisions( context,newDecisions ) ); + for ( unsigned int index(0); index<nDecisions; index++ ) { // Adding b-tagging links to output decisions // TMP // Adding a dummy-link (a link to self) for now to satisfy validation. ElementLink<TrigCompositeUtils::DecisionContainer> dummyFeatureLink(*outputDecisions, index, context); newDecisions.at( index )->setObjectLink<TrigCompositeUtils::DecisionContainer>(TrigCompositeUtils::featureString(), dummyFeatureLink); } - ATH_MSG_DEBUG(" ** Added object links to output decision"); // ========================================================================================================================== // ** Prepare input to Hypo Tools // ========================================================================================================================== + std::vector< TrigBjetBtagHypoTool::TrigBjetBtagHypoToolInfo > bTagHypoInputs; for ( unsigned int index(0); index<nDecisions; index++ ) { @@ -93,8 +118,8 @@ StatusCode TrigBjetBtagHypoAlgMT::execute( const EventContext& context ) const { // ========================================================================================================================== // Run on Trigger Chains - for ( const ToolHandle< TrigBjetBtagHypoTool >& tool : m_hypoTools ) // TMP - CHECK( tool->decide( bTagHypoInputs ) ); // TMP + for ( const ToolHandle< TrigBjetBtagHypoTool >& tool : m_hypoTools ) + CHECK( tool->decide( bTagHypoInputs ) ); ATH_MSG_DEBUG( "Exiting with " << handle->size() << " decisions" ); ATH_MSG_DEBUG( "CHECKING OUTPUT DECISION HANDLE" ); @@ -105,19 +130,9 @@ StatusCode TrigBjetBtagHypoAlgMT::execute( const EventContext& context ) const { return StatusCode::SUCCESS; } - -StatusCode TrigBjetBtagHypoAlgMT::retrieveBtagging( const EventContext& context, - ElementLinkVector< xAOD::BTaggingContainer >& btaggingELs, - const SG::ReadHandleKey< xAOD::BTaggingContainer >& inputBtagKey, - const TrigCompositeUtils::DecisionContainer* prevDecisionContainer ) const { +StatusCode TrigBjetBtagHypoAlgMT::attachLinksToDecision( const EventContext&, + TrigCompositeUtils::Decision&, + int, int ) const { - CHECK( retrieveObjectFromStoreGate( context,btaggingELs,inputBtagKey,prevDecisionContainer ) ); - return StatusCode::SUCCESS; -} - - -StatusCode TrigBjetBtagHypoAlgMT::attachLinkToDecisions( const EventContext& /*context*/, - const TrigCompositeUtils::DecisionContainer* /*previousDecisions*/, - std::vector< TrigCompositeUtils::Decision* >& /*outputDecisions*/ ) const { return StatusCode::SUCCESS; } diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.h index f0d14f0b19b847944ab727ca31a6c178c53cbbc2..9b71b75f549dd7e71899a16b1460bda08f1ca8dc 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.h @@ -28,20 +28,21 @@ class TrigBjetBtagHypoAlgMT : public TrigBjetHypoAlgBaseMT { virtual StatusCode execute( const EventContext& context ) const; private: - StatusCode retrieveBtagging( const EventContext&, - ElementLinkVector< xAOD::BTaggingContainer >&, - const SG::ReadHandleKey< xAOD::BTaggingContainer >&, - const TrigCompositeUtils::DecisionContainer*) const; - - virtual StatusCode attachLinkToDecisions( const EventContext&, - const TrigCompositeUtils::DecisionContainer*, - std::vector< TrigCompositeUtils::Decision* >& ) const; + TrigBjetBtagHypoAlgMT(); + virtual StatusCode attachLinksToDecision( const EventContext&, + TrigCompositeUtils::Decision&, + int index, + int indexPrmVertex = 0 ) const; + private: ToolHandleArray< TrigBjetBtagHypoTool > m_hypoTools {this,"HypoTools",{},"Hypo Tools"}; + + // Gaudi::Property< std::string > m_trackLink {this,"TrackLink","Undefined","Precision Track's link to attach to the output decision"}; - SG::ReadHandleKey< xAOD::BTaggingContainer> m_bTagKey {this,"BTagging","Unspecified","Key for BTagging"}; - SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey {this,"DecisionsKey","BjetHypoDecisions","Output key for Btag Kypo Decisions"}; + SG::ReadHandleKey< xAOD::BTaggingContainer> m_bTagKey {this,"BTagging","Undefined","Key for BTagging"}; + SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackKey {this,"Tracks","Undefined","Key for precision tracks, to be linked to output decision"}; }; -#endif //> !TRIGBJETHYPO_TRIGBJETHYPOALGMT_H +#endif + diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoTool.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoTool.cxx index 2243006355b2f68c00abfe6bb1a4b7e00031724b..cc4e14cff40de13c2bbb8ecf3b1238468f3f321f 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoTool.cxx @@ -45,10 +45,14 @@ StatusCode TrigBjetBtagHypoTool::decide( std::vector< TrigBjetBtagHypoToolInfo > // Check the HypoTool's chain is active if ( not TrigCompositeUtils::passed( getId().numeric(),bTagInfo.previousDecisionIDs ) ) continue; - + + // This will disappear! if ( m_acceptAll == true ) { ATH_MSG_DEBUG( "Running with 'Accept All' option enabled. Passing cut." ); TrigCompositeUtils::addDecisionID( getId().numeric(),bTagInfo.decision ); + + ATH_MSG_DEBUG("PRINTING DECISION"); + ATH_MSG_DEBUG( *bTagInfo.decision ); continue; } @@ -76,6 +80,7 @@ StatusCode TrigBjetBtagHypoTool::decide( std::vector< TrigBjetBtagHypoToolInfo > ATH_MSG_DEBUG( " --> Failed" ); } + ATH_MSG_DEBUG("PRINTING DECISION"); ATH_MSG_DEBUG( *bTagInfo.decision ); } diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgEVMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgEVMT.cxx deleted file mode 100644 index 5c333410480eefd3ad19946d9b12b9215e442119..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgEVMT.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigBjetEtHypoAlgEVMT.h" - -TrigBjetEtHypoAlgEVMT::TrigBjetEtHypoAlgEVMT( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::TrigBjetEtHypoAlgMT( name,pSvcLocator ) {} - - -StatusCode TrigBjetEtHypoAlgEVMT::initialize() { - - CHECK( TrigBjetEtHypoAlgMT::initialize() ); - CHECK( m_inputTracksKey.initialize() ); - - renounce( m_inputJetsKey ); - - return StatusCode::SUCCESS; -} - -StatusCode TrigBjetEtHypoAlgEVMT::retrieveJets( const EventContext& context, - ElementLinkVector< xAOD::JetContainer >& jetELs, - const SG::ReadHandleKey< xAOD::JetContainer >& inputJetsKey, - const TrigCompositeUtils::DecisionContainer* prevDecisionContainer ) const { - - CHECK( retrieveObjectFromEventView( context,jetELs,inputJetsKey,prevDecisionContainer ) ); - return StatusCode::SUCCESS; -} - -StatusCode TrigBjetEtHypoAlgEVMT::retrieveRoIs( const EventContext& /*context*/, - const TrigRoiDescriptorCollection*& /*roiContainer*/, - const SG::ReadHandleKey< TrigRoiDescriptorCollection >& /*inputRoIKey*/ ) const { - return StatusCode::SUCCESS; -} - -StatusCode TrigBjetEtHypoAlgEVMT::setTracksLink( const EventContext& context, - const SG::ReadHandleKey< xAOD::TrackParticleContainer >& trackKey, - const unsigned int index, - const TrigCompositeUtils::DecisionContainer*& inputDecisions, - std::vector< TrigCompositeUtils::Decision* >& outputDecisions ) const { - - ElementLink< ViewContainer > viewEL = inputDecisions->at(index)->objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); - ATH_CHECK( viewEL.isValid() ); - - SG::ReadHandle< xAOD::TrackParticleContainer > calTrackHandle = ViewHelper::makeHandle( *viewEL,trackKey,context ); - ATH_CHECK( calTrackHandle.isValid() ); - - ElementLinkVector< xAOD::TrackParticleContainer > tracksELs; - for ( unsigned int i(0); i<calTrackHandle->size(); i++ ) { - ElementLink< xAOD::TrackParticleContainer > trackEL( trackKey.key(),i ); - ATH_CHECK( trackEL.isValid() ); - tracksELs.push_back( trackEL ); - } - - outputDecisions.at( index )->addObjectCollectionLinks( m_trackLink.value(),tracksELs); - return StatusCode::SUCCESS; -} - -StatusCode TrigBjetEtHypoAlgEVMT::setJetLink( const EventContext& context, - const SG::ReadHandleKey< xAOD::JetContainer >& jetKey, - const unsigned int index, - const TrigCompositeUtils::DecisionContainer*& inputDecisions, - std::vector< TrigCompositeUtils::Decision* >& outputDecisions ) const { - - ElementLink< ViewContainer > viewEL = inputDecisions->at(index)->objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); - ATH_CHECK( viewEL.isValid() ); - - SG::ReadHandle< xAOD::JetContainer > calJetHandle = ViewHelper::makeHandle( *viewEL, jetKey, context ); - ATH_CHECK( calJetHandle.isValid() ); - - ElementLink< xAOD::JetContainer > jetEL = ViewHelper::makeLink( *viewEL, calJetHandle, 0 ); - ATH_CHECK( jetEL.isValid() ); - - outputDecisions.at( index )->setObjectLink( TrigCompositeUtils::featureString(),jetEL); - return StatusCode::SUCCESS; -} - -const TrigCompositeUtils::Decision* TrigBjetEtHypoAlgEVMT::getPreviousDecision( const TrigCompositeUtils::DecisionContainer* decisionContainer, - unsigned int index ) const { - return decisionContainer->at( index ); -} - -StatusCode TrigBjetEtHypoAlgEVMT::attachLinkToDecisions( const EventContext& context, - const TrigCompositeUtils::DecisionContainer* prevDecisionContainer, - std::vector< TrigCompositeUtils::Decision* >& newDecisions ) const { - const unsigned int nDecisions = newDecisions.size(); - - for ( unsigned int index(0); index<nDecisions; index++ ) { - CHECK( setJetLink( context,m_inputJetsKey,index,prevDecisionContainer,newDecisions ) ); - CHECK( setTracksLink( context,m_inputTracksKey,index,prevDecisionContainer,newDecisions ) ); - } - - ATH_MSG_DEBUG(" ** Added object links to output decision"); - - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgEVMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgEVMT.h deleted file mode 100644 index 278f4c2b07eb9f04d5c712ab5f9fc190fd44bb77..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgEVMT.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ -#ifndef TRIGBJETHYPO_TRIGBJETETHYPOALG_EV_MT_H -#define TRIGBJETHYPO_TRIGBJETETHYPOALG_EV_MT_H 1 - -#include "TrigBjetEtHypoAlgMT.h" -#include "AthViews/ViewHelper.h" - -class TrigBjetEtHypoAlgEVMT : public TrigBjetEtHypoAlgMT { - public: - TrigBjetEtHypoAlgEVMT( const std::string& name, ISvcLocator* pSvLocator ); - - virtual StatusCode initialize() override; - - protected: - TrigBjetEtHypoAlgEVMT(); - - virtual StatusCode retrieveJets( const EventContext&, - ElementLinkVector< xAOD::JetContainer >&, - const SG::ReadHandleKey< xAOD::JetContainer >&, - const TrigCompositeUtils::DecisionContainer* ) const override; - - virtual StatusCode retrieveRoIs( const EventContext&, - const TrigRoiDescriptorCollection*&, - const SG::ReadHandleKey< TrigRoiDescriptorCollection >& ) const override; - - virtual StatusCode setJetLink( const EventContext&, - const SG::ReadHandleKey< xAOD::JetContainer >&, - const unsigned int, - const TrigCompositeUtils::DecisionContainer*&, - std::vector< TrigCompositeUtils::Decision* >& ) const override; - - virtual StatusCode setTracksLink( const EventContext&, - const SG::ReadHandleKey< xAOD::TrackParticleContainer >&, - const unsigned int, - const TrigCompositeUtils::DecisionContainer*&, - std::vector< TrigCompositeUtils::Decision* >& ) const; - - virtual const TrigCompositeUtils::Decision* getPreviousDecision( const TrigCompositeUtils::DecisionContainer*,unsigned int ) const override; - - virtual StatusCode attachLinkToDecisions( const EventContext&, - const TrigCompositeUtils::DecisionContainer*, - std::vector< TrigCompositeUtils::Decision* >& ) const override; - - private: - Gaudi::Property< std::string > m_trackLink {this,"TracksLink","Undefined","Link for track particle container in the output decision"}; - SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputTracksKey {this,"Tracks","Undefined","Track particle key to be linked to the output decision"}; -}; - -#endif //> !TRIGBJETHYPO_TRIGBJETETHYPOALG_EV__H diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx index 68eec11705a71b3ecda2bac12185ebf6a48cbb24..f418b0af58f4996ffddef1fd6d8401dd5fefa50a 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.cxx @@ -23,6 +23,10 @@ StatusCode TrigBjetEtHypoAlgMT::initialize() { CHECK( m_inputRoIKey.initialize() ); CHECK( m_inputPrmVtx.initialize() ); + renounce( m_inputJetsKey ); + renounce( m_inputRoIKey ); + if ( m_retrieveVertexFromEventView == true ) renounce( m_inputPrmVtx ); + return StatusCode::SUCCESS; } @@ -34,24 +38,46 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { // ========================================================================================================================== // Read in previous Decisions made before running this Hypo Alg. + // The decisions come from the Jet group const TrigCompositeUtils::DecisionContainer *prevDecisionContainer = nullptr; CHECK( retrievePreviousDecisionContainer( context,prevDecisionContainer ) ); + ATH_MSG_DEBUG( "Found a total of " << prevDecisionContainer->size() << " previous decisions!" ); // Retrieve Jets + // These are the jets coming from the Jet selector in which RoIs have been constructed + // with PV constraint ElementLinkVector< xAOD::JetContainer > jetELs; - CHECK( retrieveJets( context,jetELs,m_inputJetsKey,prevDecisionContainer ) ); + CHECK( retrieveObjectFromEventView( context,jetELs,m_inputJetsKey,prevDecisionContainer ) ); ATH_MSG_DEBUG( "Found " << jetELs.size()<< " jets." ); for ( const ElementLink< xAOD::JetContainer >& jetLink : jetELs ) - ATH_MSG_DEBUG(" -- Jet pt=" << (*jetLink)->p4().Et() - <<" eta="<< (*jetLink)->eta() - << " phi="<< (*jetLink)->phi() ); - - + ATH_MSG_DEBUG( " -- Jet pt=" << (*jetLink)->p4().Et() + <<" eta="<< (*jetLink)->eta() + << " phi="<< (*jetLink)->phi() ); + + // The following is just for debugging. // Retrieve RoI (to be linked to the output decision) - const TrigRoiDescriptorCollection *roiContainer = nullptr; - if ( m_roiLink.value() != "Undefined" ) - CHECK( retrieveRoIs( context,roiContainer,m_inputRoIKey ) ); + ElementLinkVector< TrigRoiDescriptorCollection > roiELs; + CHECK( retrieveObjectFromEventView( context,roiELs,m_inputRoIKey,prevDecisionContainer ) ); + + ATH_MSG_DEBUG( "Found " << roiELs.size() << " rois." ); + for ( const ElementLink< TrigRoiDescriptorCollection >& roiLink : roiELs ) + ATH_MSG_DEBUG( " -- RoI eta=" << (*roiLink)->eta() << + " phi=" << (*roiLink)->phi() ); + + // The following is just for debugging. + // Retrieve PVs + ElementLinkVector< xAOD::VertexContainer > vertexELs; + if ( m_retrieveVertexFromEventView == true ) + CHECK( retrieveObjectFromEventView( context,vertexELs,m_inputPrmVtx,prevDecisionContainer ) ); + else + CHECK( retrieveObjectFromStoreGate( context,vertexELs,m_inputPrmVtx ) ); + + ATH_MSG_DEBUG( "Found " << vertexELs.size() <<" vertexes." ); + for ( const ElementLink< xAOD::VertexContainer >& vertexLink : vertexELs ) + ATH_MSG_DEBUG( " -- PV x="<< (*vertexLink)->x() << + " y=" << (*vertexLink)->y() << + " z=" << (*vertexLink)->z() ); // ========================================================================================================================== // ** Prepare Outputs @@ -65,21 +91,54 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { // ** Compute Decisions // ========================================================================================================================== - // We need nDecisions (one per RoI if we run on Event Views). Each decision having m chains ( m=m_hypoTools.size() ) - const unsigned int nDecisions = jetELs.size(); - - // Create output decisions ATH_MSG_DEBUG("Creating Output Decisions and Linking Stuff to it"); std::vector< TrigCompositeUtils::Decision* > newDecisions; - for ( unsigned int index(0); index<nDecisions; index++ ) { + /* + for ( const TrigCompositeUtils::Decision* inputDecision : *prevDecisionContainer ) { + + int index = 0; + if ( index < 0 ) continue; TrigCompositeUtils::Decision *toAdd = TrigCompositeUtils::newDecisionIn( outputDecisions, - getPreviousDecision(prevDecisionContainer,index), + inputDecision, + "", context ); + + // Adding Links + CHECK( attachLinksToDecision( context,*toAdd,index ) ); + newDecisions.push_back( toAdd ); + } + */ + + // Create output decisions + for ( unsigned int index(0); index < jetELs.size(); index++ ) { + + // Find correct previous decision + const TrigCompositeUtils::Decision *previousDecision = prevDecisionContainer->at(0); + + // Create new decisions + TrigCompositeUtils::Decision *toAdd = TrigCompositeUtils::newDecisionIn( outputDecisions, + previousDecision, "", context ); + + // find index of PV + int PVindex = -1; + + for ( unsigned int pvi(0); pvi < vertexELs.size(); pvi++ ) { + const ElementLink< xAOD::VertexContainer >& vertexLink = vertexELs.at( pvi ); + if ( (*vertexLink)->vertexType() != xAOD::VxType::VertexType::PriVtx ) continue; + PVindex = pvi; + break; + } + + if ( PVindex == -1 ) { + ATH_MSG_ERROR( "Primary Vertex could not be found!" ); + return StatusCode::FAILURE; + } + + // Adding Links + CHECK( attachLinksToDecision( context,*toAdd,index,PVindex ) ); newDecisions.push_back( toAdd ); } - // Adding Links - CHECK( attachLinkToDecisions( context,prevDecisionContainer,newDecisions) ); // ========================================================================================================================== // ** Prepare input to Hypo Tools @@ -87,11 +146,29 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { std::vector< TrigBjetEtHypoTool::TrigBjetEtHypoToolInfo > bJetHypoInputs; - for ( unsigned int index(0); index<nDecisions; index++ ) { + for ( TrigCompositeUtils::Decision* newDecision : newDecisions ) { + // Check navigation is set properly + if ( not newDecision->hasObjectCollectionLinks( TrigCompositeUtils::seedString() ) ) { + ATH_MSG_ERROR( "Trying to extract the IDs of the b-jet chains which are active." ); + ATH_MSG_ERROR( "But output decision has no link to seed collection." ); + return StatusCode::FAILURE; + } + // Check jets are attached properly + if ( not newDecision->hasObjectLink( TrigCompositeUtils::featureString() ) ) { + ATH_MSG_ERROR( "Trying to extract the associate jet to the output deicions." ); + ATH_MSG_ERROR( "But output decision has no link to jet." ); + return StatusCode::FAILURE; + } + + // Get Parent Decision + const ElementLinkVector< TrigCompositeUtils::DecisionContainer > mySeeds = newDecision->objectCollectionLinks< TrigCompositeUtils::DecisionContainer >( TrigCompositeUtils::seedString() ); + // Get Associated Jet + const ElementLink< xAOD::JetContainer > myJet = newDecision->objectLink< xAOD::JetContainer >( TrigCompositeUtils::featureString() ); + CHECK( myJet.isValid() ); // Extract the IDs of the b-jet chains which are active. // Previous decision IDs. - const TrigCompositeUtils::Decision *previousDecision = getPreviousDecision(prevDecisionContainer,index); + const TrigCompositeUtils::Decision *previousDecision = *mySeeds.back(); TrigCompositeUtils::DecisionIDContainer previousDecisionIDs { TrigCompositeUtils::decisionIDs( previousDecision ).begin(), @@ -100,8 +177,8 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { TrigBjetEtHypoTool::TrigBjetEtHypoToolInfo infoToAdd; infoToAdd.previousDecisionIDs = previousDecisionIDs; - infoToAdd.jetEL = jetELs.at( index ); - infoToAdd.decision = newDecisions.at( index ); + infoToAdd.jetEL = myJet; + infoToAdd.decision = newDecision; bJetHypoInputs.push_back( infoToAdd ); } @@ -120,66 +197,40 @@ StatusCode TrigBjetEtHypoAlgMT::execute( const EventContext& context ) const { return StatusCode::SUCCESS; } -StatusCode TrigBjetEtHypoAlgMT::retrieveJets( const EventContext& context, - ElementLinkVector< xAOD::JetContainer >& jetELs, - const SG::ReadHandleKey< xAOD::JetContainer >& inputJetsKey, - const TrigCompositeUtils::DecisionContainer* prevDecisionContainer ) const { - - CHECK( retrieveObjectFromStoreGate( context,jetELs,inputJetsKey,prevDecisionContainer ) ); - return StatusCode::SUCCESS; -} - -StatusCode TrigBjetEtHypoAlgMT::retrieveRoIs( const EventContext& context, - const TrigRoiDescriptorCollection*& roiContainer, - const SG::ReadHandleKey< TrigRoiDescriptorCollection >& inputRoIKey ) const { - ATH_MSG_DEBUG( "Retrieving input TrigRoiDescriptorCollection with key: " << inputRoIKey ); - SG::ReadHandle< TrigRoiDescriptorCollection > roiContainerHandle = SG::makeHandle( inputRoIKey,context ); - CHECK( roiContainerHandle.isValid() ); - - roiContainer = roiContainerHandle.get(); - ATH_MSG_DEBUG( "Retrieved " << roiContainer->size() <<" input RoIs" ); - for ( const TrigRoiDescriptor *roi : *roiContainer ) - ATH_MSG_DEBUG( " ** eta="<< roi->eta() << " phi=" << roi->phi() ); - - return StatusCode::SUCCESS; -} - -StatusCode TrigBjetEtHypoAlgMT::setJetLink( const EventContext& /*context*/, - const SG::ReadHandleKey< xAOD::JetContainer >& jetKey, - const unsigned int index, - const TrigCompositeUtils::DecisionContainer*& /*inputDecisions*/, - std::vector< TrigCompositeUtils::Decision* >& outputDecisions ) const { - - outputDecisions.at(index)->setObjectLink( TrigCompositeUtils::featureString(),ElementLink< xAOD::JetContainer >( jetKey.key(),index ) ); - return StatusCode::SUCCESS; -} - -const TrigCompositeUtils::Decision* TrigBjetEtHypoAlgMT::getPreviousDecision( const TrigCompositeUtils::DecisionContainer* decisionContainer, - unsigned int /*index*/ ) const { - return decisionContainer->at(0); -} - -StatusCode TrigBjetEtHypoAlgMT::attachLinkToDecisions( const EventContext& context, - const TrigCompositeUtils::DecisionContainer* prevDecisionContainer, - std::vector< TrigCompositeUtils::Decision* >& newDecisions ) const { - const unsigned int nDecisions = newDecisions.size(); - - for ( unsigned int index(0); index<nDecisions; index++ ) { - // We want multiple output decision (one per RoI/Jet) - - // A little bit tricky here, we may need to revise this in the future - // In case what we want to link lives inside a view we have to do a few additional things - // in order to be able to link it to the output decision - if ( m_roiLink.value() != "Undefined" && m_inputRoIKey.key() != "Undefined" ) - newDecisions.at( index )->setObjectLink( m_roiLink.value(),ElementLink< TrigRoiDescriptorCollection >( m_inputRoIKey.key(),index ) ); - - if ( m_prmVtxLink.value() != "Undefined" && m_inputPrmVtx.key() != "Undefined") - newDecisions.at( index )->setObjectLink( m_prmVtxLink.value(),ElementLink< xAOD::VertexContainer >( m_inputPrmVtx.key(),0 ) ); - - CHECK( setJetLink( context,m_inputJetsKey,index,prevDecisionContainer,newDecisions ) ); - } +StatusCode TrigBjetEtHypoAlgMT::attachLinksToDecision( const EventContext& context, + TrigCompositeUtils::Decision& toAdd, + int index, + int indexPrmVertex ) const { + + // Do the linking... + // Link Jet + CHECK( attachObjectLinkToDecisionFromEventView( context, + toAdd, + m_inputJetsKey, + TrigCompositeUtils::featureString(), + index ) ); + + // Link RoI + CHECK( attachObjectLinkToDecisionFromEventView( context, + toAdd, + m_inputRoIKey, + m_roiLink.value(), + index ) ); + + // Link Vertex + if ( m_retrieveVertexFromEventView ) + CHECK( attachObjectLinkToDecisionFromEventView( context, + toAdd, + m_inputPrmVtx, + m_prmVtxLink.value(), + indexPrmVertex ) ); + else + CHECK( attachObjectLinkToDecisionFromStoreGate( toAdd, + m_inputPrmVtx, + m_prmVtxLink.value(), + indexPrmVertex ) ); ATH_MSG_DEBUG(" ** Added object links to output decision"); - return StatusCode::SUCCESS; } + diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.h index a4a28c9764283cc4aa0fe931a5c1f717184c9e08..466c38bded7db804ba23832410ab257fab8a45dd 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetEtHypoAlgMT.h @@ -23,36 +23,23 @@ class TrigBjetEtHypoAlgMT : public TrigBjetHypoAlgBaseMT { protected: TrigBjetEtHypoAlgMT(); - virtual StatusCode retrieveJets( const EventContext&, - ElementLinkVector< xAOD::JetContainer >&, - const SG::ReadHandleKey< xAOD::JetContainer >&, - const TrigCompositeUtils::DecisionContainer* ) const; - - virtual StatusCode retrieveRoIs( const EventContext&, - const TrigRoiDescriptorCollection*&, - const SG::ReadHandleKey< TrigRoiDescriptorCollection >& ) const; - - virtual StatusCode setJetLink( const EventContext&, - const SG::ReadHandleKey< xAOD::JetContainer >&, - const unsigned int, - const TrigCompositeUtils::DecisionContainer*&, - std::vector< TrigCompositeUtils::Decision* >& ) const; - - virtual const TrigCompositeUtils::Decision* getPreviousDecision( const TrigCompositeUtils::DecisionContainer*,unsigned int ) const; - - virtual StatusCode attachLinkToDecisions( const EventContext&, - const TrigCompositeUtils::DecisionContainer*, - std::vector< TrigCompositeUtils::Decision* >& ) const; + virtual StatusCode attachLinksToDecision( const EventContext&, + TrigCompositeUtils::Decision&, + int index, + int indexPrmVertex = 0 ) const; protected: ToolHandleArray< TrigBjetEtHypoTool > m_hypoTools {this,"HypoTools",{},"Hypo Tools"}; Gaudi::Property< std::string > m_roiLink {this,"RoILink","Undefined","RoI link to attach to the output decision"}; Gaudi::Property< std::string > m_prmVtxLink {this,"PrmVtxLink","Undefined","PrmVtx link to attach to the output decision"}; + + Gaudi::Property< bool > m_retrieveVertexFromEventView {this,"RetrieveVertexFromEventView",false,"State where the prim vertex has to be retrieved from the Event or from the View context"}; SG::ReadHandleKey< xAOD::JetContainer > m_inputJetsKey {this,"Jets","Undefined","Input Jet Container Key"}; SG::ReadHandleKey< TrigRoiDescriptorCollection > m_inputRoIKey {this,"RoIs","Undefined","Input RoIs that will be linked to the output decision"}; SG::ReadHandleKey< xAOD::VertexContainer > m_inputPrmVtx {this,"PrmVtx","Undefined","Primary vertex to be linked to the output decision"}; }; + #endif diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.h index 4df2130edfdc45c021da97631e43a3b6a296a7f7..107e5e72174c2908c874da6bc48cbd3cc336d607 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.h +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.h @@ -13,12 +13,6 @@ #include "DecisionHandling/TrigCompositeUtils.h" #include "AthLinks/ElementLinkVector.h" -#include "xAODJet/JetContainer.h" -#include "xAODJet/JetAuxContainer.h" - -#include "xAODTracking/VertexContainer.h" -#include "xAODTracking/VertexAuxContainer.h" - #include "TrigBjetEtHypoTool.h" #include "TrigInDetEvent/TrigInDetTrackCollection.h" @@ -36,7 +30,7 @@ class TrigBjetHypoAlgBaseMT : public ::HypoBase { virtual ~TrigBjetHypoAlgBaseMT(); virtual StatusCode initialize() = 0; - virtual StatusCode execute( const EventContext& context ) const = 0; + virtual StatusCode execute( const EventContext& ) const = 0; protected: TrigBjetHypoAlgBaseMT(); @@ -44,73 +38,65 @@ class TrigBjetHypoAlgBaseMT : public ::HypoBase { StatusCode retrievePreviousDecisionContainer( const EventContext&, const TrigCompositeUtils::DecisionContainer*& ) const; - template < class T > + virtual StatusCode attachLinksToDecision( const EventContext&, + TrigCompositeUtils::Decision&, + int index, + int indexPrmVertex = 0 ) const = 0; + + + template < class CONTAINER > StatusCode retrieveObjectFromStoreGate( const EventContext&, - ElementLinkVector< DataVector< T > >&, - const SG::ReadHandleKey< DataVector< T > >&, - const TrigCompositeUtils::DecisionContainer* ) const; + ElementLinkVector< CONTAINER >&, + const SG::ReadHandleKey< CONTAINER >& ) const; - template < class T > + template < class CONTAINER > StatusCode retrieveObjectFromEventView( const EventContext&, - ElementLinkVector< DataVector< T > >&, - const SG::ReadHandleKey< DataVector< T > >&, + ElementLinkVector< CONTAINER >&, + const SG::ReadHandleKey< CONTAINER >&, const TrigCompositeUtils::DecisionContainer* ) const; - virtual StatusCode attachLinkToDecisions( const EventContext&, - const TrigCompositeUtils::DecisionContainer*, - std::vector< TrigCompositeUtils::Decision* >& ) const = 0; + + template< class CONTAINER > + StatusCode attachObjectLinkToDecisionFromStoreGate( TrigCompositeUtils::Decision&, + const SG::ReadHandleKey< CONTAINER >&, + const std::string&, + int objIndex = 0 ) const; + + template< class CONTAINER > + StatusCode attachObjectLinkToDecisionsFromStoreGate( std::vector< TrigCompositeUtils::Decision* >&, + const SG::ReadHandleKey< CONTAINER >&, + const std::string&, + int forcedIndex = -1 ) const; + + template< class CONTAINER > + StatusCode attachObjectLinkToDecisionFromEventView( const EventContext&, + TrigCompositeUtils::Decision&, + const SG::ReadHandleKey< CONTAINER >&, + const std::string&, + int objIndex = 0 ) const; + + + template< class CONTAINER > + StatusCode attachObjectLinkToDecisionsFromEventView( const EventContext&, + std::vector< TrigCompositeUtils::Decision* >&, + const SG::ReadHandleKey< CONTAINER >&, + const std::string&, + int forcedIndex = -1 ) const; + + template < class CONTAINER > + StatusCode attachObjectCollectionLinkToDecisionsFromEventView( const EventContext&, + std::vector< TrigCompositeUtils::Decision* >&, + const SG::ReadHandleKey< CONTAINER >&, + const std::string& ) const; }; // ======================================================================================== // -template < class T > -StatusCode TrigBjetHypoAlgBaseMT::retrieveObjectFromStoreGate( const EventContext& context, - ElementLinkVector< DataVector< T > >& ELs, - const SG::ReadHandleKey< DataVector< T > >& inputKey, - const TrigCompositeUtils::DecisionContainer* /*prevDevisionContainer*/) const { - - ATH_MSG_DEBUG( "Retrieving object from StoreGate from " << inputKey.key() ); - - SG::ReadHandle< DataVector<T > > ContainerHandle = SG::makeHandle( inputKey,context ); - CHECK( ContainerHandle.isValid() ); - const DataVector< T > *Collection = ContainerHandle.get(); - - for (const T* obj : *Collection) { - ElementLink< DataVector< T > > Link = ElementLink< DataVector< T > >(*Collection, obj->index()); - ELs.push_back( Link ); - } - - return StatusCode::SUCCESS; -} - -template < class T > -StatusCode TrigBjetHypoAlgBaseMT::retrieveObjectFromEventView( const EventContext& context, - ElementLinkVector< DataVector< T > >& ELs, - const SG::ReadHandleKey< DataVector< T > >& inputKey, - const TrigCompositeUtils::DecisionContainer* prevDevisionContainer) const { - - ATH_MSG_DEBUG( "Retrieving object from Event View from " << inputKey.key() ); - - for ( const TrigCompositeUtils::Decision* previousDecision: *prevDevisionContainer ) { - // get View - ElementLink< ViewContainer > viewEL = previousDecision->objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); - ATH_CHECK( viewEL.isValid() ); - ATH_MSG_DEBUG( "Retrieved View" ); - - SG::ReadHandle< DataVector< T > > Handle = ViewHelper::makeHandle( *viewEL, inputKey, context ); - ATH_CHECK( Handle.isValid() ); - ATH_MSG_DEBUG ( "EventView " << (*viewEL)->name() << " has object's container of size: " << Handle->size() ); - - size_t Counter = 0; - for ( auto it = Handle->begin(); it != Handle->end(); ++it, ++Counter ) { - ElementLink< DataVector< T > > EL = ViewHelper::makeLink< DataVector< T > >( *viewEL, Handle, Counter ); - ATH_CHECK( EL.isValid() ); - ELs.push_back( EL ); - } - } - - return StatusCode::SUCCESS; -} - -#endif //> !TRIGBJETHYPO_TRIGBJETETHYPOALG_H +#include "TrigBjetHypoAlgBaseMT.icc" + +// ======================================================================================== // + +#endif + + diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc new file mode 100644 index 0000000000000000000000000000000000000000..18e45ed48cb487bfa1b86fb9ea0f6c1cc7dba617 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetHypoAlgBaseMT.icc @@ -0,0 +1,201 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +template < class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::retrieveObjectFromStoreGate( const EventContext& context, + ElementLinkVector< CONTAINER >& ELs, + const SG::ReadHandleKey< CONTAINER >& inputKey ) const { + + ATH_MSG_DEBUG( "Retrieving object from StoreGate from " << inputKey.key() ); + + SG::ReadHandle< CONTAINER > ContainerHandle = SG::makeHandle( inputKey,context ); + CHECK( ContainerHandle.isValid() ); + const CONTAINER *Collection = ContainerHandle.get(); + + for (const auto* obj : *Collection) { + ElementLink< CONTAINER > Link = ElementLink< CONTAINER >(*Collection, obj->index()); + ELs.push_back( Link ); + } + + return StatusCode::SUCCESS; +} + +template < class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::retrieveObjectFromEventView( const EventContext& context, + ElementLinkVector< CONTAINER >& ELs, + const SG::ReadHandleKey< CONTAINER >& inputKey, + const TrigCompositeUtils::DecisionContainer* prevDevisionContainer ) const { + + ATH_MSG_DEBUG( "Retrieving object from Event View from " << inputKey.key() ); + + for ( const TrigCompositeUtils::Decision* previousDecision: *prevDevisionContainer ) { + // get View + ElementLink< ViewContainer > viewEL = previousDecision->objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); + ATH_CHECK( viewEL.isValid() ); + ATH_MSG_DEBUG( "Retrieved View" ); + + SG::ReadHandle< CONTAINER > Handle = ViewHelper::makeHandle( *viewEL, inputKey, context ); + ATH_CHECK( Handle.isValid() ); + ATH_MSG_DEBUG ( "EventView " << (*viewEL)->name() << " has object's container of size: " << Handle->size() ); + + size_t Counter = 0; + for ( auto it = Handle->begin(); it != Handle->end(); ++it, ++Counter ) { + ElementLink< CONTAINER > EL = ViewHelper::makeLink< CONTAINER >( *viewEL, Handle, Counter ); + ATH_CHECK( EL.isValid() ); + ELs.push_back( EL ); + } + } + + return StatusCode::SUCCESS; +} + + + + +template< class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::attachObjectLinkToDecisionFromStoreGate( TrigCompositeUtils::Decision& outputDecision, + const SG::ReadHandleKey< CONTAINER >& objectKey, + const std::string& objLink, + int objIndex ) const { + + // Do the linking + ATH_MSG_DEBUG( "Adding object with link name '" << objLink << "'" ); + outputDecision.setObjectLink( objLink,ElementLink< CONTAINER >( objectKey.key(),objIndex ) ); + + return StatusCode::SUCCESS; +} + +template< class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::attachObjectLinkToDecisionsFromStoreGate( std::vector< TrigCompositeUtils::Decision* >& outputDecisions, + const SG::ReadHandleKey< CONTAINER >& objectKey, + const std::string& objLink, + int forcedIndex ) const { + + for ( unsigned int index(0); index < outputDecisions.size(); index++ ) { + + int objIndex = index; + // This is used for primary vertex (one single obj attached to every output decisions) + if ( forcedIndex >= 0 ) + objIndex = forcedIndex; + + // Get the correct decisions + TrigCompositeUtils::Decision* outputDecision = outputDecisions.at( index ); + + CHECK( attachObjectLinkToDecisionFromStoreGate( *outputDecision, + objectKey, + objLink, + objIndex ) ); + } + + return StatusCode::SUCCESS; +} + + +template< class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::attachObjectLinkToDecisionFromEventView( const EventContext& context, + TrigCompositeUtils::Decision& outputDecision, + const SG::ReadHandleKey< CONTAINER >& objectKey, + const std::string& objLink, + int objIndex ) const { + + // Check navigation is set properly + if ( not outputDecision.hasObjectCollectionLinks( TrigCompositeUtils::seedString() ) ) { + ATH_MSG_ERROR( "Trying to add object link with handle key '" << objectKey.key() << "' to output decision with link name '" << objLink <<"'" ); + ATH_MSG_ERROR( "But output decision does not have link to seed collection!" ); + return StatusCode::FAILURE; + } + + // Get parent decision + const ElementLinkVector< TrigCompositeUtils::DecisionContainer > mySeeds = outputDecision.objectCollectionLinks< TrigCompositeUtils::DecisionContainer >( TrigCompositeUtils::seedString() ); + const TrigCompositeUtils::Decision inputDecision = **mySeeds.back(); + + // Get object link from view, taken from the input decision + ElementLink< ViewContainer > viewEL = inputDecision.objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); + ATH_CHECK( viewEL.isValid() ); + + SG::ReadHandle< CONTAINER > calObjectHandle = ViewHelper::makeHandle( *viewEL, objectKey, context ); + ATH_CHECK( calObjectHandle.isValid() ); + + ElementLink< CONTAINER > objEL = ViewHelper::makeLink( *viewEL, calObjectHandle, objIndex ); + ATH_CHECK( objEL.isValid() ); + + // Do the linking + ATH_MSG_DEBUG( "Adding object with link name '" << objLink << "'" ); + outputDecision.setObjectLink( objLink,objEL ); + + return StatusCode::SUCCESS; +} + +template< class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::attachObjectLinkToDecisionsFromEventView( const EventContext& context, + std::vector< TrigCompositeUtils::Decision* >& outputDecisions, + const SG::ReadHandleKey< CONTAINER >& objectKey, + const std::string& objLink, + int forcedIndex ) const { + + for ( unsigned int index(0); index<outputDecisions.size(); index++ ) { + + int objIndex = index; + // This is used for primary vertex (one single obj attached to every output decisions) + if ( forcedIndex >= 0 ) + objIndex = forcedIndex; + + // Get the correct decision + TrigCompositeUtils::Decision* outputDecision = outputDecisions.at( index ); + + CHECK( attachObjectLinkToDecisionFromEventView( context, + *outputDecision, + objectKey, + objLink, + objIndex ) ); + } + + return StatusCode::SUCCESS; +} + +template < class CONTAINER > +StatusCode TrigBjetHypoAlgBaseMT::attachObjectCollectionLinkToDecisionsFromEventView( const EventContext& context, + std::vector< TrigCompositeUtils::Decision* >& outputDecisions, + const SG::ReadHandleKey< CONTAINER >& objectKey, + const std::string& objLink ) const { + + for ( TrigCompositeUtils::Decision* outputDecision : outputDecisions ) { + + // Check navigation is set properly + if ( not outputDecision->hasObjectCollectionLinks( TrigCompositeUtils::seedString() ) ) { + ATH_MSG_ERROR( "Trying to add object collection link with handle key '" << objectKey.key() << "' to output decision with link name '" << objLink <<"'" ); + ATH_MSG_ERROR( "But output decision does not have link to seed collection!" ); + return StatusCode::FAILURE; + } + + // Get corresponding input decision + const ElementLinkVector< TrigCompositeUtils::DecisionContainer > mySeeds = outputDecision->objectCollectionLinks< TrigCompositeUtils::DecisionContainer >( TrigCompositeUtils::seedString() ); + const TrigCompositeUtils::Decision* inputDecision = *mySeeds.back(); + + // Get object link from view, taken from the input decision + ElementLink< ViewContainer > viewEL = inputDecision->objectLink< ViewContainer >( TrigCompositeUtils::viewString() ); + ATH_CHECK( viewEL.isValid() ); + + SG::ReadHandle< CONTAINER > calObjectHandle = ViewHelper::makeHandle( *viewEL,objectKey,context ); + ATH_CHECK( calObjectHandle.isValid() ); + + // Create Collection to be linked + ElementLinkVector< CONTAINER > objELs; + for ( unsigned int i(0); i<calObjectHandle->size(); i++ ) { + ElementLink< CONTAINER > objEL = ViewHelper::makeLink( *viewEL, calObjectHandle, i ); + ATH_CHECK( objEL.isValid() ); + objELs.push_back( objEL ); + } + + // Do the linking + ATH_MSG_DEBUG( "Adding object collection with link name '" << objLink << "' and size " << objELs.size() ); + outputDecision->addObjectCollectionLinks( objLink,objELs ); + } + + return StatusCode::SUCCESS; +} + + + + diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx index dce2b69f4bfc26b8e18e70fe19c9410e19ee5f44..e26748fbb9da914b2dff65c994fa07b1c387dcd2 100755 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx @@ -87,53 +87,48 @@ StatusCode TrigBtagFexMT::initialize() { // ----------------------------------------------------------------------------------------------------------------- StatusCode TrigBtagFexMT::execute() { - - const EventContext& ctx = getContext(); - - ATH_MSG_DEBUG( "Executing TrigBtagFexMT" ); - ATH_MSG_DEBUG("--- BTAGFEX: EXECUTING"); + ATH_MSG_DEBUG( "Executing " << name() << "... " ); + const EventContext& ctx = getContext(); // Test retrieval of JetContainer - SG::ReadHandle<xAOD::JetContainer> jetContainer (m_JetContainerKey); - if (!jetContainer.isValid()) { - ATH_MSG_ERROR(" cannot retrieve JetContainer with key " << m_JetContainerKey.key()); - return StatusCode::FAILURE; - } - if (jetContainer->size() == 0) { - ATH_MSG_DEBUG(" BTAGFEX: JetContainer --> empty!"); - } - else { - ATH_MSG_DEBUG(" BTAGFEX: JetContainer --> n = " << jetContainer->size()); - } + ATH_MSG_DEBUG( "Attempting to retrieve JetContainer with key " << m_JetContainerKey.key() ); + SG::ReadHandle< xAOD::JetContainer > jetContainerHandle = SG::makeHandle< xAOD::JetContainer >( m_JetContainerKey,ctx ); + CHECK( jetContainerHandle.isValid() ); + const xAOD::JetContainer *jetContainer = jetContainerHandle.get(); + ATH_MSG_DEBUG( "Retrieved " << jetContainer->size() << " jets" ); - // Test retrieval of VertexContainer - const xAOD::VertexContainer* vxContainer (0); - StatusCode sc = evtStore()->retrieve(vxContainer, m_VertexContainerKey.key()); - if (sc.isFailure()) { - ATH_MSG_ERROR(" cannot retrieve Vertex Container with key " << m_VertexContainerKey.key()); - return StatusCode::SUCCESS; - } - if (vxContainer->size()==0) { - ATH_MSG_DEBUG(" BTAGFEX: VertexContainer --> empty!"); - return StatusCode::SUCCESS; - } - else { - ATH_MSG_DEBUG(" BTAGFEX: VertexContainer --> n = " << vxContainer->size()); - } + for ( const xAOD::Jet *jet : *jetContainer ) + ATH_MSG_DEBUG( " BTAGFEX: ** pt=" << jet->p4().Et() * 1e-3 << + " eta=" << jet->eta() << + " phi=" << jet->phi() ); // Test retrieval of Track Particles - SG::ReadHandle< xAOD::TrackParticleContainer > trkContainerHandle = SG::makeHandle( m_trkContainerKey,ctx ); + ATH_MSG_DEBUG( "Attempting to retrieve TrackParticleContainer with key " << m_trkContainerKey.key() ); + SG::ReadHandle< xAOD::TrackParticleContainer > trkContainerHandle = SG::makeHandle< xAOD::TrackParticleContainer >( m_trkContainerKey,ctx ); CHECK( trkContainerHandle.isValid() ); + const xAOD::TrackParticleContainer *trkContainer = trkContainerHandle.get(); ATH_MSG_DEBUG("Retrieved " << trkContainerHandle->size() << " Tracks"); - const xAOD::TrackParticleContainer *trkContainer = trkContainerHandle.get(); - - for ( auto trk : *trkContainer ) { - ATH_MSG_DEBUG( " *** pt=" << trk->p4().Et() ); - } + for ( const xAOD::TrackParticle *trk : *trkContainer ) + ATH_MSG_DEBUG( " *** pt=" << trk->p4().Et() * 1e-3 << + " eta=" << trk->eta() << + " phi=" << trk->phi() ); + + + // Test retrieval of VertexContainer + ATH_MSG_DEBUG( "Attempting to retrieve VertexContainer with key " << m_VertexContainerKey.key() ); + SG::ReadHandle< xAOD::VertexContainer > vxContainerHandle = SG::makeHandle< xAOD::VertexContainer >( m_VertexContainerKey, ctx ); + CHECK( vxContainerHandle.isValid() ); + const xAOD::VertexContainer* vxContainer = vxContainerHandle.get(); + ATH_MSG_DEBUG( "Retrieved " << vxContainer->size() <<" vertices..." ); + + for ( const xAOD::Vertex *pv : *vxContainer ) + ATH_MSG_DEBUG( " ** PV x=" << pv->x()<< + " y=" << pv->y() << + " z=" << pv->z() ); // Creating dummy B-Tagging container in order to avoid diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigGSCFexMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigGSCFexMT.cxx deleted file mode 100644 index d68b7515357fff10d7b2c4fb68ff2f342cf29ce2..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigGSCFexMT.cxx +++ /dev/null @@ -1,239 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// ************************************************ -// -// NAME: TrigGSCFexMT.cxx -// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo -// -// ************************************************ - -#include "TrigGSCFexMT.h" - -// ONLINE INFRASTRUCTURE -#include "TrigSteeringEvent/TrigRoiDescriptor.h" - -// EDM - -#include "xAODBase/IParticle.h" - -#include "xAODJet/Jet.h" -#include "xAODJet/JetContainer.h" - -#include "xAODTracking/TrackParticleContainer.h" - -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" -#include "xAODTracking/VertexAuxContainer.h" -#include "CxxUtils/phihelper.h" - -// ----------------------------------------------------------------------------------------------------------------- - - -TrigGSCFexMT::TrigGSCFexMT(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) {} - -// ----------------------------------------------------------------------------------------------------------------- - -StatusCode TrigGSCFexMT::initialize() { - - // declareProperty overview - ATH_MSG_DEBUG( "declareProperty review:" ); - ATH_MSG_DEBUG( " " << m_JetContainerKey ); - ATH_MSG_DEBUG( " " << m_VertexContainerKey ); - ATH_MSG_DEBUG( " " << m_TrackParticleContainerKey ); - ATH_MSG_DEBUG( " " << m_jetOutputKey ); - - ATH_MSG_DEBUG( "Initializing ReadHandleKeys" ); - ATH_CHECK( m_roiContainerKey.initialize() ); - ATH_CHECK( m_JetContainerKey.initialize() ); - ATH_CHECK( m_VertexContainerKey.initialize() ); - ATH_CHECK( m_TrackParticleContainerKey.initialize() ); - ATH_CHECK( m_jetOutputKey.initialize() ); - - ATH_MSG_DEBUG( "Retrieving Tools" ); - ATH_CHECK( m_jetGSCCalib_tool.retrieve() ); - - return StatusCode::SUCCESS; -} - - -// ----------------------------------------------------------------------------------------------------------------- - - -StatusCode TrigGSCFexMT::execute() { - ATH_MSG_DEBUG( "Executing TrigGSCFexMT" ); - - const EventContext& ctx = getContext(); - - // ============================================================================================================================== - // ** Retrieve Ingredients - // ============================================================================================================================== - - // Jets - ATH_MSG_DEBUG( "Ready to retrieve jets : " << m_JetContainerKey.key() ); - SG::ReadHandle< xAOD::JetContainer > jetContainerHandle = SG::makeHandle( m_JetContainerKey,ctx ); - CHECK( jetContainerHandle.isValid() ); - - const xAOD::JetContainer *jetContainer = jetContainerHandle.get(); - ATH_MSG_DEBUG( "Retrieved " << jetContainer->size() << " input Jets for GSC correction : " << m_JetContainerKey ); - for ( const xAOD::Jet *jet : *jetContainer ) - ATH_MSG_DEBUG( " ** Jet pt=" << jet->p4().Et() <<" eta="<< jet->eta()<< " phi="<< jet->phi() ); - - // Primary Vertex - ATH_MSG_DEBUG( "Ready to retrieve primary vertex : " << m_VertexContainerKey ); - SG::ReadHandle< xAOD::VertexContainer > vertexContainerHandle = SG::makeHandle( m_VertexContainerKey,ctx ); - CHECK( vertexContainerHandle.isValid() ); - - const xAOD::VertexContainer *vertexContainer = vertexContainerHandle.get(); - for ( const xAOD::Vertex *primVtx : *vertexContainer ) - ATH_MSG_DEBUG( " ** PV = " << primVtx->x() << "," << primVtx->y() << "," << primVtx->z() ); - - // SG::ReadHandle< xAOD::VertexContainer > prmVtxContainerHandle = SG::makeHandle( m_VertexContainerKey,ctx ); - - SG::ReadHandle< xAOD::TrackParticleContainer > trkParticlesHandle = SG::makeHandle( m_TrackParticleContainerKey,ctx ); - CHECK( trkParticlesHandle.isValid() ); - const xAOD::TrackParticleContainer *trkParticlesContainer = trkParticlesHandle.get(); - ATH_MSG_DEBUG( "Retrieved " << trkParticlesContainer->size() <<" Precision Tracks." ); - for ( const xAOD::TrackParticle *particle : *trkParticlesContainer ) { - ATH_MSG_DEBUG( " ** pt=" << particle->p4().Et() <<" eta="<<particle->eta()<< " phi="<< particle->phi() ); - } - - - - // ============================================================================================================================== - // ** Prepare Output - // ============================================================================================================================== - - std::unique_ptr< xAOD::JetContainer > calibrateJets( new xAOD::JetContainer() ); - std::unique_ptr< xAOD::JetAuxContainer > calibratedJetsAux( new xAOD::JetAuxContainer() ); - calibrateJets->setStore( calibratedJetsAux.get() ); - - // ============================================================================================================================== - // ** Calibrate Jets - // ============================================================================================================================== - - /* - unsigned int nTrk(0); - double width(0); - double ptsum(0); - - // xAOD::TrackParticleContainer::const_iterator trkParticlesIter = trkParticlesHandle->begin(); - for ( const xAOD::TrackParticle* trk : *trkParticlesHandle ) { - - //std::cout << "\tTrigGSCFex: track" - // << " pt: " << trk->p4().Pt() - // << " eta: " << trk->p4().Eta() - // << " phi: " << trk->p4().Phi() - // << " m: " << trk->p4().M() - // << std::endl; - - // - // trkIsGood() defined below - // - if( trkIsGood(trk) && - fabs( (trk->z0() + trk->vz() - primaryVertex->z()) * sin(trk->theta()) ) <= 1.0 ){ - - float dEta = (trk->eta() - jet.p4().Eta()); - float dPhi = CxxUtils::deltaPhi(trk->phi(), jet.p4().Phi()); - width += trk->pt() * sqrt( dEta*dEta + dPhi*dPhi); - ptsum += trk->pt(); - - ++nTrk; - } - - } - - if ( ptsum > 0 ) width = width / ptsum; - else width = -1.; - - // - // Set moments in the jet - // - std::vector<float> widthVector; - widthVector.push_back(width); - jet.setAttribute("TrackWidthPt1000", widthVector); - - std::vector<int> ntrkVector; - ntrkVector.push_back(nTrk); - jet.setAttribute("NumTrkPt1000", ntrkVector); - - // - // Muon segments must also be set for calibration tool to work - // fill w/ 0 as a dummy - int gmsc = 0; - jet.setAttribute("GhostMuonSegmentCount", gmsc); - - - // EXECUTE OFFLINE TOOLS - - // calJet is a pointer to the new, calibrated jet - xAOD::Jet* calJet = nullptr; - m_jetGSCCalib_tool->calibratedCopy(jet,calJet); - // Now we have a new fully calibrated jet! - - //std::cout << "TrigGSCFex: New jet" - // << " pt: " << calJet->p4().Pt() - // << " eta: " << calJet->p4().Eta() - // << " phi: " << calJet->p4().Phi() - // << " m: " << calJet->p4().M() - // << std::endl; - - */ - ATH_MSG_DEBUG( "Ready to perform calibration" ); - for ( const xAOD::Jet *inJet : *jetContainer ) { - /* - xAOD::Jet *outJet = nullptr; - m_jetGSCCalib_tool->calibratedCopy( inJet,outJet ); - */ - xAOD::Jet *outJet = new xAOD::Jet(); - calibrateJets->push_back( outJet ); - *outJet = *inJet; - } - ATH_MSG_DEBUG( " ** Calibration performed" ); - for ( const xAOD::Jet *calJet : *calibrateJets ) - ATH_MSG_DEBUG( " -- pt=" << calJet->p4().Et() << " eta="<< calJet->eta() << " phi="<< calJet->phi() ); - - // ============================================================================================================================== - // ** Store Output - // ============================================================================================================================== - - ATH_MSG_DEBUG( "Storing calibrated jets as " << m_jetOutputKey.key() ); - SG::WriteHandle< xAOD::JetContainer > outputJetContainerHandle = SG::makeHandle( m_jetOutputKey,ctx ); - ATH_CHECK( outputJetContainerHandle.record( std::move(calibrateJets),std::move(calibratedJetsAux) ) ); - ATH_MSG_DEBUG( "Exiting" ); - return StatusCode::SUCCESS; -} - - -// ----------------------------------------------------------------------------------------------------------------- - -bool TrigGSCFexMT::trkIsGood(const xAOD::TrackParticle *trk){ - - uint8_t numberOfPixelHits=0; - if( ! trk->summaryValue (numberOfPixelHits, xAOD::SummaryType::numberOfPixelHits) ) - std::cout<<"numberOfPixelHits not available"<<std::endl; - uint8_t numberOfPixelHoles=0; - if( ! trk->summaryValue (numberOfPixelHoles, xAOD::SummaryType::numberOfPixelHoles) ) - std::cout<<"numberOfPixelHoles not available"<<std::endl; - uint8_t numberOfSCTHits=0; - if( ! trk->summaryValue (numberOfSCTHits, xAOD::SummaryType::numberOfSCTHits) ) - std::cout<<"numberOfSCTHits not available"<<std::endl; - uint8_t numberOfSCTHoles=0; - if( ! trk->summaryValue (numberOfSCTHoles, xAOD::SummaryType::numberOfSCTHoles) ) - std::cout<<"numberOfSCTHoles not available"<<std::endl; - uint8_t numberOfPixelSharedHits=0; - if( ! trk->summaryValue (numberOfPixelSharedHits, xAOD::SummaryType::numberOfPixelSharedHits) ) - std::cout<<"numberOfPixelSharedHits not available"<<std::endl; - - if(trk->pt() >= 1000. //not 400 MeV - && fabs(trk->eta()) <= 2.5 - && (numberOfPixelHits + numberOfSCTHits) >= 7 - && (numberOfPixelHoles + numberOfSCTHoles) <= 2 - && numberOfPixelHoles <= 1 - && numberOfPixelSharedHits <= 1) //this should be shared modules, but including SCT doesn't seem straightforward - return true; - - return false; -} diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigGSCFexMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigGSCFexMT.h deleted file mode 100644 index ef9105a88c83438ea6b0b83433059b187b0e0e36..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigGSCFexMT.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// ************************************************ -// -// NAME: TrigGSCFex.h -// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo -// -// AUTHOR: Carlo Varni -// EMAIL: carlo.varni@ge.infn.it -// -// ************************************************ - -#ifndef TRIGBJETHYPO_TRIGGSCFEX_MT_H -#define TRIGBJETHYPO_TRIGGSCFEX_MT_H - -#include <vector> -#include <string> - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "StoreGate/ReadHandleKey.h" -#include "StoreGate/WriteHandleKey.h" - -#include "GaudiKernel/ToolHandle.h" - -#include "JetCalibTools/IJetCalibrationTool.h" - -#include "xAODJet/JetContainer.h" -#include "xAODJet/JetAuxContainer.h" - -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" - -/** - * @brief FEX class for the b-jet weight construction using offline tools - * - * @author John Alison <johnda @ uchicago.edu> - * - * This is the base feature extraction class for the HLT jet slice. - * It computes applies the GSC calibration based on b-jet tracks - */ - - -class TrigGSCFexMT : public AthAlgorithm { - public: - /** @brief Constructor */ - TrigGSCFexMT(const std::string&, ISvcLocator*); - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - - private: - bool trkIsGood(const xAOD::TrackParticle *trk); - - private: - // TOOLS - /** @brief Offline BTag tool */ - PublicToolHandle< IJetCalibrationTool > m_jetGSCCalib_tool {this,"JetGSCCalibrationTool","","JetCalibrationTool for applying GSC correction"}; - - // PROPERTIES - /** @brief Switch for offline tools */ - Gaudi::Property< bool > m_setupOfflineTools {this,"setupOfflineTools",false,"Switch for offline tools"}; - - private : - SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiContainerKey {this,"RoIs","initialRoI","Initial RoIs"}; - SG::ReadHandleKey< xAOD::JetContainer > m_JetContainerKey {this,"JetKey","SplitJet","Key for input jets to TrigGSCFexMT"}; - SG::ReadHandleKey< xAOD::VertexContainer > m_VertexContainerKey {this,"PriVtxKey","xPrimVx","Key of primary vertexes to TrigGSCFexMT"}; - SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackParticleContainerKey {this,"TrackKey","InDetTrigTrackingxAODCnv_Bjet_IDTrig","Key for track particle container to TrigGSCFexMT"}; - - SG::WriteHandleKey< xAOD::JetContainer > m_jetOutputKey {this,"JetOutputKey","GSCJet","Key for output jets of TrigGSCFexMT"}; -}; - -#endif diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSelectorMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSelectorMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4fdfa4b897f5b4c9677ddb60f3f4a3deed2b3c39 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSelectorMT.cxx @@ -0,0 +1,163 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// ************************************************ +// +// NAME: TrigJetSplitterMT.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo +// +// ************************************************ + +#include "TrigJetSelectorMT.h" +#include "CxxUtils/phihelper.h" + +// ----------------------------------------------------------------------------------------------------------------- + +TrigJetSelectorMT::TrigJetSelectorMT(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator) {} + +// ----------------------------------------------------------------------------------------------------------------- + +StatusCode TrigJetSelectorMT::initialize() { + + ATH_MSG_DEBUG( "Initializing " << name() << "... " ); + + ATH_MSG_DEBUG( "declareProperty review:" ); + ATH_MSG_DEBUG( " ** " << m_minJetEt ); + ATH_MSG_DEBUG( " ** " << m_maxJetEta ); + ATH_MSG_DEBUG( " ** " << m_etaHalfWidth ); + ATH_MSG_DEBUG( " ** " << m_phiHalfWidth ); + ATH_MSG_DEBUG( " ** " << m_zHalfWidth ); + + ATH_MSG_DEBUG( "Initializing HandleKeys" ); + CHECK( m_inputJetsKey.initialize() ); + CHECK( m_inputVertexKey.initialize() ); + CHECK( m_outputJetKey.initialize() ); + CHECK( m_outputRoiKey.initialize() ); + + return StatusCode::SUCCESS; +} + + +// ----------------------------------------------------------------------------------------------------------------- + + +StatusCode TrigJetSelectorMT::execute() { + + ATH_MSG_DEBUG( "Executing " << name() ); + const EventContext& context = getContext(); + + // ============================================================================================================================== + // ** Retrieve Ingredients + // ============================================================================================================================== + + // Jets + SG::ReadHandle< xAOD::JetContainer > inputJetContainerHandle = SG::makeHandle( m_inputJetsKey,context ); + ATH_MSG_DEBUG( "Retrieved jets from : " << m_inputJetsKey.key() ); + CHECK( inputJetContainerHandle.isValid() ); + + const xAOD::JetContainer *inputJetCollection = inputJetContainerHandle.get(); + ATH_MSG_DEBUG( "Found " << inputJetCollection->size() << " jets." ); + for ( const xAOD::Jet *jet : * inputJetCollection ) + ATH_MSG_DEBUG(" -- Jet pt=" << jet->p4().Et() <<" eta="<< jet->eta() << " phi="<< jet->phi() ); + + // Primary Vertex + SG::ReadHandle< xAOD::VertexContainer > inputVertexContainer = SG::makeHandle( m_inputVertexKey,context ); + ATH_MSG_DEBUG( "Retrieving primary vertex from : " << m_inputVertexKey.key() ); + CHECK( inputVertexContainer.isValid() ); + + const xAOD::VertexContainer *vertexContainer = inputVertexContainer.get(); + ATH_MSG_DEBUG( "Found Vertex container with " << vertexContainer->size() << " elements" ); + for ( const xAOD::Vertex *vertex : *vertexContainer ) + ATH_MSG_DEBUG( " ** Vertex = (" << vertex->x() << + "," << vertex->y() << + "," << vertex->z() << ")" ); + + const xAOD::Vertex *primaryVertex = getPrimaryVertex( vertexContainer ); + if ( primaryVertex == nullptr ) return StatusCode::FAILURE; + + ATH_MSG_DEBUG( " ** PV = (" << primaryVertex->x() << + "," << primaryVertex->y() << + "," << primaryVertex->z() << ")" ); + + // ============================================================================================================================== + // ** Prepare the output collections + // ============================================================================================================================== + + std::unique_ptr< xAOD::JetContainer > outputJetContainer = std::make_unique< xAOD::JetContainer >(); + std::unique_ptr< xAOD::JetAuxContainer > outputJetAuxContainer = std::make_unique< xAOD::JetAuxContainer >(); + outputJetContainer->setStore( outputJetAuxContainer.get() ); + + std::unique_ptr< TrigRoiDescriptorCollection > outputRoiContainer = std::make_unique< TrigRoiDescriptorCollection >(); + + // ============================================================================================================================== + // ** Do the computation + // ============================================================================================================================== + + for ( const xAOD::Jet *jet : *inputJetCollection ) { + double jetPt = jet->p4().Et() * 1e-3; + double jetEta = jet->eta(); + double jetPhi = jet->phi(); + + ATH_MSG_DEBUG( "** Jet :: Et " << jetPt <<"; Eta " << jetEta << "; Phi " << jetPhi ); + + if ( jetPt < m_minJetEt ) { + ATH_MSG_DEBUG( "** Jet below the " << m_minJetEt.value() << " GeV threshold; Et " << jetPt <<"; Skipping this Jet." ); + continue; + } + + if ( fabs( jetEta ) > m_maxJetEta ) { + ATH_MSG_DEBUG( "** Jet outside the |eta| < " << m_maxJetEta.value() << " requirement; Eta = " << jetEta << "; Skipping this Jet." ); + continue; + } + + // Copy Jet + xAOD::Jet *toBeAdded = new xAOD::Jet(); + outputJetContainer->push_back( toBeAdded ); + *toBeAdded = *jet; + + // Create RoI + ATH_MSG_DEBUG( " ** Imposing Z constraint while building RoI" ); + double phiMinus = CxxUtils::wrapToPi( jetPhi - m_phiHalfWidth ); + double phiPlus = CxxUtils::wrapToPi( jetPhi + m_phiHalfWidth ); + + double etaMinus = jetEta - m_etaHalfWidth; + double etaPlus = jetEta + m_etaHalfWidth; + + double zMinus = primaryVertex->z() - m_zHalfWidth; + double zPlus = primaryVertex->z() + m_zHalfWidth; + + TrigRoiDescriptor *newRoI = new TrigRoiDescriptor( jet->eta(),etaMinus, etaPlus, + jet->phi(), phiMinus, phiPlus, + primaryVertex->z(),zMinus,zPlus ); + outputRoiContainer->push_back( newRoI ); + } + + + // ============================================================================================================================== + // ** Store object collections + // ============================================================================================================================== + + SG::WriteHandle< xAOD::JetContainer > outputJetContainerHandle = SG::makeHandle( m_outputJetKey, context ); + CHECK( outputJetContainerHandle.record( std::move( outputJetContainer ), std::move( outputJetAuxContainer ) ) ); + ATH_MSG_DEBUG( "Exiting with " << outputJetContainerHandle->size() << " shortlisted jets" ); + + SG::WriteHandle< TrigRoiDescriptorCollection > outputRoIContainerHandle = SG::makeHandle( m_outputRoiKey,context ); + CHECK( outputRoIContainerHandle.record( std::move( outputRoiContainer ) ) ); + ATH_MSG_DEBUG( "Exiting with " << outputRoIContainerHandle->size() << " RoIs" ); + + return StatusCode::SUCCESS; +} + +const xAOD::Vertex* TrigJetSelectorMT::getPrimaryVertex( const xAOD::VertexContainer* vertexContainer ) const { + // In case we need more complex selection + if ( vertexContainer->size() == 0 ) return nullptr; + + for ( const xAOD::Vertex *vertex : *vertexContainer ) { + if ( vertex->vertexType() != xAOD::VxType::VertexType::PriVtx ) continue; + return vertex; + } + + return nullptr; +} diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSelectorMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSelectorMT.h new file mode 100644 index 0000000000000000000000000000000000000000..695686661f27ffe08096e42379e5a845cc55776c --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSelectorMT.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// ************************************************ +// +// NAME: TrigJetSplitterMT.h +// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo +// +// AUTHOR: Carlo Varni +// EMAIL: carlo.varni@ge.infn.it +// +// ************************************************ + +#ifndef TRIGJETSELECTOR_MT_H +#define TRIGJETSELECTOR_MT_H + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" + +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" + +#include "xAODTracking/VertexContainer.h" +#include "xAODTracking/VertexAuxContainer.h" + +#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" + +class TrigJetSelectorMT : public AthAlgorithm { + public: + TrigJetSelectorMT(const std::string&, ISvcLocator*); + + StatusCode initialize(); + StatusCode execute(); + + private: + const xAOD::Vertex* getPrimaryVertex( const xAOD::VertexContainer* ) const; + + private: + Gaudi::Property< double > m_minJetEt {this,"JetMinEt",15,"Minimum of Output Jet Et in GeV"}; + Gaudi::Property< double > m_maxJetEta {this,"JetMaxEta",3.2,"Maximum eta acceptance of output Jet"}; + + Gaudi::Property< double > m_etaHalfWidth {this,"EtaHalfWidth",0.4,"Eta Half Width"}; + Gaudi::Property< double > m_phiHalfWidth {this,"PhiHalfWidth",0.4,"Phi Half Width"}; + Gaudi::Property< double > m_zHalfWidth {this,"ZHalfWidth",10.0,"Z Half Width in mm"}; + + //=========== Handles + SG::ReadHandleKey< xAOD::JetContainer > m_inputJetsKey {this,"InputJets","Undefined","Input Jet Container Key"}; + SG::ReadHandleKey< xAOD::VertexContainer > m_inputVertexKey {this,"InputVertex","Undefined","Input Vertex Key"}; + + SG::WriteHandleKey< xAOD::JetContainer > m_outputJetKey {this,"OutputJets","Undefined","Output Jet Container Key"}; + SG::WriteHandleKey< TrigRoiDescriptorCollection > m_outputRoiKey {this,"OutputRoi","Undefined","Output RoI Container Key"}; +}; + +#endif diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSplitterMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSplitterMT.cxx deleted file mode 100644 index bc3c71b3158097326009158a5d36e6aea4489c74..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSplitterMT.cxx +++ /dev/null @@ -1,178 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// ************************************************ -// -// NAME: TrigJetSplitterMT.cxx -// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo -// -// ************************************************ - -#include "TrigJetSplitterMT.h" -#include "CxxUtils/phihelper.h" - -// ----------------------------------------------------------------------------------------------------------------- - -TrigJetSplitterMT::TrigJetSplitterMT(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) {} - -// ----------------------------------------------------------------------------------------------------------------- - -StatusCode TrigJetSplitterMT::initialize() { - ATH_MSG_DEBUG( "declareProperty review:" ); - ATH_MSG_DEBUG( " " << m_inputJetsKey ); - ATH_MSG_DEBUG( " " << m_outputJetsKey ); - ATH_MSG_DEBUG( " " << m_imposeZconstraint); - ATH_MSG_DEBUG( " " << m_etaHalfWidth ); - ATH_MSG_DEBUG( " " << m_phiHalfWidth ); - ATH_MSG_DEBUG( " " << m_zHalfWidth ); - ATH_MSG_DEBUG( " " << m_minJetEt ); - ATH_MSG_DEBUG( " " << m_maxJetEta ); - - ATH_MSG_DEBUG( "Initializing HandleKeys" ); - CHECK( m_inputJetsKey.initialize() ); - CHECK( m_inputVertexKey.initialize() ); - - CHECK( m_outputJetsKey.initialize() ); - CHECK( m_outputRoiKey.initialize() ); - - CHECK( m_inputRoIKey.initialize() ); // TMP - return StatusCode::SUCCESS; -} - - -// ----------------------------------------------------------------------------------------------------------------- - - -StatusCode TrigJetSplitterMT::execute() { - ATH_MSG_DEBUG( "Executing " << name() ); - - // ============================================================================================================================== - // ** Retrieve Ingredients - // ============================================================================================================================== - - const EventContext& context = getContext(); - - SG::ReadHandle< xAOD::JetContainer > inputJetContainerHandle = SG::makeHandle( m_inputJetsKey,context ); - ATH_MSG_DEBUG( "Retrieved jets from : " << m_inputJetsKey.key() ); - CHECK( inputJetContainerHandle.isValid() ); - - const xAOD::JetContainer *inputJetCollection = inputJetContainerHandle.get(); - ATH_MSG_DEBUG( "Found " << inputJetCollection->size() << " jets." ); - for ( const xAOD::Jet *jet : * inputJetCollection ) - ATH_MSG_DEBUG(" -- Jet pt=" << jet->p4().Et() <<" eta="<< jet->eta() << " phi="<< jet->phi() ); - - // Retrieve Primary Vertex - SG::ReadHandle< xAOD::VertexContainer > inputVertexContainer = SG::makeHandle( m_inputVertexKey,context ); - ATH_MSG_DEBUG( "Retrieving primary vertex from : " << m_inputVertexKey.key() ); - CHECK( inputVertexContainer.isValid() ); - - const xAOD::VertexContainer *vertexContainer = inputVertexContainer.get(); - ATH_MSG_DEBUG( "Found PV container with " << vertexContainer->size() << " elements" ); - for ( const xAOD::Vertex *vertex : *vertexContainer ) - ATH_MSG_DEBUG( " ** PV = (" << vertex->x() << - "," << vertex->y() << - "," << vertex->z() << ")" ); - - if ( vertexContainer->size() == 0 ) return StatusCode::FAILURE; - const xAOD::Vertex *primaryVertex = vertexContainer->at(0); - - if ( m_imposeZconstraint ) - ATH_MSG_DEBUG( " ** PV = (" << primaryVertex->x() << - "," << primaryVertex->y() << - "," << primaryVertex->z() << ")" ); - - // ============================================================================================================================== - // ** Prepare the outputs - // ============================================================================================================================== - - std::unique_ptr< TrigRoiDescriptorCollection > outputRoiContainer( new TrigRoiDescriptorCollection() ); - - std::unique_ptr< xAOD::JetContainer > outputJetContainer( new xAOD::JetContainer() ); - std::unique_ptr< xAOD::JetAuxContainer > outputJetAuxContainer( new xAOD::JetAuxContainer() ); - outputJetContainer->setStore( outputJetAuxContainer.get() ); - - // ============================================================================================================================== - // ** Creating ShortList of Jet Container - // ============================================================================================================================== - - CHECK( shortListJets( inputJetCollection,outputJetContainer,outputRoiContainer,primaryVertex ) ); - - // ============================================================================================================================== - // ** Store the outputs - // ============================================================================================================================== - - SG::WriteHandle< xAOD::JetContainer > outputJetContainerHandle = SG::makeHandle( m_outputJetsKey, context ); - CHECK( outputJetContainerHandle.record( std::move( outputJetContainer ), std::move( outputJetAuxContainer ) ) ); - ATH_MSG_DEBUG( "Exiting with " << outputJetContainerHandle->size() << " shortlisted jets" ); - - SG::WriteHandle< TrigRoiDescriptorCollection > outputRoIContainerHandle = SG::makeHandle( m_outputRoiKey,context ); - CHECK( outputRoIContainerHandle.record( std::move( outputRoiContainer ) ) ); - ATH_MSG_DEBUG( "Exiting with " << outputRoIContainerHandle->size() << " RoIs" ); - - return StatusCode::SUCCESS; -} - - - -StatusCode TrigJetSplitterMT::shortListJets( const xAOD::JetContainer* jetCollection, - std::unique_ptr< xAOD::JetContainer >& outputJets, - std::unique_ptr< TrigRoiDescriptorCollection >& roiContainer, - const xAOD::Vertex* primaryVertex ) const { - - // Make a copy of the jet containers - for ( const xAOD::Jet *jet : *jetCollection ) { - // We select Jets above a specific eta and pt range - if ( jet->p4().Et() < m_minJetEt ) { - ATH_MSG_DEBUG( "** Jet below the " << m_minJetEt.value() << " GeV threshold; Et " << jet->p4().Et() <<"; Skipping this Jet." ); - continue; - } - if ( fabs( jet->eta() ) > m_maxJetEta ) { - ATH_MSG_DEBUG( "** Jet outside the |eta| < " << m_maxJetEta.value() << " requirement; Eta = " << jet->eta() << "; Skipping this Jet." ); - continue; - } - ATH_MSG_DEBUG( "** Jet :: Et " << jet->p4().Et() <<"; Eta " << jet->eta() << "; Phi " << jet->phi() ); - - // Protection in case there is not a Primary vertex but the Z contraint option is set to True - if ( m_imposeZconstraint && primaryVertex == nullptr ) { - // Not sure here what the best solution is. We can't change the m_imposeZconstraint value being const (and not thread safe) - ATH_MSG_ERROR( "Option for imposing Z constraint is set to True, but no primary vertex has been found." ); - return StatusCode::FAILURE; - } - - // Copy Jet - xAOD::Jet *toBeAdded = new xAOD::Jet(); - outputJets->push_back( toBeAdded ); - *toBeAdded = *jet; - - // Create RoI (we may require here PVz constraint) - double phiMinus = CxxUtils::wrapToPi(jet->phi() - m_phiHalfWidth); - double phiPlus = CxxUtils::wrapToPi(jet->phi() + m_phiHalfWidth); - - double etaMinus = jet->eta() - m_etaHalfWidth; - double etaPlus = jet->phi() + m_etaHalfWidth; - - // Impose Z matching (if enabled) - ATH_MSG_DEBUG( "Building RoI" ); - TrigRoiDescriptor *newRoI = nullptr; - if ( not m_imposeZconstraint ) { - newRoI = new TrigRoiDescriptor( jet->eta(),etaMinus, etaPlus, - jet->phi(), phiMinus, phiPlus ); - } else { - ATH_MSG_DEBUG( " ** Imposing Z constraint while building RoI" ); - double zMinus = primaryVertex->z() - m_zHalfWidth; - double zPlus = primaryVertex->z() + m_zHalfWidth; - - newRoI = new TrigRoiDescriptor( jet->eta(),etaMinus, etaPlus, - jet->phi(), phiMinus, phiPlus, - primaryVertex->z(),zMinus,zPlus ); - } - ATH_MSG_DEBUG( " -- RoI : eta=" << newRoI->eta() << " phi=" << newRoI->phi() ); - - // Put protection against nullpointer // TO-DO - roiContainer->push_back( newRoI ); - } - - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSplitterMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSplitterMT.h deleted file mode 100644 index 9a4e21043df2978215fb55e4521c7867bbd0a157..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigJetSplitterMT.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// ************************************************ -// -// NAME: TrigJetSplitterMT.h -// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo -// -// AUTHOR: Carlo Varni -// EMAIL: carlo.varni@ge.infn.it -// -// ************************************************ - -#ifndef TRIGJETSPLITTER_MT_H -#define TRIGJETSPLITTER_MT_H - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "StoreGate/ReadHandleKey.h" -#include "StoreGate/WriteHandleKey.h" - -#include "xAODJet/JetContainer.h" -#include "xAODJet/JetAuxContainer.h" - -#include "xAODTracking/VertexContainer.h" -#include "xAODTracking/VertexAuxContainer.h" - -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" - -class TrigJetSplitterMT : public AthAlgorithm { - public: - /** @brief Constructor */ - TrigJetSplitterMT(const std::string&, ISvcLocator*); - - StatusCode initialize(); - StatusCode execute(); - - private: - StatusCode shortListJets( const xAOD::JetContainer*, - std::unique_ptr< xAOD::JetContainer >&, - std::unique_ptr< TrigRoiDescriptorCollection >&, - const xAOD::Vertex* ) const; - - private: - Gaudi::Property< bool > m_imposeZconstraint {this,"ImposeZconstraint",false,"Impose Constraint on PV z, thus selecting Jets pointing to PV"}; - Gaudi::Property< float > m_etaHalfWidth {this,"EtaHalfWidth",0.4,"Eta Half Width"}; - Gaudi::Property< float > m_phiHalfWidth {this,"PhiHalfWidth",0.4,"Phi Half Width"}; - Gaudi::Property< float > m_zHalfWidth {this,"ZHalfWidth",10.0,"Z Half Width in mm"}; - Gaudi::Property< float > m_minJetEt {this,"JetMinEt",15000,"Minimum of Output Jet Et in GeV"}; - Gaudi::Property< float > m_maxJetEta {this,"JetMaxEta",3.2,"Maximum eta acceptance of output Jet"}; - //=========== Handles - SG::ReadHandleKey< xAOD::JetContainer > m_inputJetsKey {this,"Jets","Jets","Input Jet Container Key"}; - SG::ReadHandleKey< xAOD::VertexContainer > m_inputVertexKey {this,"InputVertex","Undefined","Output Vertex Key"}; - - SG::WriteHandleKey< xAOD::JetContainer > m_outputJetsKey {this,"OutputJets","SplitJets","Output Jet Container Key"}; - SG::WriteHandleKey< TrigRoiDescriptorCollection > m_outputRoiKey {this,"OutputRoi","SplitJet","Output RoI Container Key -- Same as OutputJets"}; - - // Tmp Part for creating custom jet collection. These Jets will be used for creating the output Jet collection - SG::ReadHandleKey< TrigRoiDescriptorCollection > m_inputRoIKey {this,"RoIs","FSJETRoI",""}; -}; - -#endif diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigRoIFromJetsMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigRoIFromJetsMT.cxx deleted file mode 100755 index 561592fd67d3f0a691980987106bf304e1bbc328..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigRoIFromJetsMT.cxx +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// @file TrigRoIFromJetsMT.cxx -// -// Creates a ROI from a jet collection -// - - -#include "TrigRoIFromJetsMT.h" -#include "CxxUtils/phihelper.h" - -//** ----------------------------------------------------------------------------------------------------------------- **// - -TrigRoIFromJetsMT::TrigRoIFromJetsMT(const std::string & name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) {} - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -StatusCode TrigRoIFromJetsMT::initialize() { - - ATH_MSG_DEBUG( "declareProperty review:" ); - ATH_MSG_DEBUG( " " << m_etaHalfWidth ); - ATH_MSG_DEBUG( " " << m_phiHalfWidth ); - ATH_MSG_DEBUG( " " << m_minJetEt ); - ATH_MSG_DEBUG( " " << m_maxJetEta ); - ATH_MSG_DEBUG( " " << m_nJetsMax ); - ATH_MSG_DEBUG( " " << m_dynamicMinJetEt ); - ATH_MSG_DEBUG( " " << m_dynamicNJetsMax ); - ATH_MSG_DEBUG( " " << m_dynamicEtFactor ); - - ATH_MSG_DEBUG( "Initialising HandleKeys" ); - CHECK( m_jetInputKey.initialize() ); - CHECK( m_roIOutputKey.initialize() ); - - return StatusCode::SUCCESS; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - -StatusCode TrigRoIFromJetsMT::execute() { - - ATH_MSG_DEBUG( "Running "<< name() <<" ... " ); - const EventContext& ctx = getContext(); - - // Sanity check that we're not running two optimisations at the same time - // can be removed once a default method is decided upon - if (m_nJetsMax > 0 && m_dynamicMinJetEt) { - ATH_MSG_WARNING( "Two incompatible CPU optimisation methods chosen (DynamicMinJetEt and NJetsMax). Switching off DynamicMinJetEt." ); - m_dynamicMinJetEt = false; - } - - // Prepare Outputs - std::unique_ptr< TrigRoiDescriptorCollection > roICollection( new TrigRoiDescriptorCollection() ); - - // Retrieve Input Jets - SG::ReadHandle< xAOD::JetContainer > jetContainerHandle = SG::makeHandle( m_jetInputKey,ctx ); - CHECK( jetContainerHandle.isValid() ); - const xAOD::JetContainer *jetContainer = jetContainerHandle.get(); - ATH_MSG_DEBUG( "Found " << jetContainer->size() << " jets, creating corresponding RoIs ... " ); - - // Run on Input Jets - int i = 0; - for ( const xAOD::Jet *jet : *jetContainer ) { - i++; - - float jetEt = jet->p4().Et(); - float jetEta = jet->eta(); - float jetPhi = jet->phi(); - - if (jetEt < m_minJetEt) { - ATH_MSG_DEBUG( "Jet " << i << " below the " << m_minJetEt << " GeV threshold; Et " << jetEt << "; skipping this jet." ); - continue; - } - - if (fabs(jetEta) > m_maxJetEta) { - ATH_MSG_DEBUG( "Jet " << i << " outside the |eta| < " << m_maxJetEta << " requirement; Eta = " << jetEta << "; skipping this jet." ); - continue; - } - - // For high pile-up situations, raise the pT threshold of the jets considered after checking the first N (=m_dynamicNJetsMax) jets - if (m_dynamicMinJetEt && i > m_dynamicNJetsMax ) { - float dynamicMinJetEt = m_minJetEt + ((i - m_dynamicNJetsMax) * m_dynamicEtFactor); - if (jetEt < dynamicMinJetEt) { - ATH_MSG_DEBUG( "Jet "<< i << " below the dynamic " << dynamicMinJetEt << " GeV ( = " - << m_minJetEt << " + (" << i << " - " << m_dynamicNJetsMax << ") * " << m_dynamicEtFactor << ")" - << " threshold; Et " << jetEt << "; skipping this jet." ); - continue; - } - } - - if (m_nJetsMax > 0 && i > m_nJetsMax) { - ATH_MSG_DEBUG( "Maximum allowed jet multiplicity = "<< m_nJetsMax << "; skipping jet " << i << "." ); - continue; - } - - ATH_MSG_DEBUG( "Jet "<< i << "; Et " << jetEt << "; eta "<< jetEta << "; phi " << jetPhi ); - - ATH_MSG_DEBUG( "Creating RoI corresponding to Jet" ); - // create RoI correspondinding to the jet - double phiMinus = CxxUtils::wrapToPi(jetPhi-m_phiHalfWidth); - double phiPlus = CxxUtils::wrapToPi(jetPhi+m_phiHalfWidth); - double etaMinus = jetEta-m_etaHalfWidth; - double etaPlus = jetEta+m_etaHalfWidth; - - TrigRoiDescriptor* roi = new TrigRoiDescriptor(jetEta, etaMinus, etaPlus, - jetPhi, phiMinus, phiPlus ); - - ATH_MSG_DEBUG( "Adding ROI descriptor ROI collection !" ); - ATH_MSG_DEBUG( " ** roi : eta=" << roi->eta() <<" phi=" << roi->phi() ); - roICollection->push_back( roi ); - } - - // Save Outputs - ATH_MSG_DEBUG( "Saving RoIs to be used as input to Fast Tracking -- TO BE CHANGED -- ::: " << m_roIOutputKey.key() ); - SG::WriteHandle< TrigRoiDescriptorCollection > outputRoiHandle = SG::makeHandle( m_roIOutputKey,ctx ); - CHECK( outputRoiHandle.record( std::move( roICollection ) ) ); - - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigRoIFromJetsMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigRoIFromJetsMT.h deleted file mode 100755 index 6ecc4a061f6edc6e990769a8199786508d40a86c..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigRoIFromJetsMT.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ -// -// @file TrigBjetRoiBuilderMT.h -// -#ifndef TRIGROI_FROMJETS_MT_H -#define TRIGROI_FROMJETS_MT_H - -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "xAODJet/JetContainer.h" -#include "xAODJet/JetAuxContainer.h" - -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" - -class TrigRoIFromJetsMT : public AthAlgorithm { - - public: - TrigRoIFromJetsMT(const std::string&, ISvcLocator*); - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - - private: - Gaudi::Property< float > m_etaHalfWidth {this,"EtaHalfWidth",0.1,"Eta Half Width"}; - Gaudi::Property< float > m_phiHalfWidth {this,"PhiHalfWidth",0.1,"Phi Half Width"}; - Gaudi::Property< float > m_minJetEt {this,"JetMinEt",30.0,"Jet Min Et"}; - Gaudi::Property< float > m_maxJetEta {this,"JetMaxEta",2.6,"Jet Max Eta : 2.5 + Eta Half Width"}; - Gaudi::Property< int > m_nJetsMax {this,"NJetsMax",-1,"Option to limit the number of jets that form the super RoI "}; - Gaudi::Property< bool > m_dynamicMinJetEt {this,"DynamicMinJetEt",false,"if (X > -1 && nJets > X) minJetEt = m_minJetEt + (nJets-X)*Y "}; - Gaudi::Property< int > m_dynamicNJetsMax {this,"DynamicNJetsMax",9999,"variable X above"}; - Gaudi::Property< float > m_dynamicEtFactor {this,"DynamicEtFactor",0,"variable Y above "}; - - SG::ReadHandleKey< xAOD::JetContainer > m_jetInputKey {this,"JetInputKey","TrigJetRec","Input Jet Collection Key, retrieved from reconstructed jets"}; - SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roIOutputKey {this,"RoIOutputKey","EMViewRoIs","Output RoI Collection Key"}; -}; - -#endif diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoIBuilderMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoIBuilderMT.cxx new file mode 100755 index 0000000000000000000000000000000000000000..f28a16b4e781d1e23b757a54d8fdb11cf01637d9 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoIBuilderMT.cxx @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// +#include "TrigSuperRoIBuilderMT.h" +#include "CxxUtils/phihelper.h" + +//** ----------------------------------------------------------------------------------------------------------------- **// + +TrigSuperRoIBuilderMT::TrigSuperRoIBuilderMT(const std::string & name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator) {} + +//** ----------------------------------------------------------------------------------------------------------------- **// + + +StatusCode TrigSuperRoIBuilderMT::initialize() { + + ATH_MSG_DEBUG( "declareProperty review:" ); + ATH_MSG_DEBUG( " " << m_etaHalfWidth ); + ATH_MSG_DEBUG( " " << m_phiHalfWidth ); + ATH_MSG_DEBUG( " " << m_minJetEt ); + ATH_MSG_DEBUG( " " << m_maxJetEta ); + + ATH_MSG_DEBUG( "Initialising HandleKeys" ); + CHECK( m_jetInputKey.initialize() ); + CHECK( m_roIOutputKey.initialize() ); + + return StatusCode::SUCCESS; +} + + +//** ----------------------------------------------------------------------------------------------------------------- **// + +StatusCode TrigSuperRoIBuilderMT::execute() { + + ATH_MSG_DEBUG( "Running "<< name() <<" ... " ); + const EventContext& ctx = getContext(); + + // ============================================================================================================================== + // ** Retrieve Inputs + // ============================================================================================================================== + + SG::ReadHandle< xAOD::JetContainer > jetContainerHandle = SG::makeHandle( m_jetInputKey,ctx ); + CHECK( jetContainerHandle.isValid() ); + const xAOD::JetContainer *jetContainer = jetContainerHandle.get(); + ATH_MSG_DEBUG( "Found " << jetContainer->size() << " jets, creating corresponding RoIs ... " ); + + // ============================================================================================================================== + // ** Prepare Outputs + // ============================================================================================================================== + + std::unique_ptr< TrigRoiDescriptorCollection > roICollection = std::make_unique< TrigRoiDescriptorCollection >(); + + // ============================================================================================================================== + // ** Perform the computation + // ============================================================================================================================== + + // Create Super-RoI + TrigRoiDescriptor* superRoi = new TrigRoiDescriptor(); + superRoi->setComposite( true ); + + // Run on Input Jets + for ( const xAOD::Jet *jet : *jetContainer ) { + float jetEt = jet->p4().Et(); + float jetEta = jet->eta(); + float jetPhi = jet->phi(); + + ATH_MSG_DEBUG( "Jet Et " << jetEt << "; eta "<< jetEta << "; phi " << jetPhi ); + + if (jetEt < m_minJetEt) { + ATH_MSG_DEBUG( "Jet below the " << m_minJetEt << " GeV threshold; Et " << jetEt << "; skipping this jet." ); + continue; + } + + if (fabs(jetEta) > m_maxJetEta) { + ATH_MSG_DEBUG( "Jet outside the |eta| < " << m_maxJetEta << " requirement; Eta = " << jetEta << "; skipping this jet." ); + continue; + } + + ATH_MSG_DEBUG( " ** Creating RoI corresponding to Jet" ); + double phiMinus = CxxUtils::wrapToPi(jetPhi-m_phiHalfWidth); + double phiPlus = CxxUtils::wrapToPi(jetPhi+m_phiHalfWidth); + double etaMinus = jetEta - m_etaHalfWidth; + double etaPlus = jetEta + m_etaHalfWidth; + + TrigRoiDescriptor* roi = new TrigRoiDescriptor( jetEta, etaMinus, etaPlus, + jetPhi, phiMinus, phiPlus ); + + ATH_MSG_DEBUG( " ** Adding ROI descriptor ROI collection !" ); + ATH_MSG_DEBUG( " " << (*roi) ); + + // roICollection->push_back( roi ); // TMP + superRoi->push_back( roi ); + } + + ATH_MSG_DEBUG( "Super RoI for fast tracking" ); + ATH_MSG_DEBUG( *superRoi ); + roICollection->push_back( superRoi ); // TMP + + // ============================================================================================================================== + // ** Store the outputs + // ============================================================================================================================== + + ATH_MSG_DEBUG( "Saving Super RoI to be used as input to Fast Tracking as '" << m_roIOutputKey.key() << "' with Size: " << roICollection->size() ); + SG::WriteHandle< TrigRoiDescriptorCollection > outputRoiHandle = SG::makeHandle( m_roIOutputKey,ctx ); + CHECK( outputRoiHandle.record( std::move( roICollection ) ) ); + + return StatusCode::SUCCESS; +} + + + diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoIBuilderMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoIBuilderMT.h new file mode 100755 index 0000000000000000000000000000000000000000..2b344d29966faba5c12b8750f0744c14f05503d7 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoIBuilderMT.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIG_SUPERROIBUILDER_H +#define TRIG_SUPERROIBUILDER_H + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" + +#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" + +class TrigSuperRoIBuilderMT : public AthAlgorithm { + + public: + TrigSuperRoIBuilderMT(const std::string&, ISvcLocator*); + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + + private: + Gaudi::Property< float > m_etaHalfWidth {this,"EtaHalfWidth",0.1,"Eta Half Width"}; + Gaudi::Property< float > m_phiHalfWidth {this,"PhiHalfWidth",0.1,"Phi Half Width"}; + Gaudi::Property< float > m_minJetEt {this,"JetMinEt",30.0,"Jet Min Et"}; + Gaudi::Property< float > m_maxJetEta {this,"JetMaxEta",2.6,"Jet Max Eta : 2.5 + Eta Half Width"}; + + SG::ReadHandleKey< xAOD::JetContainer > m_jetInputKey {this,"InputJets","Unspecified","Input Jet Collection Key, retrieved from reconstructed jets"}; + SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roIOutputKey {this,"OutputRoIs","Unspecified","Output RoI Collection Key"}; +}; + +#endif diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx index 35162cb9751cdb5f8ff67cf1986aba05b2aaecc3..49375f24ac946b90e9d4fdab970031130a81c0e1 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx @@ -13,16 +13,13 @@ #include "TrigBjetHypo/TrigFarawayJetFinderAllTE.h" #include "../TrigBjetEtHypoAlgMT.h" -#include "../TrigBjetEtHypoAlgEVMT.h" #include "../TrigBjetBtagHypoAlgMT.h" #include "../TrigBjetEtHypoTool.h" #include "../TrigBjetBtagHypoTool.h" -#include "../TrigGSCFexMT.h" #include "../TrigBtagFexMT.h" -#include "../TrigRoIFromJetsMT.h" -#include "../TrigJetSplitterMT.h" - +#include "../TrigSuperRoIBuilderMT.h" +#include "../TrigJetSelectorMT.h" DECLARE_COMPONENT( TrigBjetHypoAllTE ) DECLARE_COMPONENT( TrigBjetHypo ) @@ -39,14 +36,11 @@ DECLARE_COMPONENT( TrigFarawayJetFinderAllTE ) DECLARE_COMPONENT( TrigBjetEtHypoAlgMT ) -DECLARE_COMPONENT( TrigBjetEtHypoAlgEVMT ) DECLARE_COMPONENT( TrigBjetBtagHypoAlgMT ) DECLARE_COMPONENT( TrigBjetEtHypoTool ) DECLARE_COMPONENT( TrigBjetBtagHypoTool ) -DECLARE_COMPONENT( TrigGSCFexMT ) DECLARE_COMPONENT( TrigBtagFexMT ) -DECLARE_COMPONENT( TrigRoIFromJetsMT ) -DECLARE_COMPONENT( TrigJetSplitterMT ) - +DECLARE_COMPONENT( TrigSuperRoIBuilderMT ) +DECLARE_COMPONENT( TrigJetSelectorMT ) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref index acce5fb7572624325dd66d61badfb92f1a6ba511..36622c0d411930aaa9d63f514f8c6718b6f9ce6c 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref @@ -92,10 +92,10 @@ TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 decisions 16 0 0 0 0 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 20 20 18 0 0 0 0 18 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 decisions 18 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J2019 19 18 18 18 18 0 18 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 18 49 49 49 0 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J2019 19 18 18 18 18 0 18 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 18 49 49 49 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J2019 19 18 18 18 0 0 18 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 18 49 49 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J2019 19 18 18 18 0 0 18 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 18 49 49 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J1003 3 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J100 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 19 19 0 0 0 0 0 0 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref index 58df312d945e1d609ce998093a3767c9ad2bb0b9..b691f5827487e18c76871b7a4d5e9ecd6e220f69 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref @@ -96,10 +96,10 @@ TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 decisions 4 0 0 0 0 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 20 20 5 0 0 0 0 5 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 decisions 5 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J2020 20 5 5 5 5 0 5 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 5 5 5 5 0 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J2020 20 5 5 5 5 0 5 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 5 5 5 5 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J2020 20 5 5 5 0 0 5 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 5 5 5 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J2020 20 5 5 5 0 0 5 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 5 5 5 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J10020 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J100 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 20 20 0 0 0 0 0 0 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py index 1267fc4fe5e88c23ee3229e9ea4d8e9d3aff3c91..c64b8da03f1dac5ddabfc25611f9ff025fd28290 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py @@ -178,14 +178,14 @@ if opt.doBjetSlice == True: jetSequence = jetMenuSequenceFromString("a4_tc_em_subjesgscIS_ftf") - step0 = ChainStep("Step0_bjet", [jetSequence] ) - step1 = ChainStep("Step1_bjet", [getBJetSequence('j')]) - step2 = ChainStep("Step2_bjet", [getBJetSequence('gsc')]) - - bjetChains = [ - makeChain(name='HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20' , L1Thresholds=["J20"], ChainSteps=[step0,step1,step2] ), - makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20', L1Thresholds=["J20"], ChainSteps=[step0,step1,step2] ), - makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_L1J20' , L1Thresholds=["J20"], ChainSteps=[step0,step1,step2] ) + step1 = ChainStep("Step1_bjet", [jetSequence] ) + step2 = ChainStep("Step2_bjet", [getBJetSequence('j')]) + step3 = ChainStep("Step3_bjet", [getBJetSequence('btag')]) + + bjetChains = [ + makeChain(name='HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2,step3] ), + makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20', L1Thresholds=["J20"], ChainSteps=[step1,step2,step3] ), + makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2,step3] ) ] testChains += bjetChains diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/slice_bjet.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/slice_bjet.ref index d58d3edb63e22104aa88ce4c4d6e1eb7aa958012..53ff4bd16dddfd5bf8e3552a36e4e96625f320af 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/slice_bjet.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/slice_bjet.ref @@ -1,12 +1,12 @@ -TrigSignatureMoniMT INFO HLT_j225_ftf_subjesgscIS_bmv2c1040_split_L1J100100 100 0 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j225_ftf_subjesgscIS_bmv2c1040_split_L1J100 decisions 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j275_ftf_subjesgscIS_bmv2c1060_split_L1J100100 100 0 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j275_ftf_subjesgscIS_bmv2c1060_split_L1J100 decisions 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j300_ftf_subjesgscIS_bmv2c1070_split_L1J100100 100 0 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j300_ftf_subjesgscIS_bmv2c1070_split_L1J100 decisions 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j360_ftf_subjesgscIS_bmv2c1077_split_L1J100100 100 0 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j360_ftf_subjesgscIS_bmv2c1077_split_L1J100 decisions 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20100 100 30 30 30 30 30 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 30 59 59 59 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20100 100 30 30 30 30 30 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 30 59 59 59 +TrigSignatureMoniMT INFO HLT_j225_ftf_subjesgscIS_bmv2c1040_split_L1J100100 100 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j225_ftf_subjesgscIS_bmv2c1040_split_L1J100 decisions 0 0 0 +TrigSignatureMoniMT INFO HLT_j275_ftf_subjesgscIS_bmv2c1060_split_L1J100100 100 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j275_ftf_subjesgscIS_bmv2c1060_split_L1J100 decisions 0 0 0 +TrigSignatureMoniMT INFO HLT_j300_ftf_subjesgscIS_bmv2c1070_split_L1J100100 100 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j300_ftf_subjesgscIS_bmv2c1070_split_L1J100 decisions 0 0 0 +TrigSignatureMoniMT INFO HLT_j360_ftf_subjesgscIS_bmv2c1077_split_L1J100100 100 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j360_ftf_subjesgscIS_bmv2c1077_split_L1J100 decisions 0 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20100 100 31 31 31 31 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 31 51 51 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20100 100 31 31 31 31 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 31 51 51 diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index adc1b41539b8fd4702cb93f4632d2956bd8f68d4..6b4b8a0babcf1008cc326bd927de1238d7657276 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -278,16 +278,12 @@ TriggerHLTListRun3 = [ ('xAOD::TauTrackContainer#HLT_tautrack_MVA', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau'), ('xAOD::TauTrackAuxContainer#HLT_tautrack_MVAAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau'), - #bjet - ('xAOD::TrackParticleContainer#HLT_xAODTracks_FS', 'BS ESD AODFULL', 'Bjet'), - ('xAOD::TrackParticleAuxContainer#HLT_xAODTracks_FSAux.', 'BS ESD AODFULL', 'Bjet'), + #bjet Second Stage Fast tracks + ('xAOD::TrackParticleContainer#HLT_xAODTracks_bjet', 'BS ESD AODFULL', 'Bjet', 'inViews:BTagViews'), + ('xAOD::TrackParticleAuxContainer#HLT_xAODTracks_bjetAux.', 'BS ESD AODFULL', 'Bjet'), #bjet jets - - ('xAOD::JetContainer#HLT_SplitJet', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), - ('xAOD::JetAuxContainer#HLT_SplitJetAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), - - ('xAOD::JetContainer#HLT_GSCJet', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BJetViews'), + ('xAOD::JetContainer#HLT_GSCJet', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:FullScanBjetView'), ('xAOD::JetAuxContainer#HLT_GSCJetAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), # vertex for b-jets diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py index bf3233b31f725bfd7ad0f0095ff6b771f981ea05..6ab58aeb44bab7e347c9967666bb7f4fe24ca8dc 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py @@ -17,9 +17,6 @@ from TriggerMenuMT.HLTMenuConfig.Bjet.BjetSequenceSetup import getBJetSequence def bjetSequenceCfg_j( flags ): return getBJetSequence('j') -def bjetSequenceCfg_gsc( flags ): - return getBJetSequence('gsc') - def bjetSequenceCfg_btag( flag ): return getBJetSequence('btag') @@ -40,38 +37,41 @@ class BjetChainConfiguration(ChainConfigurationBase): # -------------------- # define here the names of the steps and obtain the chainStep configuration # -------------------- - stepDictionary = { - "": [self.getBjetSequence_j(), self.getBjetSequence_gsc(), self.getBjetSequence_btag()] - } + stepDictionary = self.getStepDictionary() ## This needs to be configured by the Bjet Developer!! key = self.chainPart['extra'] - steps=stepDictionary[key] + steps = stepDictionary[key] chainSteps = [] for step in steps: - chainSteps+=[step] + chainstep = getattr(self, step)() + chainSteps += [chainstep] myChain = self.buildChain(chainSteps) return myChain + + + def getStepDictionary(self): + # -------------------- + # define here the names of the steps and obtain the chainStep configuration + # -------------------- + stepDictionary = { + "": ["getBjetSequence_j","getBjetSequence_btag"] + } + return stepDictionary # -------------------- # Configuration of steps # -------------------- def getBjetSequence_j(self): - stepName = "Step1_bjet" + stepName = "Step2_bjet" log.debug("Configuring step " + stepName) bjetSeq = RecoFragmentsPool.retrieve( bjetSequenceCfg_j, None ) # the None will be used for flags in future return ChainStep(stepName, [bjetSeq]) - def getBjetSequence_gsc(self): - stepName = "Step2_bjet" - log.debug("Configuring step " + stepName) - bjetSeq = RecoFragmentsPool.retrieve( bjetSequenceCfg_gsc, None ) # the None will be used for flags in future - return ChainStep(stepName, [bjetSeq]) - def getBjetSequence_btag(self): stepName = "Step3_bjet" log.debug("Configuring step " + stepName) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py new file mode 100644 index 0000000000000000000000000000000000000000..4f676c969624c3229934a3cc04bf9e239900fdcb --- /dev/null +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py @@ -0,0 +1,17 @@ + +#from AthenaCommon.Constants import DEBUG + +def getFlavourTagging( inputJets, inputVertex, inputTracks ): + algSequence = [] + + from TrigBjetHypo.TrigBjetHypoConf import TrigBtagFexMT + bTagFex = TrigBtagFexMT( "TrigBtagFexMT" ) + bTagFex.JetKey = inputJets + bTagFex.PriVtxKey = inputVertex + bTagFex.TracksKey = inputTracks + algSequence.append( bTagFex ) + + return algSequence + + + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py index f5de5385aa10db85cfe0ff2b02c238aaf8850213..0d2d170260a5666b96bc561406ac27266d57792e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py @@ -2,9 +2,8 @@ # # menu components -from AthenaCommon.CFElements import parOR, seqAND +from AthenaCommon.CFElements import seqAND from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence -from TrigInDetConfig.InDetSetup import makeInDetAlgs from TrigEDMConfig.TriggerEDMRun3 import recordable #from AthenaCommon.Constants import DEBUG @@ -16,250 +15,108 @@ from TrigEDMConfig.TriggerEDMRun3 import recordable def getBJetSequence( step ): if step == "j": return bJetStep1Sequence() - if step == "jALLTE": - return bJetStep1SequenceALLTE() - if step == "gsc": - return bJetStep2Sequence() - if step == "gscALLTE": - return bJetStep2SequenceALLTE() if step == "btag": - return bJetStep3Sequence() + return bJetStep2Sequence() return None # ==================================================================================================== -# step 1: jet reco and cut on 'j' threshold +# step 1: This is Jet code. Not here! +# ==================================================================================================== + +# ==================================================================================================== +# step 2: retrieving jets from jet-trigger code and optional first stage of fast tracking with primary vertex # ==================================================================================================== def bJetStep1Sequence(): jetsKey = "HLT_AntiKt4EMTopoJets_subjesgscIS_ftf" prmVtxKey = "HLT_EFHistoPrmVtx" - - from DecisionHandling.DecisionHandlingConf import InputMakerForRoI - InputMakerAlg = InputMakerForRoI("IMstep1bjet", RoIsLink="initialRoI") - InputMakerAlg.RoIs = "BjetInputRoI" - - # Shortlist of jets - from TrigBjetHypo.TrigBjetHypoConf import TrigJetSplitterMT - jetSplitter = TrigJetSplitterMT("TrigJetSplitterMT") - jetSplitter.ImposeZconstraint = True - jetSplitter.Jets = jetsKey - jetSplitter.OutputJets = recordable("HLT_SplitJet") - jetSplitter.OutputRoi = "SplitJets" - jetSplitter.InputVertex = prmVtxKey - - bJetEtSequence = seqAND("bJetEtSequence",[ jetSplitter] ) - - # hypo - from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict - hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlgMT_step1") - hypo.RoILink = "step1RoI" # To be used in following step EventView - hypo.PrmVtxLink = "xPrimVx" - hypo.Jets = jetSplitter.OutputJets - hypo.RoIs = jetSplitter.OutputRoi - hypo.PrmVtx = prmVtxKey - # Sequence - BjetAthSequence = seqAND("BjetAthSequence_step1",[InputMakerAlg,bJetEtSequence]) + from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm + InputMakerAlg = EventViewCreatorAlgorithm( "IMBJet_step2", RoIsLink="initialRoI" ) + InputMakerAlg.Views = "FullScanBjetView" + InputMakerAlg.InViewRoIs = "FullScanRoI" + InputMakerAlg.ViewFallThrough = True - return MenuSequence( Sequence = BjetAthSequence, - Maker = InputMakerAlg, - Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromDict ) -def bJetStep1SequenceALLTE(): + outputJetName = "HLT_GSCJet" + outputRoIName = "HLT_GSCJet_RoIs" - # Construct jets - from TrigUpgradeTest.jetMenuHelper import jetCFSequenceFromString - (recoSequence, InputMakerAlg, sequenceOut) = jetCFSequenceFromString("a4_tc_em_subjes") + # Jet Selector + from TrigBjetHypo.TrigBjetHypoConf import TrigJetSelectorMT + jetSelector = TrigJetSelectorMT( "BJetSelector" ) + jetSelector.InputJets = jetsKey + jetSelector.InputVertex = prmVtxKey + jetSelector.OutputJets = recordable( outputJetName ) + jetSelector.OutputRoi = outputRoIName - # Start with b-jet-specific algo sequence - # Construct RoI. Needed input for Fast Tracking - from TrigBjetHypo.TrigBjetHypoConf import TrigRoIFromJetsMT - RoIBuilder = TrigRoIFromJetsMT("TrigRoIFromJetsMT") - RoIBuilder.JetInputKey = sequenceOut - RoIs="EMViewRoIs" # Default for Fast Tracking Algs - RoIBuilder.RoIOutputKey = RoIs + bJetEtSequence = seqAND( "bJetEtSequence",[jetSelector] ) + InputMakerAlg.ViewNodeName = "bJetEtSequence" - - # Fast Tracking - viewAlgs = makeInDetAlgs(whichSignature='FS',separateTrackParticleCreator="_FS",rois=RoIs) - - - # Primary Vertex - from TrigT2HistoPrmVtx.TrigT2HistoPrmVtxAllTEMTConfig import EFHistoPrmVtxAllTEMT_Jet - prmVtx = EFHistoPrmVtxAllTEMT_Jet( "EFHistoPrmVtxAllTEMT_Jet" ) - prmVtx.InputRoIsKey = RoIs - prmVtx.InputTracksKey = "HLT_xAODTracks_FS" - prmVtx.OutputVertexKey = "EFHistoPrmVtx" - - # Shortlis of jets - from TrigBjetHypo.TrigBjetHypoConf import TrigJetSplitterMT - jetSplitter = TrigJetSplitterMT("TrigJetSplitterMT") - jetSplitter.ImposeZconstraint = True - jetSplitter.Jets = sequenceOut - jetSplitter.InputVertex = prmVtx.OutputVertexKey - jetSplitter.OutputJets = "SplitJets" - jetSplitter.OutputRoi = "SplitJets" - - fastTrackingSequence = parOR("fastTrackingSequence",viewAlgs) - bJetEtSequence = seqAND("bJetEtSequence",[ RoIBuilder,fastTrackingSequence,prmVtx,jetSplitter] ) + # Sequence + BjetAthSequence = seqAND("BjetAthSequence_step1",[InputMakerAlg,bJetEtSequence]) # hypo from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict - hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlgMT_step1_ALLTE") - hypo.RoILink = "step1RoI" # To be used in following step EventView - hypo.PrmVtxLink = "xPrimVx" - hypo.Jets = jetSplitter.OutputJets - hypo.RoIs = jetSplitter.OutputRoi - hypo.PrmVtx = prmVtx.OutputVertexKey - - # Sequence - BjetAthSequence = seqAND("BjetAthSequence_step1_ALLTE", [InputMakerAlg,recoSequence,bJetEtSequence]) + hypo = TrigBjetEtHypoAlgMT( "TrigBjetEtHypoAlgMT" ) + hypo.RoILink = "step1RoI" + hypo.PrmVtxLink = prmVtxKey.replace( "HLT_","" ) + hypo.Jets = outputJetName + hypo.RoIs = outputRoIName + hypo.PrmVtx = prmVtxKey + hypo.RetrieveVertexFromEventView = False + from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, HypoToolGen = TrigBjetEtHypoToolFromDict ) - - # ==================================================================================================== -# step 2: precision tracking, gsc calibration and cut on gsc-corrected threshold +# step 3: Second stage of fast tracking, Precision tracking, and flavour tagging # ==================================================================================================== def bJetStep2Sequence(): + roisLink = "step1RoI" + prmVtxKey = "HLT_EFHistoPrmVtx" - # Event View Creator Algorithm from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithmWithJets - InputMakerAlg = EventViewCreatorAlgorithmWithJets("IMBJet_step2", RoIsLink="initialRoI") - InputMakerAlg.ViewFallThrough = True # Access Store Gate for retrieving data - #InputMakerAlg.ViewPerRoI = True # If True it creates one view per RoI. NOTE: REMOVING AS NOT IMPLEMENTED - InputMakerAlg.Views = "BJetViews" # Name of output view - # RoIs - InputMakerAlg.InViewRoIs = "InViewRoIs" # Name RoIs are inserted in the view - InputMakerAlg.RoIsLink = "step1RoI" # RoIs linked to previous decision - # Jets - InputMakerAlg.InViewJets = "InViewJets" # Name Jets are inserted in the view - - # Precision Tracking - #def makeInDetPrecisionTracking( whichSignature, verifier = False, inputFTFtracks='TrigFastTrackFinder_Tracks', outputTrackPrefixName = "InDetTrigPT" ): - from TrigUpgradeTest.InDetPT import makeInDetPrecisionTracking - PTTracks, PTTrackParticles, PTAlgs = makeInDetPrecisionTracking( "bjets", inputFTFtracks="TrigFastTrackFinder_Tracks_FS" ) - - # gsc correction - from TrigBjetHypo.TrigGSCFexMTConfig import getGSCFexSplitInstance - theGSC = getGSCFexSplitInstance("GSCFexSplitInstance") - theGSC.RoIs = InputMakerAlg.InViewRoIs - theGSC.JetKey = InputMakerAlg.InViewJets - theGSC.TrackKey = PTTrackParticles[0] - theGSC.PriVtxKey = "HLT_EFHistoPrmVtx" - theGSC.JetOutputKey = recordable("HLT_GSCJet") - - step2Sequence = seqAND("step2Sequence",[theGSC]) - InputMakerAlg.ViewNodeName = "step2Sequence" - - # to debug the View contnets + InputMakerAlg = EventViewCreatorAlgorithmWithJets( "IMBJet_step3",RoIsLink=roisLink ) + InputMakerAlg.ViewFallThrough = True + InputMakerAlg.RequireParentView = True + InputMakerAlg.Views = "BTagViews" + InputMakerAlg.InViewRoIs = "InViewRoIs" + InputMakerAlg.InViewJets = "InViewJets" + + # View Test Algorithm import AthenaCommon.CfgMgr as CfgMgr - step2Sequence += CfgMgr.AthViews__ViewTestAlg("view_testBjet2") - - # hypo - from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgEVMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict - hypo = TrigBjetEtHypoAlgEVMT("TrigBjetEtHypoAlg_step2") - # no links this time, only for tracks - hypo.TracksLink = "tracks" - hypo.RoIs = "SplitJets" - hypo.Jets = theGSC.JetOutputKey - hypo.PrmVtx = theGSC.PriVtxKey - hypo.Tracks = PTTrackParticles[0] - - # Sequence - BjetAthSequence = seqAND("BjetAthSequence_step2",[InputMakerAlg] + PTAlgs + [step2Sequence]) - - return MenuSequence( Sequence = BjetAthSequence, - Maker = InputMakerAlg, - Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromDict ) - + viewTestAlg = CfgMgr.AthViews__ViewTestAlg( "view_testBjet2" ) -def bJetStep2SequenceALLTE(): - # input maker - from DecisionHandling.DecisionHandlingConf import InputMakerForRoI - InputMakerAlg = InputMakerForRoI("IMBJet_step2_ALLTE", RoIsLink="initialRoI") + # Second stage of Fast Tracking and Precision Tracking + from TriggerMenuMT.HLTMenuConfig.Bjet.BjetTrackingConfiguration import getSecondStageBjetTracking + secondStageAlgs, PTTracks, PTTrackParticles = getSecondStageBjetTracking( inputRoI=InputMakerAlg.InViewRoIs ) - from TrigUpgradeTest.InDetPT import makeInDetPrecisionTracking - #FIXME: There should be a last parameter as RoI, but this code will be removed anyway - PTTracks, PTTrackParticles, PTAlgs = makeInDetPrecisionTracking( "bjets", inputFTFtracks="TrigFastTrackFinder_Tracks_FS" ) + # Flavour Tagging + from TriggerMenuMT.HLTMenuConfig.Bjet.BjetFlavourTaggingConfiguration import getFlavourTagging + flavourTaggingAlgs = getFlavourTagging( inputJets=InputMakerAlg.InViewJets, inputVertex=prmVtxKey, inputTracks=PTTrackParticles[0] ) - # gsc correction - from TrigBjetHypo.TrigGSCFexMTConfig import getGSCFexSplitInstance - theGSC = getGSCFexSplitInstance("GSCFexSplitInstance_ALLTE") - theGSC.TrackKey = PTTrackParticles[0] - theGSC.JetKey = "SplitJets" - theGSC.JetOutputKey = "GSCJets" - theGSC.PriVtxKey = "EFHistoPrmVtx" - # hypo - from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict - hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlg_step2ALLTE") - hypo.RoIs = "step1RoI" - hypo.Jets = theGSC.JetOutputKey - hypo.PrmVtx = theGSC.PriVtxKey + preAlgs = [ viewTestAlg ] - hypo.TracksLink = "tracks__COLL" - hypo.Tracks = PTTrackParticles[0] #"InDetTrigPTTrackParticles_bjets" + bJetBtagSequence = seqAND( "bJetBtagSequence", preAlgs + secondStageAlgs + flavourTaggingAlgs ) + InputMakerAlg.ViewNodeName = "bJetBtagSequence" # Sequence - BjetAthSequence = seqAND("BjetAthSequence_step2ALLTE",[InputMakerAlg] + PTAlgs + [theGSC] ) + BjetAthSequence = seqAND( "BjetAthSequence_step2",[InputMakerAlg,bJetBtagSequence] ) - return MenuSequence( Sequence = BjetAthSequence, - Maker = InputMakerAlg, - Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromDict ) - -# ==================================================================================================== -# step 3: secondary vertex and b-tagging -# ==================================================================================================== - - -def bJetStep3Sequence(): - - # Event View Creator Algorithm - from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithmWithJets - InputMakerAlg = EventViewCreatorAlgorithmWithJets("IMBJet_step3") - InputMakerAlg.ViewFallThrough = True # Access Store Gate for retrieving data - #InputMakerAlg.ViewPerRoI = True # If True it creates one view per RoI. NOTE: REMOVING AS NOT IMPLEMENTED - InputMakerAlg.Views = "BTagViews" # Name of output view - # RoIs - InputMakerAlg.InViewRoIs = "InViewRoIs" # Name RoIs are inserted in the view - InputMakerAlg.RoIsLink = "step1RoI" # RoIs linked to previous decision - # Jets - InputMakerAlg.InViewJets = "InViewJets" # Name Jets are inserted in the view - - from TrigBjetHypo.TrigBtagFexMTConfig import getBtagFexSplitInstance - bTagFex = getBtagFexSplitInstance( "EF","2012","" ) - bTagFex.JetKey = "InViewJets" - bTagFex.PriVtxKey = "HLT_EFHistoPrmVtx" - bTagFex.TracksKey = "InDetTrigPTTrackParticles_bjets" - bTagFex.OutputBTagging = "HLT_BTagging" - - bTaggingSequence = seqAND("bTaggingSequence",[bTagFex] ) - InputMakerAlg.ViewNodeName = "bTaggingSequence" - - # Hypo from TrigBjetHypo.TrigBjetHypoConf import TrigBjetBtagHypoAlgMT - from TrigBjetHypo.TrigBjetBtagHypoTool import TrigBjetBtagHypoToolFromDict - hypo = TrigBjetBtagHypoAlgMT("TrigBjetBtagHypoAlg_step3") - hypo.BTagging = bTagFex.OutputBTagging - - # Sequence - BjetAthSequence = seqAND("BjetAthSequence_step3", [InputMakerAlg,bTaggingSequence] ) + hypo = TrigBjetBtagHypoAlgMT( "TrigBjetBtagHypoAlg" ) + hypo.Tracks = PTTrackParticles[0] + from TrigBjetHypo.TrigBjetBtagHypoTool import TrigBjetBtagHypoToolFromDict return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, HypoToolGen = TrigBjetBtagHypoToolFromDict ) + + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py new file mode 100644 index 0000000000000000000000000000000000000000..401adff7eecac9e98ec33ac0b76f2f10277d5ce0 --- /dev/null +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py @@ -0,0 +1,31 @@ + +from AthenaCommon.CFElements import parOR +#from AthenaCommon.Constants import DEBUG + +def getFirstStageBjetTracking( jetName,vertexName ): + return None + # To be implemented on a later stage + +def getSecondStageBjetTracking( inputRoI ): + algSequence = [] + + # Second stage of Fast tracking (for precision tracking preparation) + from TrigInDetConfig.InDetSetup import makeInDetAlgs + viewAlgs = makeInDetAlgs( whichSignature='Jet',separateTrackParticleCreator="_bjet", rois=inputRoI ) + + algSequence.append( parOR("SecondStageFastTrackingSequence",viewAlgs) ) + + # Precision Tracking + from TrigUpgradeTest.InDetPT import makeInDetPrecisionTracking + PTTracks, PTTrackParticles, PTAlgs = makeInDetPrecisionTracking( "bjet", inputFTFtracks="TrigFastTrackFinder_Tracks_bjet" ) + algSequence += PTAlgs + + return [ algSequence, PTTracks, PTTrackParticles ] + + + + + + + +