ATLAS Offline Software
TrigDecisionMakerMT.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 /**************************************************************************
8  **
9  ** File: TrigDecisionMakerMT.h
10  **
11  ** Description: - Re-entrant algorithm-derived class to run after the Steering
12  ** - Finds the list of defined chains at initialization
13  ** - For each event:
14  ** * Creates a xAODTriggerDecision object
15  ** * Fills it with the outcome of each defined chain
16  ** * Output to StoreGate via writehandle written to ESD/AOD
17  **
18  * @author Tim Martin <Tim.Martin@cern.ch> - University of Warwick
19  **
20  ** Created: 16 July 2018
21  **
22  **************************************************************************/
23 #ifndef TrigDecisionMaker_TrigDecisionMakerMT_H
24 #define TrigDecisionMaker_TrigDecisionMakerMT_H
25 
27 #include "GaudiKernel/ServiceHandle.h"
28 #include "GaudiKernel/ToolHandle.h"
29 
32 #include "xAODTrigger/CTPResult.h"
33 
39 #include "TrigConfData/HLTMenu.h"
40 
41 // containers
42 #include <vector>
43 #include <string>
44 
45 namespace LVL1CTP {
46  class Lvl1Result;
47 }
48 
49 namespace TrigDec {
50 
64  {
65 
66  public:
67 
68  TrigDecisionMakerMT(const std::string &name, ISvcLocator *pSvcLocator);
70 
71  // IAlgorithm virtual methods to implement
72  virtual StatusCode initialize() override;
73  virtual StatusCode execute( const EventContext& context ) const override;
74  virtual StatusCode finalize() override;
75 
76  private:
77 
78  StatusCode getL1Result (const LVL1CTP::Lvl1Result*& result, const EventContext& context) const;
79 
80  Gaudi::Property<bool> m_doL1{this, "doL1", true, "Read L1 trigger information"};
81  Gaudi::Property<bool> m_doHLT{this, "doHLT", true, "Read HLT trigger information"};
82  Gaudi::Property<bool> m_useEDMxAOD{this, "UseEDMxAOD", false, "Flag whether to use xAOD::CTPResult instead of ROIB::RoIBResult for CTP result"};
83 
84  // Tools & services
85  ToolHandle<HLT::ILvl1ResultAccessTool> m_lvl1Tool{this, "Lvl1ResultAccessTool", "HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool", "L1 tool to fetch"};
86 
87  ToolHandle<ITriggerBitsMakerTool> m_bitsMakerTool{this, "BitsMakerTool", "", "Tool to create trigger bits for MC"};
88 
89  // Input keys configuration
90  SG::ReadCondHandleKey<TrigConf::L1BunchGroupSet> m_bgKey{this, "L1BunchGroup", "L1BunchGroup", "L1BunchGroupSet key name"};
91  SG::ReadHandleKey<TrigConf::HLTMenu> m_HLTMenuKey{this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "HLT Menu key"};
92 
93  SG::ReadHandleKey<HLT::HLTResultMT> m_hltResultKeyIn {this, "HLTResultMT", "HLTResultMT", "Key of the HLTResultMT object to get bits from online bytestream" };
94  SG::ReadHandleKey<ROIB::RoIBResult> m_ROIBResultKeyIn {this, "RoIBResult", "RoIBResult", "RoIB Result Object Key"};
95  SG::ReadHandleKey<xAOD::CTPResult> m_CTPResultKeyIn{this, "CTPResult", "CTPResult", "Key to retrieve the L1 xAOD CTP result from SG" };
96  SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKeyIn {this, "EventInfo", "EventInfo", "Event Info Object Key"};
97 
98  // Output configuration
99  SG::WriteHandleKey<LVL1CTP::Lvl1Result> m_l1ResultKeyOut{ this, "L1Result", "L1Result", "L1 result"};
100  SG::WriteHandleKey<xAOD::TrigDecision> m_trigDecisionKeyOut {this, "TrigDecisionKey", "xTrigDecision", "Output trigger decision object key"};
101 
102  // For statistics
103  mutable std::atomic<uint32_t> m_nEvents{0}, m_l1Passed{0}, m_hltPassed{0};
104  };
105 }
106 
107 #endif
TrigDec
Definition: ITrigDecisionCnvTool.h:18
TrigDec::TrigDecisionMakerMT::m_l1Passed
std::atomic< uint32_t > m_l1Passed
Definition: TrigDecisionMakerMT.h:103
TrigDec::TrigDecisionMakerMT::m_bgKey
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet > m_bgKey
Definition: TrigDecisionMakerMT.h:90
CTPResult.h
get_generator_info.result
result
Definition: get_generator_info.py:21
TrigDec::TrigDecisionMakerMT::m_CTPResultKeyIn
SG::ReadHandleKey< xAOD::CTPResult > m_CTPResultKeyIn
Definition: TrigDecisionMakerMT.h:95
TrigDecision.h
ITriggerBitsMakerTool.h
TrigDec::TrigDecisionMakerMT::m_ROIBResultKeyIn
SG::ReadHandleKey< ROIB::RoIBResult > m_ROIBResultKeyIn
Definition: TrigDecisionMakerMT.h:94
TrigDec::TrigDecisionMakerMT::execute
virtual StatusCode execute(const EventContext &context) const override
Re-entrant execute to create the xAOD::TrigDecision.
Definition: TrigDecisionMakerMT.cxx:81
RoIBResult.h
TrigDec::TrigDecisionMakerMT::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: TrigDecisionMakerMT.h:91
SG::ReadHandleKey< TrigConf::HLTMenu >
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
ILvl1ResultAccessTool.h
TrigDec::TrigDecisionMakerMT::~TrigDecisionMakerMT
~TrigDecisionMakerMT()
std deconstructor
Definition: TrigDecisionMakerMT.cxx:32
TrigDec::TrigDecisionMakerMT::finalize
virtual StatusCode finalize() override
std Gaudi finalize method -> print out statistics
Definition: TrigDecisionMakerMT.cxx:67
SG::WriteHandleKey< LVL1CTP::Lvl1Result >
TrigDec::TrigDecisionMakerMT::m_bitsMakerTool
ToolHandle< ITriggerBitsMakerTool > m_bitsMakerTool
Definition: TrigDecisionMakerMT.h:87
TrigDec::TrigDecisionMakerMT::m_useEDMxAOD
Gaudi::Property< bool > m_useEDMxAOD
Definition: TrigDecisionMakerMT.h:82
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigDec::TrigDecisionMakerMT::getL1Result
StatusCode getL1Result(const LVL1CTP::Lvl1Result *&result, const EventContext &context) const
retrieve LVL1 result (called in execute)
Definition: TrigDecisionMakerMT.cxx:231
TrigDec::TrigDecisionMakerMT::m_doL1
Gaudi::Property< bool > m_doL1
Definition: TrigDecisionMakerMT.h:80
TrigDec::TrigDecisionMakerMT::initialize
virtual StatusCode initialize() override
std Gaudi initialize method -> read-in trigger configuration
Definition: TrigDecisionMakerMT.cxx:35
TrigDec::TrigDecisionMakerMT::m_doHLT
Gaudi::Property< bool > m_doHLT
Definition: TrigDecisionMakerMT.h:81
AthReentrantAlgorithm.h
L1BunchGroupSet.h
TrigDec::TrigDecisionMakerMT::m_lvl1Tool
ToolHandle< HLT::ILvl1ResultAccessTool > m_lvl1Tool
tool to ease the access to the L1 results (RoIs, items, etc)
Definition: TrigDecisionMakerMT.h:85
TrigDec::TrigDecisionMakerMT::m_trigDecisionKeyOut
SG::WriteHandleKey< xAOD::TrigDecision > m_trigDecisionKeyOut
Definition: TrigDecisionMakerMT.h:100
LVL1CTP::Lvl1Result
Definition: Lvl1Result.h:32
TrigDec::TrigDecisionMakerMT::m_nEvents
std::atomic< uint32_t > m_nEvents
Definition: TrigDecisionMakerMT.h:103
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EventInfo.h
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet >
TrigDec::TrigDecisionMakerMT
Definition: TrigDecisionMakerMT.h:64
HLTResultMT.h
TrigDec::TrigDecisionMakerMT::m_hltResultKeyIn
SG::ReadHandleKey< HLT::HLTResultMT > m_hltResultKeyIn
Definition: TrigDecisionMakerMT.h:93
HLTMenu.h
LVL1CTP
Definition: Lvl1ResultAccessTool.h:20
TrigDec::TrigDecisionMakerMT::m_hltPassed
std::atomic< uint32_t > m_hltPassed
Definition: TrigDecisionMakerMT.h:103
TrigDec::TrigDecisionMakerMT::TrigDecisionMakerMT
TrigDecisionMakerMT(const std::string &name, ISvcLocator *pSvcLocator)
std Gaudi Algorithm constructor
Definition: TrigDecisionMakerMT.cxx:28
TrigDec::TrigDecisionMakerMT::m_l1ResultKeyOut
SG::WriteHandleKey< LVL1CTP::Lvl1Result > m_l1ResultKeyOut
Definition: TrigDecisionMakerMT.h:99
TrigDec::TrigDecisionMakerMT::m_EventInfoKeyIn
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKeyIn
Definition: TrigDecisionMakerMT.h:96