ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfoReaderAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// EDM include(s):
8
9// Local include(s):
10#include "EventInfoReaderAlg.h"
11
12namespace {
13
15 template< class T1, class T2 >
16 std::ostream& operator<< ( std::ostream& out,
17 const std::pair< T1, T2 >& p ) {
18
19 out << "{" << p.first << ", " << p.second << "}";
20 return out;
21 }
22
24 template< class T >
25 std::ostream& operator<< ( std::ostream& out,
26 const std::vector< T >& vec ) {
27
28 out << "[";
29 for( size_t i = 0; i < vec.size(); ++i ) {
30 out << vec[ i ];
31 if( i < ( vec.size() - 1 ) ) {
32 out << ", ";
33 }
34 }
35 out << "]";
36
37 return out;
38 }
39
40} // private namespace
41
42namespace xAODReader {
43
45 ISvcLocator* svcLoc )
46 : AthAlgorithm( name, svcLoc ) {
47
48 declareProperty( "SGKey", m_key = "EventInfo" );
49 }
50
52
53 // Greet the user:
54 ATH_MSG_INFO( "Initialising");
55
56 // Return gracefully:
57 return StatusCode::SUCCESS;
58 }
59
61
62 // Get the EventInfo object:
63 const xAOD::EventInfo* ei = nullptr;
64 ATH_CHECK( evtStore()->retrieve( ei, m_key ) );
65
66 // Basic info:
67 ATH_MSG_DEBUG( "runNumber = " << ei->runNumber() );
68 ATH_MSG_DEBUG( "eventNumber = " << ei->eventNumber() );
69 ATH_MSG_DEBUG( "lumiBlock = " << ei->lumiBlock() );
70 ATH_MSG_DEBUG( "timeStamp = " << ei->timeStamp() );
71 ATH_MSG_DEBUG( "timeStampNSOffset = " << ei->timeStampNSOffset() );
72 ATH_MSG_DEBUG( "bcid = " << ei->bcid() );
73 ATH_MSG_DEBUG( "detectorMask = " << ei->detectorMask() );
74
75 // Event type info:
76 ATH_MSG_DEBUG( "detDescrTags = " << ei->detDescrTags() );
77 ATH_MSG_DEBUG( "eventTypeBitmask ="
79 " IS_SIMULATION" : "" )
81 " IS_TESTBEAM" : "" )
83 " IS_CALIBRATION" : "" ) );
85 ATH_MSG_DEBUG( "mcChannelNumber = " << ei->mcChannelNumber() );
86 ATH_MSG_DEBUG( "mcEventNumber = " << ei->mcEventNumber() );
87 ATH_MSG_DEBUG( "mcEventWeights = " << ei->mcEventWeights() );
88 }
89
90 // Check if it has sub-events:
91 try {
92 const auto& subEvents = ei->subEvents();
93 int counter = 0;
94 for( const xAOD::EventInfo::SubEvent& se : subEvents ) {
95 ATH_MSG_DEBUG( "SubEvent #" << counter++ );
96 ATH_MSG_DEBUG( " time = " << se.time() );
97 ATH_MSG_DEBUG( " type = " << se.typeName() );
98 const xAOD::EventInfo* sei = se.ptr();
99 if( sei ) {
100 ATH_MSG_DEBUG( " runNumber = " << sei->runNumber() );
101 ATH_MSG_DEBUG( " eventNumber = " << sei->eventNumber() );
102 ATH_MSG_DEBUG( " bcid = " << sei->bcid() );
103 }
104 }
105 } catch( const std::exception& ) {
106 // Nope, it doesn't...
107 }
108
109 // Return gracefully:
110 return StatusCode::SUCCESS;
111 }
112
113} // namespace xAODReader
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::vector< size_t > vec
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual StatusCode initialize()
Function initialising the algorithm.
EventInfoReaderAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
std::string m_key
StoreGate key of the object to be tested.
virtual StatusCode execute()
Function executing the algorithm.
Class describing the properties of one pileup sub-event.
uint64_t mcEventNumber() const
The MC generator's event number.
const std::vector< float > & mcEventWeights() const
The weights of all the MC events used in the simulation.
uint32_t lumiBlock() const
The current event's luminosity block number.
bool eventType(EventType type) const
Check for one particular bitmask value.
uint32_t bcid() const
The bunch crossing ID of the event.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
@ IS_CALIBRATION
true: calibration, false: physics
@ IS_SIMULATION
true: simulation, false: data
@ IS_TESTBEAM
true: testbeam, false: full detector
uint32_t runNumber() const
The current event's run number.
uint32_t mcChannelNumber() const
The MC generator's channel number.
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
uint64_t eventNumber() const
The current event's event number.
uint64_t detectorMask() const
Bit field indicating which TTC zones are present in the event.
const DetDescrTags_t & detDescrTags() const
The detector description tags.
EventInfo_v1 EventInfo
Definition of the latest event info version.