ATLAS Offline Software
Loading...
Searching...
No Matches
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
13
14#include "EventInfoReader.h"
15
16// Constructor with parameters:
17EventInfoReader::EventInfoReader(const std::string &name,
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() );
30 ATH_CHECK( m_eventInfoKey.initialize() );
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Test Algorithm for checking TagInfoMgr and the storing of geometry and conditions tags in EventInfo,...
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
virtual StatusCode initialize() override
Algorithm initialize at begin of job.
ServiceHandle< IGeoModelSvc > m_geoModel
Access to GeoModelSvc for tags.
virtual StatusCode execute() override
Algorithm execute once per event.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
SG key for Event Info.
ServiceHandle< ITagInfoMgr > m_tagInfoMgr
Access to TagInfoMgr for tags.
EventInfoReader()
Avoid use of default constructor.
virtual StatusCode finalize() override
Algorithm finalize at end of job.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ IS_SIMULATION
true: simulation, false: data