ATLAS Offline Software
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 
12 namespace {
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 
42 namespace 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
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
EventInfoReaderAlg.h
xAODReader::EventInfoReaderAlg::m_key
std::string m_key
StoreGate key of the object to be tested.
Definition: EventInfoReaderAlg.h:43
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAOD::EventInfo_v1::mcEventWeights
const std::vector< float > & mcEventWeights() const
The weights of all the MC events used in the simulation.
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::EventInfo_v1::IS_CALIBRATION
@ IS_CALIBRATION
true: calibration, false: physics
Definition: EventInfo_v1.h:155
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
xAOD::EventInfo_v1::timeStampNSOffset
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
xAODReader::EventInfoReaderAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: EventInfoReaderAlg.cxx:51
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
xAOD::EventInfo_v1::mcChannelNumber
uint32_t mcChannelNumber() const
The MC generator's channel number.
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
calibdata.exception
exception
Definition: calibdata.py:496
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::EventInfo_v1::detectorMask
uint64_t detectorMask() const
Bit field indicating which TTC zones are present in the event.
Definition: EventInfo_v1.cxx:143
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition: TestGaudiProperty.cxx:69
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::EventInfo_v1::detDescrTags
const DetDescrTags_t & detDescrTags() const
The detector description tags.
xAODReader::EventInfoReaderAlg::EventInfoReaderAlg
EventInfoReaderAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: EventInfoReaderAlg.cxx:44
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
xAODReader::EventInfoReaderAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: EventInfoReaderAlg.cxx:60
xAOD::EventInfo_v1::subEvents
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
Definition: EventInfo_v1.cxx:596
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
test_pyathena.counter
counter
Definition: test_pyathena.py:15
xAOD::EventInfo_v1::IS_TESTBEAM
@ IS_TESTBEAM
true: testbeam, false: full detector
Definition: EventInfo_v1.h:153
xAOD::EventInfo_v1::SubEvent
Class describing the properties of one pileup sub-event.
Definition: EventInfo_v1.h:286
xAOD::EventInfo_v1::mcEventNumber
uint64_t mcEventNumber() const
The MC generator's event number.
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.
xAODReader
Definition: BTaggingReader.cxx:21