ATLAS Offline Software
EventInfoReader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 #include "EventInfoReader.h"
15 
16 // Constructor with parameters:
18  ISvcLocator *pSvcLocator) :
19  AthAlgorithm(name,pSvcLocator),
20  m_geoModel("GeoModelSvc", name),
21  m_tagInfoMgr("TagInfoMgr", name)
22 {}
23 
24 // Initialize method:
26 {
27  ATH_MSG_INFO( "EventInfoReader::initialize()" );
28  ATH_CHECK( m_geoModel.retrieve() );
29  ATH_CHECK( m_tagInfoMgr.retrieve() );
31  return StatusCode::SUCCESS;
32 }
33 
34 // Execute method:
36 {
37  ATH_MSG_DEBUG("EventInfoReader::execute()" );
38 
39  SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, getContext());
40  if(!eventInfo.isValid()) {
41  ATH_MSG_ERROR(" Could not get event info");
42  return StatusCode::FAILURE;
43  }
44 
45  ATH_MSG_DEBUG( "Event ID: ["
46  << eventInfo->runNumber() << ","
47  << eventInfo->eventNumber() << ":"
48  << eventInfo->timeStamp() << "] " );
49  ATH_MSG_DEBUG( "Event type: IS_SIMULATION " << std::boolalpha
50  << eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION) << " weight "
51  << eventInfo->mcEventWeight() );
52 
53 
54  // Print out the tags found
55  ATH_MSG_DEBUG("Tag pairs from EventInfo: " );
56  for (const auto& ddTag : eventInfo->detDescrTags() ) {
57  ATH_MSG_DEBUG( ddTag.first << " : " << ddTag.second);
58  }
59 
60  // Dump out Tags
61  ATH_MSG_DEBUG("Tags from TagInfoMgr:");
62  ATH_MSG_DEBUG( m_tagInfoMgr->dumpTagInfoToStr() );
63 
64  // Print out current Release version
65  std::string releaseVersion = m_tagInfoMgr->findTag("AtlasRelease");
66  ATH_MSG_DEBUG("Found Release version from TagInfoMgr: " << releaseVersion);
67 
68  return StatusCode::SUCCESS;
69 }
70 
71 
72 // Finalize method:
74 {
75  ATH_MSG_INFO("EventInfoReader::finalize()" );
76  return StatusCode::SUCCESS;
77 }
78 
79 
EventInfoReader::initialize
virtual StatusCode initialize() override
Algorithm initialize at begin of job.
Definition: EventInfoReader.cxx:25
EventInfoReader::m_geoModel
ServiceHandle< IGeoModelSvc > m_geoModel
Access to GeoModelSvc for tags.
Definition: EventInfoReader.h:69
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.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
EventInfoReader.h
Test Algorithm for checking TagInfoMgr and the storing of geometry and conditions tags in EventInfo,...
EventInfoReader::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
SG key for Event Info.
Definition: EventInfoReader.h:73
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.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
EventInfoReader::execute
virtual StatusCode execute() override
Algorithm execute once per event.
Definition: EventInfoReader.cxx:35
EventInfoReader::EventInfoReader
EventInfoReader()
Avoid use of default constructor.
xAOD::EventInfo_v1::detDescrTags
const DetDescrTags_t & detDescrTags() const
The detector description tags.
EventInfoReader::m_tagInfoMgr
ServiceHandle< ITagInfoMgr > m_tagInfoMgr
Access to TagInfoMgr for tags.
Definition: EventInfoReader.h:71
EventInfoReader::finalize
virtual StatusCode finalize() override
Algorithm finalize at end of job.
Definition: EventInfoReader.cxx:73
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
xAOD::EventInfo_v1::mcEventWeight
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
Definition: EventInfo_v1.cxx:203
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.