ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExBasics
src
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
12
StatusCode
ReadTriggerDecision::initialize
() {
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
41
StatusCode
ReadTriggerDecision::finalize
() {
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_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ReadTriggerDecision.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
ReadTriggerDecision::finalize
virtual StatusCode finalize() override
Definition
ReadTriggerDecision.cxx:41
ReadTriggerDecision::m_triggerName
Gaudi::Property< std::string > m_triggerName
Name of the trigger to count.
Definition
ReadTriggerDecision.h:30
ReadTriggerDecision::m_trigDec
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
Tool handle for the trigger decision tool.
Definition
ReadTriggerDecision.h:34
ReadTriggerDecision::m_triggerCounter
std::atomic< unsigned int > m_triggerCounter
Integer counter for the requested trigger.
Definition
ReadTriggerDecision.h:32
ReadTriggerDecision::ReadTriggerDecision
ReadTriggerDecision(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ReadTriggerDecision.cxx:7
ReadTriggerDecision::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
ReadTriggerDecision.cxx:23
ReadTriggerDecision::initialize
virtual StatusCode initialize() override
Definition
ReadTriggerDecision.cxx:12
Generated on
for ATLAS Offline Software by
1.17.0