diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlg.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlg.cxx deleted file mode 100644 index 733b0db7f42f0cd4c41b5a680021b2c851bb60e6..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlg.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/Property.h" -#include "TrigJetHypoAlg.h" - -using TrigCompositeUtils::DecisionContainer; -using TrigCompositeUtils::DecisionAuxContainer; -using TrigCompositeUtils::newDecisionIn; -using TrigCompositeUtils::addDecisionID; - -TrigJetHypoAlg::TrigJetHypoAlg( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::AthReentrantAlgorithm( name, pSvcLocator ), - m_hypoTools(this){ - declareProperty("HypoTools", m_hypoTools); -} - -TrigJetHypoAlg::~TrigJetHypoAlg(){ -} - -StatusCode TrigJetHypoAlg::initialize() { - ATH_MSG_INFO ( "Initializing " << name() << "..." ); - CHECK(m_hypoTools.retrieve()); - CHECK(m_jetsKey.initialize()); - CHECK(m_decisionsKey.initialize()); - return StatusCode::SUCCESS; -} - -StatusCode TrigJetHypoAlg::finalize() { - ATH_MSG_INFO ( "Finalizing " << name() << "..." ); - - return StatusCode::SUCCESS; -} - -StatusCode TrigJetHypoAlg::execute_r( const EventContext& context ) const { - ATH_MSG_DEBUG ( "Executing " << name() << "..." ); - auto jetsHandle = SG::makeHandle(m_jetsKey, context); - - auto decisions = std::make_unique<DecisionContainer>(); - auto aux = std::make_unique<DecisionAuxContainer>(); - decisions->setStore(aux.get()); - - // prepare decision storage - auto decision = newDecisionIn(decisions.get()); - constexpr std::size_t roiCounter = 0; // other signatures have >1 ROIs - decision->setObjectLink( "feature", - ElementLink<xAOD::JetContainer>(m_jetsKey.key(), - roiCounter)); - - auto jets = jetsHandle.cptr(); - - // loop over hypo tools (one per chain) and report acceptances. - ATH_MSG_DEBUG("Executing " << m_hypoTools.size() << " tools"); - for (auto tool : m_hypoTools) { - bool accept{false}; - ATH_CHECK(tool->decide(jets, accept)); - ATH_MSG_DEBUG("Executed tool " << tool->name() - << " " << std::boolalpha << accept); - - if (accept) { - addDecisionID(tool->decisionId(), decision); - ATH_MSG_DEBUG( " + " << tool->name() ); - } else { - ATH_MSG_DEBUG( " - " << tool->name() ); - } - } - - - { - auto handle = SG::makeHandle(m_decisionsKey, context); - CHECK(handle.record(std::move(decisions), std::move(aux))); - } - - return StatusCode::SUCCESS; -} - - diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlg.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlg.h deleted file mode 100644 index 9c1e72115402878ce624f43dc2fd7970db84468f..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlg.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - This initial version of TrigJetHypo is not yet production code. - In particular, it can read in a jet collection at given (default or - configured) store address, whereas different chains may require - different jet collections (constructed with different jet reco paramters). - - Either there will need to be more than one instance of TrigJetRec, - or an association between chain name and collection name will ned tobe set - up. -*/ -#ifndef TRIGHLTJETHYPOALG_TRIGJETHYPO_H -#define TRIGHLTJETHYPOALG_TRIGJETHYPO_H - -#include <string> - -#include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "TrigHLTJetHypo/ITrigJetHypoTool.h" -#include "DecisionHandling/TrigCompositeUtils.h" -/** - * @class Implements jet selection for the new HLT framework - * @brief - **/ - - -class TrigJetHypoAlg - : public ::AthReentrantAlgorithm -{ - public: - - TrigJetHypoAlg( const std::string& name, ISvcLocator* pSvcLocator ); - - virtual ~TrigJetHypoAlg(); - - StatusCode initialize() override; - StatusCode execute_r( const EventContext& context ) const override; - StatusCode finalize() override; - - - private: - - ToolHandleArray<ITrigJetHypoTool> m_hypoTools; - - SG::ReadHandleKey<xAOD::JetContainer> m_jetsKey{ - this, - "JetCollection", // name of python instance attribute - "JetCollection", // default store key name - "jet container name in store" // doc - }; - - SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_decisionsKey{ - this, - "JetHypoDecisions", // name of python instance attribute - "JetHypoDecisions", // default store key name - "name of jet hypo decisions object in store" // doc - }; -}; - - -#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e005c70fdf1ac937785c2fc09fd060437bdff6a4 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx @@ -0,0 +1,111 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GaudiKernel/Property.h" +#include "TrigJetHypoAlgMT.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "DecisionHandling/TrigCompositeUtils.h" + + +using namespace TrigCompositeUtils; + +using xAOD::JetContainer; + +TrigJetHypoAlgMT::TrigJetHypoAlgMT( const std::string& name, + ISvcLocator* pSvcLocator ) : + ::HypoBase( name, pSvcLocator ) {} + +TrigJetHypoAlgMT::~TrigJetHypoAlgMT() {} + +StatusCode TrigJetHypoAlgMT::initialize() { + ATH_MSG_INFO ( "Initializing " << name() << "..." ); + + + CHECK( m_hypoTools.retrieve() ); + + CHECK( m_jetsKey.initialize() ); + return StatusCode::SUCCESS; +} + +StatusCode TrigJetHypoAlgMT::finalize() { + return StatusCode::SUCCESS; +} + + /* +OLD + ITC -> get 1 RoI/TC + loop over views + make one TC per view + get RoIs of view - from RoI input + get clusters of view -from View input + map the roi to a decision - from input decisions + create new decision with one cluster, one roi, one view + +NEW + loop over ITC + get RoI and view of TC + get cluster of that view + create new decision with one cluster, one roi, one view + + */ + +StatusCode TrigJetHypoAlgMT::execute_r( const EventContext& context ) const { + ATH_MSG_DEBUG ( "Executing " << name() << "..." ); + + + // read in the previous Decisions made before running this hypo Alg. + // The container should have only one such Decision (for L1) as deding + // on jets is a one step process. + auto h_prevDecisions = SG::makeHandle(decisionInput(), context ); + ATH_CHECK(h_prevDecisions.isValid()); + + + if(h_prevDecisions->size() != 1){ + ATH_MSG_ERROR(" Expected one previous decisions (L1 RoIs not used), found " + << h_prevDecisions->size()); + return StatusCode::FAILURE; + } + + auto prevDecisions = h_prevDecisions.get(); + + // Make a new Decisions container which will contain the previous + // decisions, and the one for this hypo. + auto newDecisions = std::make_unique<DecisionContainer>(); + auto aux = std::make_unique<DecisionAuxContainer>(); + newDecisions->setStore(aux.get()); + + // read in a jets collection, and obtain a bare pointer to it + SG::ReadHandle<JetContainer> h_jets(m_jetsKey); + ATH_MSG_DEBUG("Retrieving jets from: " << h_jets.key()); + ATH_CHECK(h_jets.isValid()); + + const JetContainer* jets = h_jets.get(); + + // Pass the jet collection and the decision objects to each hypo tool. + // There is a tool for each chain. The tol will decide whether the + // chain passes, and update the various decision objects accordingly. + // The updates will be seen by this Algorithm. + for (const auto& tool: m_hypoTools) { + CHECK(tool->decide(jets, newDecisions, prevDecisions)); + } + + // output the decisions for all chains for this event. + auto outputHandle = SG::makeHandle(decisionOutput(), context); + CHECK( outputHandle.record( std::move( newDecisions ), std::move( aux ) ) ); + ATH_MSG_DEBUG ( "Exit with "<<outputHandle->size() <<" decisions"); + + + // debug.... + TrigCompositeUtils::DecisionIDContainer allPassingIDs; + for ( auto decisionObject: *outputHandle ) { + TrigCompositeUtils::decisionIDs( decisionObject, allPassingIDs ); + } + + for ( TrigCompositeUtils::DecisionID id : allPassingIDs ) { + ATH_MSG_DEBUG( " +++ " << HLT::Identifier( id ) ); + } + + + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.h new file mode 100644 index 0000000000000000000000000000000000000000..728054e332e68c328113f838a1ce526354c1db68 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TrigHLTJetHypo_TrigJetHypoAlgMT_H +#define TrigHLTJetHypo_TrigJetHypoAlgMT_H + +#include <string> + +#include "TrigJetHypoAlgMT.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "xAODJet/JetContainer.h" +// #include "DecisionHandling/TrigCompositeUtils.h" +#include "DecisionHandling/HypoBase.h" + +#include "ITrigJetHypoToolMT.h" + +/** + * @class TrigJetHypoAlgMT + * @brief Implements jet selection for the HLT framework + **/ +class TrigJetHypoAlgMT : public ::HypoBase { + public: + + TrigJetHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual ~TrigJetHypoAlgMT(); + + virtual StatusCode initialize() override; + virtual StatusCode execute_r( const EventContext& context ) const override; + virtual StatusCode finalize() override; + + private: + + ToolHandleArray<ITrigJetHypoToolMT> m_hypoTools { + this, "HypoTools", {}, "Hypo tools"}; + + SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey { + this, "Jets", "Jets", "jet container key, full scan"}; + + +}; + +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx index 961cda808e279f60c26ca29ea9f705ad72b78b79..e75c676ac63e7ada5b942d48d3b9a121ee3c17ff 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx @@ -4,16 +4,16 @@ #include "TrigHLTJetHypo/TrigEFDPhiMetJetAllTE.h" // #include "TrigHLTJetHypo/TrigHLTJetHypo_HT.h" -#include "../TrigJetHypoAlg.h" +#include "../TrigJetHypoAlgMT.h" #include "../TrigJetHypoToolConfig_EtaEt.h" #include "../TrigJetHypoToolMT.h" DECLARE_COMPONENT( TrigHLTJetHypo2 ) -DECLARE_COMPONENT( TrigJetHypoAlg ) DECLARE_COMPONENT( TrigEFRazorAllTE ) DECLARE_COMPONENT( TrigEFDPhiMetJetAllTE ) +DECLARE_COMPONENT(TrigJetHypoAlgMT) DECLARE_COMPONENT(TrigJetHypoToolMT) DECLARE_COMPONENT(TrigJetHypoToolConfig_EtaEt)