ATLAS Offline Software
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 
11 using xAOD::EventInfo;
12 
13 namespace D3PD {
14 
16  const std::string& name,
17  const IInterface* 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 
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
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition: IEventInfoCnvTool.h:17
D3PD::EventTrigInfoFillerTool::streamPassed
static bool streamPassed(const std::vector< xAOD::EventInfo::StreamTag > &stags, const std::string &sname)
Function deciding if a given stream was passed.
Definition: EventTrigInfoFillerTool.cxx:73
D3PD::EventTrigInfoFillerTool::book
virtual StatusCode book()
Book variables for this block.
Definition: EventTrigInfoFillerTool.cxx:26
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition: AddVariable.cxx:85
D3PD::EventTrigInfoFillerTool::m_l1id
unsigned int * m_l1id
Variable: Extended level 1 ID.
Definition: EventTrigInfoFillerTool.h:61
D3PD::EventTrigInfoFillerTool::EventTrigInfoFillerTool
EventTrigInfoFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool constructor.
Definition: EventTrigInfoFillerTool.cxx:15
D3PD::EventTrigInfoFillerTool::fill
virtual StatusCode fill(const xAOD::EventInfo &ei)
Fill the variables for this block.
Definition: EventTrigInfoFillerTool.cxx:44
EventTrigInfoFillerTool.h
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
D3PD::EventTrigInfoFillerTool::m_streams
std::vector< bool * > m_streams
Streams to which this event was written.
Definition: EventTrigInfoFillerTool.h:55
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
D3PD::EventTrigInfoFillerTool::m_configStreams
std::vector< std::string > m_configStreams
Streams for which the decision should be stored.
Definition: EventTrigInfoFillerTool.h:58
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition: BlockFillerTool.h:68
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:42
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15