ATLAS Offline Software
Loading...
Searching...
No Matches
MuonRegSelCondAlg.cxx
Go to the documentation of this file.
1
13
14
15#include "GaudiKernel/EventIDRange.h"
17#include "MuonRegSelCondAlg.h"
18
19
20#include <iostream>
21#include <fstream>
22#include <string>
23
24
25
26MuonRegSelCondAlg::MuonRegSelCondAlg(const std::string& name, ISvcLocator* pSvcLocator):
27 AthCondAlgorithm( name, pSvcLocator ) {
28 ATH_MSG_DEBUG( "MuonRegSelCondAlg::MuonRegSelCondAlg() " << name );
29
30}
31
32
33
34
36{
37 ATH_MSG_DEBUG("MuonRegSelCondAlg::initialize() ");
38 ATH_CHECK(m_tableKey.initialize());
39 ATH_CHECK(m_detMgrKey.initialize());
40 ATH_MSG_INFO("MuonRegSelCondAlg::initialize() " << m_tableKey );
41 return StatusCode::SUCCESS;
42}
43
44
45
46StatusCode MuonRegSelCondAlg::execute(const EventContext& ctx ) const {
47 ATH_MSG_DEBUG("MuonRegSelCondAlg::execute() -- enter -- ");
48
50 ATH_MSG_DEBUG( "Creating region selector table " << m_tableKey );
51
52
54 if (lutCondData.isValid()) {
60 ATH_MSG_DEBUG("CondHandle " << lutCondData.fullKey() << " is already valid." );
61 return StatusCode::SUCCESS;
62 }
63
65
66 EventIDRange id_range;
67
68 std::unique_ptr<IRegSelLUT> rd = createTable( ctx, id_range );
69
70 if ( !rd ) return StatusCode::FAILURE;
71
72 ATH_MSG_DEBUG( "Initialising new map " );;
73
74 // write out new new LUT to a file if need be
75
76 if ( m_printTable ) {
77 if (const auto *lut = dynamic_cast<const RegSelSiLUT*>(rd.get())) {
78 lut->write( name()+".map" );
79 }
80 }
81
83
84 IRegSelLUTCondData* rcd = new IRegSelLUTCondData( std::move(rd) );
85
86 try {
91 if( lutCondData.record( id_range, rcd ).isFailure() ) {
92 ATH_MSG_ERROR( "Could not record " << m_tableKey
93 << " " << lutCondData.key()
94 << " with range " << id_range );
95 return StatusCode::FAILURE;
96 }
97 ATH_MSG_INFO( "RegSelCondAlg LUT recorded: " << m_tableKey);
98 }
99 catch (...) {
100 ATH_MSG_ERROR("MuonRegSelCondAlg::execute() failed to record table: " << m_tableKey);
101 return StatusCode::FAILURE;
102 }
103
104
105 ATH_MSG_DEBUG("MuonRegSelCondAlg::execute() -- exit -- ");
106
107 return StatusCode::SUCCESS;
108}
109
110
111
112
#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)
RegSelCondData< IRegSelLUT > IRegSelLUTCondData
emacs: this is -*- c++ -*-
Base class for conditions algorithms.
Gaudi::Property< bool > m_printTable
virtual std::unique_ptr< RegSelSiLUT > createTable(const EventContext &ctx, EventIDRange &id_range) const =0
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
MuonRegSelCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteCondHandleKey< IRegSelLUTCondData > m_tableKey
Output conditions object.
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const