ATLAS Offline Software
ReadTriggerDecision.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ReadTriggerDecision.h"
6 
7 ReadTriggerDecision::ReadTriggerDecision(const std::string &name, ISvcLocator *pSvcLocator)
8  : AthReentrantAlgorithm(name, pSvcLocator) {
9 }
10 
11 // Initialise: run once at the start of the event
13 
14  // Initialise the tool handle
15  ATH_CHECK(m_trigDec.retrieve());
16 
17  // Initialise counter
18  m_triggerCounter = 0;
19 
20  return StatusCode::SUCCESS;
21 }
22 
23 StatusCode ReadTriggerDecision::execute(const EventContext& /* ctx */) const {
24 
25  // Here we check whether the trigger named by the user fired for this event
26  // and increment the counter if it did.
27  if (m_trigDec->isPassed(m_triggerName)) ++m_triggerCounter;
28 
29  // One can get a list of all of the triggers available in the event
30  // by doing:
31  // const Trig::ChainGroup* chain = m_trigDec->getChainGroup("HLT.*");
32  // const std::vector<std::string> fired_triggers = chain->getListOfTriggers();
33  // See https://twiki.cern.ch/twiki/bin/viewauth/Atlas/TrigDecisionTool#Athena
34  // for more details
35 
36  return StatusCode::SUCCESS;
37 
38 }
39 
40 // Print the contents of the map
42  ATH_MSG_INFO("==========================");
43  ATH_MSG_INFO("SUMMARY OF TRIGGER COUNTS:");
44  ATH_MSG_INFO("==========================");
45  ATH_MSG_INFO("Trigger with name " << m_triggerName << " fired for " << std::to_string(m_triggerCounter) << " events");
46 
47  return StatusCode::SUCCESS;
48 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ReadTriggerDecision.h
ReadTriggerDecision::m_triggerCounter
std::atomic< unsigned int > m_triggerCounter
Integer counter for the requested trigger.
Definition: ReadTriggerDecision.h:32
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ReadTriggerDecision::m_triggerName
Gaudi::Property< std::string > m_triggerName
Name of the trigger to count.
Definition: ReadTriggerDecision.h:30
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ReadTriggerDecision::initialize
virtual StatusCode initialize() override
Definition: ReadTriggerDecision.cxx:12
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ReadTriggerDecision::finalize
virtual StatusCode finalize() override
Definition: ReadTriggerDecision.cxx:41
ReadTriggerDecision::m_trigDec
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
Tool handle for the trigger decision tool.
Definition: ReadTriggerDecision.h:34
ReadTriggerDecision::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: ReadTriggerDecision.cxx:23
ReadTriggerDecision::ReadTriggerDecision
ReadTriggerDecision(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ReadTriggerDecision.cxx:7