diff --git a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt index cdf295f3d9a608f538efd460cb69feb3cd65f691..c8e43278105b8e16ff9077c9b2365b277a98a9a4 100644 --- a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt +++ b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt @@ -23,16 +23,23 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate ) -# Component(s) in the package: -atlas_add_library( DecisionHandling + +atlas_add_library( DecisionHandlingLib src/*.cxx PUBLIC_HEADERS DecisionHandling LINK_LIBRARIES xAODTrigger GaudiKernel - PRIVATE_LINK_LIBRARIES AthenaBaseComps CxxUtils TrigConfHLTData TrigSteeringEvent ) + PRIVATE_LINK_LIBRARIES AthenaBaseComps CxxUtils TrigConfHLTData ) +# Component(s) in the package: +atlas_add_component( DecisionHandling + src/components/*.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} + ${ROOT_LIBRARIES} GaudiKernel AthViews AthenaBaseComps CxxUtils xAODTrigger DecisionHandlingLib + ) atlas_add_test( TrigCompositeUtils_test SOURCES test/TrigCompositeUtils_test.cxx - LINK_LIBRARIES TestTools xAODTrigger DecisionHandling + LINK_LIBRARIES TestTools xAODTrigger DecisionHandlingLib AthContainers ) diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h index 0b1402c2537d98bddaf351870c1b03d1d7d30ec2..76963eb8a8045b32d67d6935e841cf5fcc178f01 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h @@ -7,6 +7,7 @@ #include <string> #include <vector> +#include <set> #include <map> @@ -28,6 +29,11 @@ public: */ Identifier(const std::string& stringID); + /* + @brief Construct wiht numeric ID + */ + Identifier(unsigned id) : m_id(id) {} + /* @brief reports human redable name if it is enabled or, empty string */ @@ -48,6 +54,7 @@ private: }; typedef std::vector<HLT::Identifier> IDVec; + typedef std::set<HLT::Identifier> IDSet; typedef std::map<HLT::Identifier, IDVec> IDtoIDVecMap; } diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/TrigCompositeUtils.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/TrigCompositeUtils.h index 30a76b2bbae33e3585d01f755982dca4e9567bfd..4f1b75a3a8d41ef48c6cf5347966e30efce8a1c2 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/TrigCompositeUtils.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/TrigCompositeUtils.h @@ -31,7 +31,7 @@ namespace TrigCompositeUtils { struct DecisionOutput { DecisionOutput(); // TODO reading DecisionStorage(const SG::ReadHandleKey<DecisionContainer>& key); - StatusCode record(const EventContext& ctx, const SG::WriteHandleKey<DecisionContainer>& key); + StatusCode record(const SG::WriteHandleKey<DecisionContainer>& key, const EventContext& ctx ); std::unique_ptr<DecisionContainer> decisions; std::unique_ptr<DecisionAuxContainer> aux; }; @@ -45,7 +45,7 @@ namespace TrigCompositeUtils { */ struct DecisionInput { - StatusCode retrieve(const EventContext& ctx, const SG::ReadHandleKey<DecisionContainer>& key); + StatusCode retrieve(const SG::ReadHandleKey<DecisionContainer>& key, const EventContext& ctx ); const DecisionContainer* decisions = nullptr; }; @@ -68,6 +68,7 @@ namespace TrigCompositeUtils { @brief Appends the decision (given as ID) to the decision object */ void addDecisionID( DecisionID id, Decision* d); + /* @brief Extracts DecisionIDs stored in the Decsion object diff --git a/Trigger/TrigSteer/DecisionHandling/src/DumpDecisions.cxx b/Trigger/TrigSteer/DecisionHandling/src/DumpDecisions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..67e2b199199d35bce244ed24fe23170493c975a6 --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/src/DumpDecisions.cxx @@ -0,0 +1,90 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ +// DecisionHandling includes + + +#include "DecisionHandling/HLTIdentifier.h" + +// FrameWork includes +#include "GaudiKernel/Property.h" +#include "DumpDecisions.h" + + +/////////////////////////////////////////////////////////////////// +// Public methods: +/////////////////////////////////////////////////////////////////// + +// Constructors +//////////////// +DumpDecisions::DumpDecisions( const std::string& name, + ISvcLocator* pSvcLocator ) + : AthReentrantAlgorithm( name, pSvcLocator ) +{ + declareProperty( "Decisions", m_decisionKey, "Input Decisions" ); + declareProperty( "VerbosityLevel", m_verbosityLevel, "3 - tries to print as much possible, 2 - only list of objects and their decisions, 1 - only list of active objets"); +} + +// Destructor +/////////////// +DumpDecisions::~DumpDecisions() +{} + +// Athena Algorithm's Hooks +//////////////////////////// +StatusCode DumpDecisions::initialize() +{ + ATH_MSG_INFO ("Initializing " << name() << "..."); + CHECK( m_decisionKey.initialize() ); + return StatusCode::SUCCESS; +} + +StatusCode DumpDecisions::finalize() { + ATH_MSG_INFO ("Finalizing " << name() << "..."); + + return StatusCode::SUCCESS; +} + +StatusCode DumpDecisions:: execute_r( const EventContext& ctx ) const { + using namespace TrigCompositeUtils; + DecisionInput decisionInput; + CHECK ( decisionInput.retrieve( m_decisionKey, ctx) ); + + for ( auto d: *decisionInput.decisions ) { + + DecisionIDContainer ids; + TrigCompositeUtils::decisionIDs( d, ids ); + if ( not ids.empty() ) { + ATH_MSG_DEBUG( "Decision object" ); + if ( m_verbosityLevel >= 2 ) { + for ( auto id: ids ) { + ATH_MSG_DEBUG( "Passing decision " << HLT::Identifier(id) ); + } + } + } + } + return StatusCode::SUCCESS; +} + + +/////////////////////////////////////////////////////////////////// +// Const methods: +/////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// Non-const methods: +/////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// Protected methods: +/////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// Const methods: +/////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// Non-const methods: +/////////////////////////////////////////////////////////////////// + + diff --git a/Trigger/TrigSteer/DecisionHandling/src/DumpDecisions.h b/Trigger/TrigSteer/DecisionHandling/src/DumpDecisions.h new file mode 100644 index 0000000000000000000000000000000000000000..50da48fe7e9fd686cffd27a78a3122450d2ffde9 --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/src/DumpDecisions.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef DECISIONHANDLING_DUMPDECISIONS_H +#define DECISIONHANDLING_DUMPDECISIONS_H 1 + +// STL includes +#include <string> +#include "DecisionHandling/TrigCompositeUtils.h" +// FrameWork includes +#include "AthenaBaseComps/AthReentrantAlgorithm.h" + + + +class DumpDecisions + : public ::AthReentrantAlgorithm +{ + + /////////////////////////////////////////////////////////////////// + // Public methods: + /////////////////////////////////////////////////////////////////// + public: + + // Copy constructor: + + /// Constructor with parameters: + DumpDecisions( const std::string& name, ISvcLocator* pSvcLocator ); + + /// Destructor: + virtual ~DumpDecisions(); + + // Athena algorithm's Hooks + StatusCode initialize() override; + StatusCode execute_r( const EventContext& ctx ) const override; + StatusCode finalize() override; + private: + + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_decisionKey; + size_t m_verbosityLevel = 3; // see docu. of property + /// Default constructor: + DumpDecisions(); + + + + +}; + + +#endif //> !DECISIONHANDLING_DUMPDECISIONS_H diff --git a/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx b/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx index dd75ee36a2b08fc8d2c416e498cd60f79bcb2fcb..0bb20d67810c476a39744df16f60e384b5432b65 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ #include "StoreGate/WriteHandle.h" #include "StoreGate/ReadHandle.h" #include "AthContainers/AuxElement.h" @@ -14,16 +17,20 @@ namespace TrigCompositeUtils { DecisionOutput::DecisionOutput() { decisions = std::make_unique<DecisionContainer>(); aux = std::make_unique<DecisionAuxContainer>(); - decisions->setStore(aux.release()); + decisions->setStore( aux.release() ); } - StatusCode DecisionOutput::record(const EventContext& ctx, const SG::WriteHandleKey<DecisionContainer>& key) { + StatusCode DecisionOutput::record( const SG::WriteHandleKey<DecisionContainer>& key, const EventContext& ctx ) { SG::WriteHandle<DecisionContainer> handle(key, ctx); - return handle.record(std::move(decisions), std::move(aux)); + // CHECK ( handle.record( std::move( decisions ) ) ); + // SG::WriteHandle<DecisionAuxContainer> auxHandle(key.key()+"Aux.", ctx); + // CHECK( auxHandle.record( std::move (aux) ) ); + // return StatusCode::SUCCESS; + return handle.record( std::move(decisions), std::move(aux) ); } - StatusCode DecisionInput::retrieve(const EventContext& ctx, const SG::ReadHandleKey<DecisionContainer>& key) { - SG::ReadHandle<DecisionContainer> handle(key, ctx); + StatusCode DecisionInput::retrieve( const SG::ReadHandleKey<DecisionContainer>& key, const EventContext& ctx ) { + SG::ReadHandle<DecisionContainer> handle( key, ctx ); decisions = handle.get(); return StatusCode::SUCCESS; } @@ -31,30 +38,25 @@ namespace TrigCompositeUtils { Decision* newDecisionIn (DecisionContainer* dc) { Decision * x = new Decision; - dc->push_back(x); + dc->push_back( x ); return x; } - void addDecisionID( DecisionID id, Decision* d) { - readWriteAccessor(*d).push_back(id); + readWriteAccessor( *d ).push_back( id ); } - - void decisionIDs(const Decision* d, DecisionIDContainer& destination ) { - - const std::vector<int>& decisions = readOnlyAccessor(*d); - - destination.insert(decisions.begin(), decisions.end()); + void decisionIDs( const Decision* d, DecisionIDContainer& destination ) { + const std::vector<int>& decisions = readOnlyAccessor( *d ); + destination.insert( decisions.begin(), decisions.end() ); } - bool passingIDs( const Decision* d, const DecisionIDContainer& required) { - for ( auto id : readOnlyAccessor(*d)) { - if ( required.count(id) > 0 ) + bool passingIDs( const Decision* d, const DecisionIDContainer& required ) { + for ( auto id : readOnlyAccessor( *d ) ) { + if ( required.count( id ) > 0 ) return true; } return false; - } - + } } diff --git a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2df90b72c95ed2bfb2500144907536de1a2e7d09 --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx @@ -0,0 +1,13 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ +#include "GaudiKernel/DeclareFactoryEntries.h" + +#include "../DumpDecisions.h" + +DECLARE_ALGORITHM_FACTORY( DumpDecisions ) + +DECLARE_FACTORY_ENTRIES( DumpDecisions ) +{ + DECLARE_ALGORITHM( DumpDecisions ) +} diff --git a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_load.cxx b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8c38cd4887168c7785ad8e376d9cb7ba98d75db0 --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_load.cxx @@ -0,0 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES( DecisionHandling ) diff --git a/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx b/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx index 4b7313bc0f26411e3c196773e4641e7d928e80cf..35cdc9a68bc69cae8e48f73f817311fd82cf967f 100644 --- a/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx +++ b/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx @@ -1,3 +1,7 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + #include <iostream> //#include "TestTools/expect.h" #include "DecisionHandling/TrigCompositeUtils.h" diff --git a/Trigger/TrigSteer/L1Decoder/CMakeLists.txt b/Trigger/TrigSteer/L1Decoder/CMakeLists.txt index 2bece9a510e0deb01aa8ea3d6a87c33cc1440e5a..7711fd4b891f4b8550f7682403435dcec2f6816b 100644 --- a/Trigger/TrigSteer/L1Decoder/CMakeLists.txt +++ b/Trigger/TrigSteer/L1Decoder/CMakeLists.txt @@ -38,7 +38,7 @@ atlas_add_library( L1DecoderLib GaudiKernel AthViews AthenaBaseComps CxxUtils xAODTrigger TrigConfHLTData TrigConfL1Data TrigSteeringEvent TrigT1Interfaces TrigT1Result - TrigMonitorBaseLib DecisionHandling + TrigMonitorBaseLib DecisionHandlingLib ) atlas_add_component( L1Decoder diff --git a/Trigger/TrigSteer/L1Decoder/share/decodeBS.py b/Trigger/TrigSteer/L1Decoder/share/decodeBS.py index e439226f87cc995a74227de7d2ba167378f2bc5f..06ea9d57a43b0c00a1685c5d4c48e75c941f9b4f 100755 --- a/Trigger/TrigSteer/L1Decoder/share/decodeBS.py +++ b/Trigger/TrigSteer/L1Decoder/share/decodeBS.py @@ -5,7 +5,7 @@ # # get_files LVL1config_Physics_pp_v5.xml # ln -s /afs/cern.ch/atlas/project/trigger/pesa-sw/validation/atn-test/data15_13TeV.00266904.physics_EnhancedBias.merge.RAW._lb0452._SFO-1._0001.1 input.data -# +# exact config for this data is: https://atlas-trigconf.cern.ch/run2/smkey/2142/l1key/1077/hltkey/765/ import os.path assert os.path.isfile('input.data'), 'No input file: see the JO to see how to get it' @@ -84,15 +84,27 @@ if nThreads >= 1: topSequence.SGInputLoader.Load = [ ('ROIB::RoIBResult','RoIBResult') ] from L1Decoder.L1DecoderConf import * -l1Decoder = L1Decoder() +l1Decoder = L1Decoder( OutputLevel=DEBUG ) l1Decoder.ctpUnpacker = CTPUnpackingTool() -l1Decoder.ctpUnpacker.CTPToChainMapping = ["1:HLT_e3", "2:HLT_e5"] -emUnpacker = EMRoIsUnpackingTool() -emUnpacker.ThresholdToChainMapping = ["EM3:HLT_e3", "EM3:HLT_e5"] -l1Decoder.roiUnpackers = [] +l1Decoder.ctpUnpacker.CTPToChainMapping = ["0:HLT_e3", "0:HLT_g5", "1:HLT_e7", "15:HLT_mu6", "33:HLT_2mu6", "15:HLT_mu6idperf", "42:HLT_e15mu4"] + +emUnpacker = EMRoIsUnpackingTool( OutputLevel=DEBUG ) +emUnpacker.ThresholdToChainMapping = ["EM3 : HLT_e3", "EM3 : HLT_g5", "EM7 : HLT_e7", "EM15 : HLT_e15mu4" ] + + +muUnpacker = MURoIsUnpackingTool( OutputLevel=DEBUG ) +muUnpacker.ThresholdToChainMapping = ["MU6 : HLT_mu6", "MU6 : HLT_mu6idperf", "MU4 : HLT_e15mu4"] +# do not know yet how to configure the services for it + +l1Decoder.roiUnpackers = [emUnpacker] topSequence += l1Decoder #Run calo decoder +from DecisionHandling.DecisionHandlingConf import * +emDecisionsDumper = DumpDecisions("EML1RoIs") +emDecisionsDumper.Decisions = "EMRoIDecisions" +#topSequence += emDecisionsDumper + # caloDecoder = L1CaloDecoder() # by default it is steered towards the RoIBResult of the name above # caloDecoder.OutputLevel=VERBOSE # topSequence += caloDecoder diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx index ac5d2a62a5f45257d067cf1e8606c25734c141cd..d0d534a9c4edba79be7ffab20162962c776f6a63 100644 --- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ // L1Decoder includes #include "EMRoIsUnpackingTool.h" #include "TrigT1Result/RoIBResult.h" @@ -14,13 +17,13 @@ EMRoIsUnpackingTool::EMRoIsUnpackingTool( const std::string& type, const std::string& name, const IInterface* parent ) : AthAlgTool ( type, name, parent ), - m_configSvc("TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name) { + m_configSvc( "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name ) { - declareProperty( "Decisions", m_decisionsKey="RoIDecisions", "Decisions for each RoI" ); - declareProperty("ThresholdToChainMapping", m_thresholdToChainProperty, "Mapping from the threshold name to chain in the form: 'EM3:HLT_e5', 'EM3:HLT_e5tight', ..."); - declareProperty("OutputRoIs", m_trigRoIsKey="EMRoIs", "Name of the RoIs object produced by the unpacker"); - declareProperty("OutputRecEMTauRoIs", m_recEMTauRoIsKey="RecEMRoIs", "Name of the RoIs object produced by the unpacker"); - declareProperty("RoIWidth", m_roIWidth = 0.1, "Size of RoI in eta/ phi"); + declareProperty( "Decisions", m_decisionsKey="EMRoIDecisions", "Decisions for each RoI" ); + declareProperty( "ThresholdToChainMapping", m_thresholdToChainProperty, "Mapping from the threshold name to chain in the form: 'EM3 : HLT_e5', 'EM3 : HLT_e5tight', ..., (note spaces)" ); + declareProperty( "OutputTrigRoIs", m_trigRoIsKey="EMRoIs", "Name of the RoIs object produced by the unpacker" ); + declareProperty( "OutputRecRoIs", m_recRoIsKey="RecEMRoIs", "Name of the RoIs object produced by the unpacker" ); + declareProperty( "RoIWidth", m_roIWidth = 0.1, "Size of RoI in eta/ phi" ); } @@ -30,10 +33,14 @@ EMRoIsUnpackingTool::~EMRoIsUnpackingTool(){ StatusCode EMRoIsUnpackingTool::initialize() { CHECK( m_configSvc.retrieve() ); + CHECK( m_decisionsKey.initialize() ); CHECK( m_trigRoIsKey.initialize() ); - CHECK( m_recEMTauRoIsKey.initialize() ); + CHECK( m_recRoIsKey.initialize() ); //TODO add mapping retrieval - CHECK( decodeMapping() ); + if (decodeMapping().isFailure() ) { + ATH_MSG_ERROR( "Failed to decode threshold to chains mapping, is the format th : chain?" ); + return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } @@ -44,7 +51,7 @@ StatusCode EMRoIsUnpackingTool::beginRun() { for( auto caloType : std::vector<L1DataDef::TriggerType>{ L1DataDef::EM/*, L1DataDef::TAU*/} ) { for (TriggerThreshold * th : thresholdConfig->getThresholdVector( caloType ) ) { if ( th != nullptr ) { - ATH_MSG_DEBUG("Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric()); + ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric() ); m_emThresholds.push_back(th); } } @@ -59,43 +66,44 @@ StatusCode EMRoIsUnpackingTool::finalize() } -StatusCode EMRoIsUnpackingTool::unpack(const EventContext& ctx, - const ROIB::RoIBResult& roib, - const HLT::IDVec& activeChains) const { +StatusCode EMRoIsUnpackingTool::unpack( const EventContext& ctx, + const ROIB::RoIBResult& roib, + const HLT::IDSet& activeChains ) const { - TrigCompositeUtils::DecisionOutput decisionsOutput; + TrigCompositeUtils::DecisionOutput decisionOutput; auto trigRoIs = CxxUtils::make_unique< TrigRoiDescriptorCollection >(); - auto recEMTauRoIs = CxxUtils::make_unique< DataVector<LVL1::RecEmTauRoI> >(); + auto recRoIs = CxxUtils::make_unique< DataVector<LVL1::RecEmTauRoI> >(); // RoIBResult contains vector of EM fragments for ( auto& emTauFragment : roib.eMTauResult() ) { - for ( auto& roi : emTauFragment.roIVec() ) { + for ( auto& roi : emTauFragment.roIVec() ) { uint32_t roIWord = roi.roIWord(); - if ( not (LVL1::TrigT1CaloDefs::EMRoIWordType == roi.roIType()) ) { - ATH_MSG_DEBUG("Skipping RoI as it is not EM threshold " << roIWord ); + if ( not ( LVL1::TrigT1CaloDefs::EMRoIWordType == roi.roIType() ) ) { + ATH_MSG_DEBUG( "Skipping RoI as it is not EM threshold " << roIWord ); continue; } auto recRoI = new LVL1::RecEmTauRoI( roIWord, &m_emThresholds ); - recEMTauRoIs->push_back(recRoI); + recRoIs->push_back( recRoI ); - auto trigRoI = new TrigRoiDescriptor(recRoI->roiWord(), 0u ,0u, - recRoI->eta(), recRoI->eta()-m_roIWidth, recRoI->eta()+m_roIWidth, - recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth); - trigRoIs->push_back(trigRoI); + auto trigRoI = new TrigRoiDescriptor( roIWord, 0u ,0u, + recRoI->eta(), recRoI->eta()-m_roIWidth, recRoI->eta()+m_roIWidth, + recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth ); + trigRoIs->push_back( trigRoI ); - ATH_MSG_DEBUG("RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << ", threshold pattern " << MSG::dec); + ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << ", threshold pattern " << MSG::dec ); - auto decision = TrigCompositeUtils::newDecisionIn(decisionsOutput.decisions.get()); + auto decision = TrigCompositeUtils::newDecisionIn( decisionOutput.decisions.get() ); for ( auto th: m_emThresholds ) { - if ( recRoI->passedThreshold(th->thresholdNumber()) ) { - TrigCompositeUtils::addDecisionID( HLT::Identifier(th->name()).numeric(), decision ); + if ( recRoI->passedThreshold( th->thresholdNumber() ) ) { + addChainsToDecision( HLT::Identifier( th->name() ), decision, activeChains ); } } - - decision->setObjectLink("initialRoI", ElementLink<TrigRoiDescriptorCollection>(m_trigRoIsKey.key(), trigRoIs->size()-1 )); - decision->setObjectLink("initialRecRoI", ElementLink<DataVector<LVL1::RecEmTauRoI>>(m_recEMTauRoIsKey.key(), recEMTauRoIs->size()-1)); - } + + // TODO would be nice to have this. Requires modifying the TC class: decision->setDetail("Thresholds", passedThresholds); // record passing threshold names (for easy debugging) + decision->setObjectLink( "initialRoI", ElementLink<TrigRoiDescriptorCollection>(m_trigRoIsKey.key(), trigRoIs->size()-1 ) ); + decision->setObjectLink( "initialRecRoI", ElementLink<DataVector<LVL1::RecEmTauRoI>>(m_recRoIsKey.key(), recRoIs->size()-1) ); + } } for ( auto roi: *trigRoIs ) { ATH_MSG_DEBUG("RoI Eta: " << roi->eta() << " Phi: " << roi->phi() << " RoIWord: " << roi->roiWord()); @@ -104,13 +112,13 @@ StatusCode EMRoIsUnpackingTool::unpack(const EventContext& ctx, // recording { SG::WriteHandle<TrigRoiDescriptorCollection> handle(m_trigRoIsKey, ctx); - CHECK( handle.record(std::move(trigRoIs)) ); + CHECK( handle.record (std::move(trigRoIs)) ); } { - SG::WriteHandle<DataVector<LVL1::RecEmTauRoI>> handle(m_recEMTauRoIsKey, ctx); - CHECK( handle.record(std::move(recEMTauRoIs)) ); + SG::WriteHandle<DataVector<LVL1::RecEmTauRoI>> handle(m_recRoIsKey, ctx); + CHECK( handle.record( std::move(recRoIs)) ); } - + CHECK( decisionOutput.record( m_decisionsKey, ctx) ); return StatusCode::SUCCESS; // what else diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h index 4bc9b5a3df450718050438267c71e3388ec85ae1..341db2dd14e6a05c6fc372fada1065038c66e9a9 100644 --- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ #ifndef L1DECODER_EMROISUNPACKINGTOOL_H #define L1DECODER_EMROISUNPACKINGTOOL_H 1 @@ -28,20 +31,20 @@ class EMRoIsUnpackingTool : virtual public AthAlgTool, virtual public IRoIsUnpac virtual ~EMRoIsUnpackingTool(); - virtual StatusCode unpack(const EventContext& ctx, - const ROIB::RoIBResult& roib, - const HLT::IDVec& activeChains) const; + StatusCode unpack(const EventContext& ctx, + const ROIB::RoIBResult& roib, + const HLT::IDSet& activeChains) const override; // Athena algtool's Hooks - virtual StatusCode initialize(); - virtual StatusCode beginRun(); - virtual StatusCode finalize(); + StatusCode initialize() override; + StatusCode beginRun(); + StatusCode finalize() override; private: EMRoIsUnpackingTool(); std::vector<TrigConf::TriggerThreshold*> m_emThresholds; SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey; - SG::WriteHandleKey< DataVector<LVL1::RecEmTauRoI> > m_recEMTauRoIsKey; + SG::WriteHandleKey< DataVector<LVL1::RecEmTauRoI> > m_recRoIsKey; ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc; float m_roIWidth; }; diff --git a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx index 45c93b669817948dc04a98fbce3dd9c706f3b4d1..5b4749c3100ad3adaffbe80c44a887d2c62dc45c 100644 --- a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx @@ -30,7 +30,17 @@ StatusCode IRoIsUnpackingTool::decodeMapping() { return StatusCode::SUCCESS; } - +void IRoIsUnpackingTool::addChainsToDecision( HLT::Identifier thresholdId, + TrigCompositeUtils::Decision* d, + const HLT::IDSet& activeChains ) const { + auto chains = m_thresholdToChainMapping.find( thresholdId ); + if ( chains == m_thresholdToChainMapping.end() ) + return; + for ( auto chainId: chains->second ) { + if ( activeChains.find(chainId) != activeChains.end() ) + TrigCompositeUtils::addDecisionID( chainId.numeric(), d ); + } +} diff --git a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h index 1e0f38049bfd1f9190505b0dadef9e672be5c6f8..2847eb5f097a720f49438ef1875e79b774a4c984 100644 --- a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h @@ -36,14 +36,20 @@ class IRoIsUnpackingTool */ virtual StatusCode unpack(const EventContext& ctx, const ROIB::RoIBResult& roib, - const HLT::IDVec& activeChains) const = 0; + const HLT::IDSet& activeChains) const = 0; + - StatusCode decodeMapping(); protected: + SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer> m_decisionsKey; std::vector<std::string> m_thresholdToChainProperty; std::map<HLT::Identifier, HLT::IDVec> m_thresholdToChainMapping; + + StatusCode decodeMapping(); + void addChainsToDecision( HLT::Identifier thresholdId, + TrigCompositeUtils::Decision* d, + const HLT::IDSet& activeChains ) const; }; inline const InterfaceID& IRoIsUnpackingTool::interfaceID() { diff --git a/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.cxx index bb26fee23cce2e640ff33526e27f8e34c3f2d3f5..44e1e643a45875e4be56ec2d1089dbcfa0eafd87 100644 --- a/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.cxx @@ -1,9 +1,6 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// -// JRoIsUnpackingTool.cxx -// Implementation file for class JRoIsUnpackingTool -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ // L1Decoder includes #include "JRoIsUnpackingTool.h" @@ -26,8 +23,7 @@ JRoIsUnpackingTool::JRoIsUnpackingTool( const std::string& type, const std::string& name, const IInterface* parent ) : - ::AthAlgTool ( type, name, parent ), - m_storeGate( "StoreGateSvc", name ) + ::AthAlgTool ( type, name, parent ) { // // Property declaration @@ -47,11 +43,6 @@ StatusCode JRoIsUnpackingTool::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); - // Get pointer to StoreGateSvc and cache it : - if ( !m_storeGate.retrieve().isSuccess() ) { - ATH_MSG_ERROR ("Unable to retrieve pointer to StoreGateSvc"); - return StatusCode::FAILURE; - } return StatusCode::SUCCESS; } @@ -63,24 +54,5 @@ StatusCode JRoIsUnpackingTool::finalize() return StatusCode::SUCCESS; } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// diff --git a/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h index 22bb851f3b2e81e854a21db760d77d44c3efb5ee..308f4e11c67db12100ee61ea490d7b3f6448652f 100644 --- a/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h @@ -1,12 +1,10 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// -// JRoIsUnpackingTool.h -// Header file for class JRoIsUnpackingTool -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ #ifndef L1DECODER_JROISUNPACKINGTOOL_H #define L1DECODER_JROISUNPACKINGTOOL_H 1 -// STL includes + #include <string> // FrameWork includes @@ -26,9 +24,7 @@ class JRoIsUnpackingTool public ::AthAlgTool { - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// + public: // Copy constructor: @@ -45,37 +41,15 @@ class JRoIsUnpackingTool virtual StatusCode initialize(); virtual StatusCode finalize(); - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// private: /// Default constructor: JRoIsUnpackingTool(); - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - /// Pointer to the StoreGate service - StoreGateSvc_t m_storeGate; - // Containers }; -// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - #endif //> !L1DECODER_JROISUNPACKINGTOOL_H diff --git a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx index d61183ab48100889cf0ed3830d05265eab528e81..acc35c236f34e987ea2ec92bb7a5f7c2814536a6 100644 --- a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx @@ -41,7 +41,7 @@ StatusCode L1Decoder::readConfiguration() { StatusCode L1Decoder::execute_r (const EventContext& ctx) const { using namespace TrigCompositeUtils; - SG::ReadHandle<ROIB::RoIBResult> roibH(m_RoIBResultKey, ctx); + SG::ReadHandle<ROIB::RoIBResult> roibH( m_RoIBResultKey, ctx ); // this should realy be: const ROIB::RoIBResult* roib = SG::INPUT_PTR (m_RoIBResultKey, ctx); // or const ROIB::RoIBResult& roib = SG::INPUT_REF (m_RoIBResultKey, ctx); @@ -49,36 +49,32 @@ StatusCode L1Decoder::execute_r (const EventContext& ctx) const { DecisionOutput chainsInfo; HLT::IDVec l1SeededChains; - CHECK( m_ctpUnpacker->decode(*roibH, l1SeededChains) ); - sort(l1SeededChains.begin(), l1SeededChains.end()); // do so that following scaling is reproducable + CHECK( m_ctpUnpacker->decode( *roibH, l1SeededChains ) ); + sort( l1SeededChains.begin(), l1SeededChains.end() ); // do so that following scaling is reproducable HLT::IDVec activeChains; - activeChains.reserve(l1SeededChains.size()); // an optimisation, max we get as many active chains as were seeded by L1, rarely the condition, but allows to avoid couple of reallocations - CHECK( prescaleChains(l1SeededChains, activeChains)); + activeChains.reserve( l1SeededChains.size() ); // an optimisation, max we get as many active chains as were seeded by L1, rarely the condition, but allows to avoid couple of reallocations + CHECK( prescaleChains( l1SeededChains, activeChains) ); - CHECK( saveChainsInfo(l1SeededChains, chainsInfo.decisions.get(), "l1seeded") ); - CHECK( saveChainsInfo(activeChains, chainsInfo.decisions.get(), "unprescaled") ); + CHECK( saveChainsInfo( l1SeededChains, chainsInfo.decisions.get(), "l1seeded" ) ); + CHECK( saveChainsInfo( activeChains, chainsInfo.decisions.get(), "unprescaled" ) ); + HLT::IDSet activeChainSet( activeChains.begin(), activeChains.end() ); for ( auto unpacker: m_roiUnpackers ) { - CHECK( unpacker->unpack( ctx, *roibH, activeChains ) ); + CHECK( unpacker->unpack( ctx, *roibH, activeChainSet ) ); } + ATH_MSG_DEBUG("Recording chains"); + CHECK( chainsInfo.record( m_chainsKey, ctx ) ); - - - ATH_CHECK( chainsInfo.record( ctx, m_chainsKey ) ); - - - // TODO add monitoring - return StatusCode::SUCCESS; - + return StatusCode::SUCCESS; } StatusCode L1Decoder::finalize() { return StatusCode::SUCCESS; } -StatusCode L1Decoder::prescaleChains(const HLT::IDVec& active, - HLT::IDVec& notPrescaled) const { +StatusCode L1Decoder::prescaleChains( const HLT::IDVec& active, + HLT::IDVec& notPrescaled ) const { // intention is to use the same RNG scalers as in current steering version but it has to be refactored as follows // read in the CTP info and get the time @@ -86,10 +82,10 @@ StatusCode L1Decoder::prescaleChains(const HLT::IDVec& active, // for ( auto c: active ) { - auto psInfo = m_prescalingInfo.find(c); + auto psInfo = m_prescalingInfo.find( c ); if ( psInfo == m_prescalingInfo.end() ) { ATH_MSG_INFO("No prescaling information for the chain, enabling it " << c); - notPrescaled.push_back(c); + notPrescaled.push_back( c ); } else { // this code should then work @@ -105,7 +101,7 @@ StatusCode L1Decoder::prescaleChains(const HLT::IDVec& active, StatusCode L1Decoder::saveChainsInfo(const HLT::IDVec& chains, xAOD::TrigCompositeContainer* storage, const std::string& type) const { using namespace TrigCompositeUtils; - Decision* d = newDecisionIn(storage); + Decision* d = newDecisionIn( storage ); d->setName(type); for ( auto c: chains) addDecisionID(c.numeric(), d); diff --git a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx index c36c1c43aebf3adb38e6679fa01a007b3f399106..33137f974fbc5faf47da849ecdb293953ddd8030 100644 --- a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx @@ -1,19 +1,9 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// -// MURoIsUnpackingTool.cxx -// Implementation file for class MURoIsUnpackingTool -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - -// L1Decoder includes +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ #include "MURoIsUnpackingTool.h" - -// STL includes - -// FrameWork includes -#include "GaudiKernel/IToolSvc.h" - -// StoreGate -#include "StoreGate/StoreGateSvc.h" +#include "TrigT1Result/RoIBResult.h" +#include "TrigT1Interfaces/TrigT1CaloDefs.h" @@ -24,63 +14,103 @@ // Constructors //////////////// MURoIsUnpackingTool::MURoIsUnpackingTool( const std::string& type, - const std::string& name, - const IInterface* parent ) : - ::AthAlgTool ( type, name, parent ), - m_storeGate( "StoreGateSvc", name ) -{ - // - // Property declaration - // - //declareProperty( "Property", m_nProperty ); - + const std::string& name, + const IInterface* parent ) + : AthAlgTool ( type, name, parent ), + m_configSvc( "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name ), + m_recRpcRoISvc( "LVL1RPC::RPCRecRoiSvc/RPCRecRoiSvc", name ), + m_recTgcRoISvc( "LVL1TGC::TGCRecRoiSvc/TGCRecRoiSvc", name ) { + + declareProperty( "Decisions", m_decisionsKey="MURoIDecisions", "Decisions for each RoI" ); + declareProperty( "ThresholdToChainMapping", m_thresholdToChainProperty, "Mapping from the threshold name to chain in the form: 'EM3:HLT_e5', 'EM3:HLT_e5tight', ..." ); + declareProperty( "OutputTrigRoIs", m_trigRoIsKey="MURoIs", "Name of the RoIs object produced by the unpacker" ); + declareProperty( "OutputRecRoIs", m_recRoIsKey ="RecMURoIs", "Name of the RoIs object produced by the unpacker" ); + declareProperty( "RoIWidth", m_roIWidth = 0.1, "Size of RoI in eta/ phi" ); } // Destructor /////////////// -MURoIsUnpackingTool::~MURoIsUnpackingTool() -{} +MURoIsUnpackingTool::~MURoIsUnpackingTool(){} // Athena algtool's Hooks //////////////////////////// -StatusCode MURoIsUnpackingTool::initialize() -{ - ATH_MSG_INFO ("Initializing " << name() << "..."); - - // Get pointer to StoreGateSvc and cache it : - if ( !m_storeGate.retrieve().isSuccess() ) { - ATH_MSG_ERROR ("Unable to retrieve pointer to StoreGateSvc"); +StatusCode MURoIsUnpackingTool::initialize() { + CHECK( m_configSvc.retrieve() ); + CHECK( m_decisionsKey.initialize() ); + CHECK( m_trigRoIsKey.initialize() ); + CHECK( m_recRoIsKey.initialize() ); + CHECK( m_recRpcRoISvc.retrieve() ); + CHECK( m_recTgcRoISvc.retrieve() ); + if (decodeMapping().isFailure() ) { + ATH_MSG_ERROR( "Failed to decode threshold to chains mapping, is the format th : chain?" ); return StatusCode::FAILURE; } - return StatusCode::SUCCESS; } -StatusCode MURoIsUnpackingTool::finalize() -{ - ATH_MSG_INFO ("Finalizing " << name() << "..."); - +StatusCode MURoIsUnpackingTool::beginRun() { + using namespace TrigConf; + const ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); + for (TriggerThreshold * th : thresholdConfig->getThresholdVector( L1DataDef::MUON ) ) { + if ( th != nullptr ) { + ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric() ); + m_muonThresholds.push_back(th); + } + } return StatusCode::SUCCESS; } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// +StatusCode MURoIsUnpackingTool::finalize() { + return StatusCode::SUCCESS; +} -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// +StatusCode MURoIsUnpackingTool::unpack( const EventContext& ctx, + const ROIB::RoIBResult& roib, + const HLT::IDSet& activeChains ) const { + using namespace TrigCompositeUtils; + DecisionOutput decisionOutput; + auto trigRoIs = CxxUtils::make_unique< TrigRoiDescriptorCollection >(); + auto recRoIs = CxxUtils::make_unique< DataVector<LVL1::RecMuonRoI> >(); + + for ( auto& roi : roib.muCTPIResult().roIVec() ) { + const uint32_t roIWord = roi.roIWord(); + int thresholdNumber = roi.pt(); + if ( thresholdNumber < 1 or thresholdNumber > 6 ) { + ATH_MSG_WARNING( "Incorrect threshold number, should be between 1 and 6 but is: " + << thresholdNumber << ", force setting it to 1" ); + thresholdNumber = 1; + } + LVL1::RecMuonRoI* recRoI = new LVL1::RecMuonRoI(roIWord, m_recRpcRoISvc.get(), m_recTgcRoISvc.get(), &m_muonThresholds); + recRoIs->push_back(recRoI); + auto trigRoI = new TrigRoiDescriptor( roIWord, 0u ,0u, + recRoI->eta(), recRoI->eta()-m_roIWidth, recRoI->eta()+m_roIWidth, + recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth ); + trigRoIs->push_back( trigRoI ); + + ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << ", threshold pattern "); + + auto decision = TrigCompositeUtils::newDecisionIn( decisionOutput.decisions.get() ); + + for ( auto th: m_muonThresholds ) { + if ( th->thresholdNumber() <= thresholdNumber ) { // TODO vrify if here should be <= or < + // this code suggests <= https://gitlab.cern.ch/atlas/athena/blob/master/Trigger/TrigSteer/TrigSteering/src/Lvl1ResultAccessTool.cxx#L654 + addChainsToDecision( HLT::Identifier( th->name() ), decision, activeChains ); + } + } + } + + // recording + { + SG::WriteHandle<TrigRoiDescriptorCollection> handle(m_trigRoIsKey, ctx); + CHECK( handle.record( std::move(trigRoIs) ) ); + } + { + SG::WriteHandle<DataVector<LVL1::RecMuonRoI>> handle(m_recRoIsKey, ctx); + CHECK( handle.record( std::move(recRoIs) ) ); + } + CHECK( decisionOutput.record(m_decisionsKey, ctx) ); + return StatusCode::SUCCESS; +} -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// diff --git a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h index 637846a852e73d4f18bd6645ede0f24b37294367..773f77df9068d9b98a4fc480893a325c7a4a9149 100644 --- a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h @@ -4,24 +4,28 @@ #ifndef L1DECODER_MUROISUNPACKINGTOOL_H #define L1DECODER_MUROISUNPACKINGTOOL_H 1 -// STL includes + #include <string> +#include "TrigConfInterfaces/ILVL1ConfigSvc.h" +#include "TrigConfL1Data/ThresholdConfig.h" +#include "TrigConfL1Data/TriggerThreshold.h" + +#include "TrigT1Interfaces/RecMuonRoI.h" +#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" + -// FrameWork includes #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" +#include "TrigT1Interfaces/RecMuonRoI.h" +#include "TrigT1Interfaces/RecMuonRoiSvc.h" -// L1Decoder includes -#include "IRoIsUnpackingTool.h" - -// Forward declaration -class StoreGateSvc; +#include "IRoIsUnpackingTool.h" class MURoIsUnpackingTool : virtual public ::IRoIsUnpackingTool, - public ::AthAlgTool + public ::AthAlgTool { /////////////////////////////////////////////////////////////////// @@ -33,39 +37,31 @@ class MURoIsUnpackingTool /// Constructor with parameters: MURoIsUnpackingTool( const std::string& type, - const std::string& name, - const IInterface* parent ); + const std::string& name, + const IInterface* parent ); /// Destructor: virtual ~MURoIsUnpackingTool(); - + // Athena algtool's Hooks - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: + StatusCode initialize() override; + StatusCode beginRun(); + StatusCode finalize() override; + StatusCode unpack(const EventContext& ctx, + const ROIB::RoIBResult& roib, + const HLT::IDSet& activeChains) const override; +private: /// Default constructor: MURoIsUnpackingTool(); - - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - /// Pointer to the StoreGate service - StoreGateSvc_t m_storeGate; - - // Containers - + std::vector<TrigConf::TriggerThreshold*> m_muonThresholds; + SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey; + SG::WriteHandleKey< DataVector<LVL1::RecMuonRoI> > m_recRoIsKey; + ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc; + ServiceHandle<LVL1::RecMuonRoiSvc> m_recRpcRoISvc; + ServiceHandle<LVL1::RecMuonRoiSvc> m_recTgcRoISvc; + float m_roIWidth; }; // I/O operators diff --git a/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.cxx index dcbe1753dce2478ef19e103f8b27fc87d314cc78..c2eea8f961713c0fbf69e2e4b8256e03f949d7cf 100644 --- a/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.cxx @@ -1,9 +1,6 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// -// TAURoIsUnpackingTool.cxx -// Implementation file for class TAURoIsUnpackingTool -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ // L1Decoder includes #include "TAURoIsUnpackingTool.h" diff --git a/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx b/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx index 29aa6658482ca30ea1233a328981e1a8f00cdd53..d8e559e151899568d583b3d2f244f16ad64bc809 100644 --- a/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ #include "GaudiKernel/DeclareFactoryEntries.h" #include "../L1CaloDecoder.h" @@ -8,6 +11,7 @@ #include "../FakeCTP.h" #include "../CTPUnpackingTool.h" #include "../EMRoIsUnpackingTool.h" +#include "../MURoIsUnpackingTool.h" DECLARE_ALGORITHM_FACTORY(L1CaloDecoder) DECLARE_ALGORITHM_FACTORY(FakeRoI) @@ -17,15 +21,16 @@ DECLARE_ALGORITHM_FACTORY(L1Decoder) DECLARE_NAMESPACE_ALGORITHM_FACTORY( AthViews, FakeRoIView ) DECLARE_TOOL_FACTORY(CTPUnpackingTool) DECLARE_TOOL_FACTORY(EMRoIsUnpackingTool) +DECLARE_TOOL_FACTORY(MURoIsUnpackingTool) DECLARE_FACTORY_ENTRIES( L1Decoder ) { DECLARE_ALGORITHM(L1CaloDecoder) DECLARE_ALGORITHM(FakeRoI) - // DECLARE_ALGORITHM(RoIGraph) DECLARE_ALGORITHM(FakeCTP) - DECLARE_ALGORITHM(L1Decoder) + DECLARE_ALGORITHM(L1Decoder) DECLARE_NAMESPACE_ALGORITHM( AthViews, FakeRoIView ) - DECLARE_TOOL(CTPUnpackingTool) - DECLARE_TOOL(EMRoIsUnpackingTool) + DECLARE_TOOL(CTPUnpackingTool) + DECLARE_TOOL(EMRoIsUnpackingTool) + DECLARE_TOOL(MURoIsUnpackingTool) } diff --git a/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_load.cxx b/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_load.cxx index fd7aa8fc3ea34770b86ee1b6e3ee0ea720b93089..22f19fb64cba0ef2bd091c2e030c397d75e5abc8 100644 --- a/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_load.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_load.cxx @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ #include "GaudiKernel/LoadFactoryEntries.h" LOAD_FACTORY_ENTRIES( L1Decoder )