ATLAS Offline Software
Loading...
Searching...
No Matches
EventTrigInfoFillerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi/Athena include(s):
7
8// Local include(s):
10
11using xAOD::EventInfo;
12
13namespace D3PD {
14
16 const std::string& name,
17 const IInterface* parent )
18 : BlockFillerTool< EventInfo >( type, name, parent ) {
19
20 declareProperty( "Streams", m_configStreams,
21 "Streams for which the decision should be stored" );
22
23 EventTrigInfoFillerTool::book().ignore(); // Avoid coverity warnings.
24 }
25
27
28 //
29 // Create boolean variables with the names of the streams in question:
30 //
31 m_streams.resize( m_configStreams.size(), 0 );
32 for( size_t i = 0; i < m_configStreams.size(); ++i ) {
33 CHECK( addVariable( "streamDecision_" + m_configStreams[ i ],
34 m_streams[ i ],
35 "Did this event end up in the '" + m_configStreams[ i ] +
36 "' stream?" ) );
37 }
38
39 CHECK( addVariable( "l1id", m_l1id, "Extended LVL1 ID" ) );
40
41 return StatusCode::SUCCESS;
42 }
43
44 StatusCode EventTrigInfoFillerTool::fill( const EventInfo& ei ) {
45
46 // Access the needed information:
47 const auto& stags = ei.streamTags();
48
49 // Set the flags according to the stream decisions:
50 for( size_t i = 0; i < m_configStreams.size(); ++i ) {
51 if( streamPassed( stags, m_configStreams[ i ] ) ) {
52 *( m_streams[ i ] ) = true;
53 } else {
54 *( m_streams[ i ] ) = false;
55 }
56 }
57
58 *m_l1id = ei.extendedLevel1ID();
59
60 return StatusCode::SUCCESS;
61 }
62
72 bool
73 EventTrigInfoFillerTool::streamPassed( const std::vector< EventInfo::StreamTag >& stags,
74 const std::string& sname ) {
75
76 //std::vector< TriggerInfo::StreamTag >::const_iterator itr = stags.begin();
77 //std::vector< TriggerInfo::StreamTag >::const_iterator end = stags.end();
78 //for( ; itr != end; ++itr ) {
79 for (const auto& itr : stags) {
80 if( itr.name() == sname ) return true;
81 }
82
83 return false;
84 }
85
86} // namespace D3PD
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Type-safe wrapper for block filler tools.
EventTrigInfoFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool constructor.
static bool streamPassed(const std::vector< xAOD::EventInfo::StreamTag > &stags, const std::string &sname)
Function deciding if a given stream was passed.
virtual StatusCode fill(const xAOD::EventInfo &ei)
Fill the variables for this block.
unsigned int * m_l1id
Variable: Extended level 1 ID.
std::vector< bool * > m_streams
Streams to which this event was written.
std::vector< std::string > m_configStreams
Streams for which the decision should be stored.
virtual StatusCode book()
Book variables for this block.
Block filler tool for noisy FEB information.
EventInfo_v1 EventInfo
Definition of the latest event info version.