ATLAS Offline Software
MuonRegSelCondAlg.cxx
Go to the documentation of this file.
1 
15 #include "GaudiKernel/EventIDRange.h"
17 #include "MuonRegSelCondAlg.h"
18 
19 
20 #include <iostream>
21 #include <fstream>
22 #include <string>
23 
24 
25 
26 MuonRegSelCondAlg::MuonRegSelCondAlg(const std::string& name, ISvcLocator* pSvcLocator):
27  AthReentrantAlgorithm( 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());
40  ATH_MSG_INFO("MuonRegSelCondAlg::initialize() " << m_tableKey );
41  return StatusCode::SUCCESS;
42 }
43 
44 
45 
46 StatusCode 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 
RegSelCondData
Definition: RegSelCondData.h:25
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonRegSelCondAlg.h
emacs: this is -*- c++ -*-
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition: WriteCondHandle.h:157
MuonRegSelCondAlg::m_detMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
Definition: MuonRegSelCondAlg.h:46
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition: WriteCondHandle.h:41
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
MuonRegSelCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: MuonRegSelCondAlg.cxx:46
WriteCondHandle.h
MuonRegSelCondAlg::MuonRegSelCondAlg
MuonRegSelCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MuonRegSelCondAlg.cxx:26
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonRegSelCondAlg::m_printTable
Gaudi::Property< bool > m_printTable
Definition: MuonRegSelCondAlg.h:51
MuonRegSelCondAlg::m_tableKey
SG::WriteCondHandleKey< IRegSelLUTCondData > m_tableKey
Output conditions object.
Definition: MuonRegSelCondAlg.h:56
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::WriteCondHandle::key
const std::string & key() const
Definition: WriteCondHandle.h:40
MuonRegSelCondAlg::initialize
virtual StatusCode initialize() override
Definition: MuonRegSelCondAlg.cxx:35
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SG::WriteCondHandle::isValid
bool isValid() const
Definition: WriteCondHandle.h:248
RegSelSiLUT
Definition: RegSelSiLUT.h:41
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
MuonRegSelCondAlg::createTable
virtual std::unique_ptr< RegSelSiLUT > createTable(const EventContext &ctx, EventIDRange &id_range) const =0
IRegSelLUTCondData
RegSelCondData< IRegSelLUT > IRegSelLUTCondData
Definition: IRegSelLUTCondData.h:20