ATLAS Offline Software
LArRoIMapCondAlg.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
3  */
12 #include "LArRoIMapCondAlg.h"
20 #include <fstream>
21 #include <vector>
22 
23 
28 {
34 
35  ATH_CHECK( m_ttSvc.retrieve() );
36 
40 
41  return StatusCode::SUCCESS;
42 }
43 
44 
48 StatusCode LArRoIMapCondAlg::execute (const EventContext& ctx) const
49 {
51  if (writeHandle.isValid()) {
52  return StatusCode::SUCCESS;
53  }
54  auto larRoIMap = std::make_unique<LArRoIMap> (100);
55 
58 
59  for (const Identifier& id : m_em_id->channel_ids()) {
60  ATH_CHECK( addEntry (*larRoIMap, **onOffId, **febRod, id) );
61  }
62 
63  for (const Identifier& id : m_hec_id->channel_ids()) {
64  ATH_CHECK( addEntry (*larRoIMap, **onOffId, **febRod, id) );
65  }
66 
67  for (const Identifier& id : m_fcal_id->channel_ids()) {
68  ATH_CHECK( addEntry (*larRoIMap, **onOffId, **febRod, id) );
69  }
70 
71  writeHandle.addDependency (onOffId);
72  writeHandle.addDependency (febRod);
73  ATH_CHECK( writeHandle.record (std::move (larRoIMap)) );
74  ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << writeHandle.getRange() << " into Conditions Store");
75  return StatusCode::SUCCESS;
76 }
77 
78 
80  const LArOnOffIdMapping& onOffId,
81  const LArFebRodMapping& febRod,
82  const Identifier& id) const
83 {
84  HWIdentifier sigId = onOffId.createSignalChannelID (id);
85  Identifier rId = m_ttSvc->whichTTID (id);
86  IdentifierHash hashid;
87  IdContext layer_context = m_TT_ID->layer_context();
88  if (m_TT_ID->get_hash (rId, hashid, &layer_context) != 0) {
89  ATH_MSG_ERROR ("Failed to get TT hash");
90  return StatusCode::FAILURE;
91  }
92  HWIdentifier febId = m_onlineID->feb_Id(sigId);
93  const HWIdentifier& robId = febRod.getReadoutModuleID (febId);
94  m.addEntry (id, sigId, robId, hashid);
95  return StatusCode::SUCCESS;
96 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArFebRodMapping
Definition: LArFebRodMapping.h:17
LArEM_ID.h
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArFebRodMapping::getReadoutModuleID
HWIdentifier getReadoutModuleID(const HWIdentifier &id) const
Definition: LArFebRodMapping.cxx:15
LArRoIMapCondAlg::m_febRodKey
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodKey
Definition: LArRoIMapCondAlg.h:73
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition: WriteCondHandle.h:89
CaloTTDescriptor.h
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition: WriteCondHandle.h:157
HWIdentifier
Definition: HWIdentifier.h:13
CaloLVL1_ID::layer_context
IdContext layer_context(void) const
access to IdContext's which define which levels of fields are contained in the id
Definition: CaloLVL1_ID.cxx:61
ReadCondHandle.h
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArRoIMapCondAlg::m_hec_id
const LArHEC_ID * m_hec_id
Definition: LArRoIMapCondAlg.h:64
LArRoIMapCondAlg::m_onOffIdKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdKey
Definition: LArRoIMapCondAlg.h:71
LArRoIMapCondAlg::m_TT_ID
const CaloLVL1_ID * m_TT_ID
Definition: LArRoIMapCondAlg.h:61
LArRoIMapCondAlg::m_ttSvc
ToolHandle< CaloTriggerTowerService > m_ttSvc
Definition: LArRoIMapCondAlg.h:68
LArRoIMapCondAlg::addEntry
StatusCode addEntry(LArRoIMap &m, const LArOnOffIdMapping &onOffId, const LArFebRodMapping &febRod, const Identifier &id) const
Definition: LArRoIMapCondAlg.cxx:79
LArFCAL_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide acces to channel id vector, accessed via hash
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloTTDescrManager.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
WriteCondHandle.h
CaloLVL1_ID::get_hash
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
create hash id from compact id (return == 0 for OK)
Definition: CaloLVL1_ID.cxx:144
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArRoIMapCondAlg::m_fcal_id
const LArFCAL_ID * m_fcal_id
Definition: LArRoIMapCondAlg.h:65
LArOnOffIdMapping::createSignalChannelID
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
Definition: LArOnOffIdMapping.h:126
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1479
LArRoIMapCondAlg::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArRoIMapCondAlg.h:62
LArRoIMapCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi execute method.
Definition: LArRoIMapCondAlg.cxx:48
SG::WriteCondHandle::key
const std::string & key() const
Definition: WriteCondHandle.h:40
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArRoIMapCondAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition: LArRoIMapCondAlg.cxx:27
CaloLVL1_ID.h
LArRoIMapCondAlg.h
Conditions algorithm producing LArRoIMap.
LArRoIMapCondAlg::m_em_id
const LArEM_ID * m_em_id
Definition: LArRoIMapCondAlg.h:63
LArRoIMap
Mapping between calorimeter trigger id to offline/online Identifier.
Definition: LArRoIMap.h:31
SG::WriteCondHandle::isValid
bool isValid() const
Definition: WriteCondHandle.h:248
LArEM_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
LArHEC_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
LArRoIMapCondAlg::m_LArRoIMapKey
SG::WriteCondHandleKey< LArRoIMap > m_LArRoIMapKey
Definition: LArRoIMapCondAlg.h:75
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
LArOnlineID.h
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275
Identifier
Definition: IdentifierFieldParser.cxx:14