ATLAS Offline Software
LArHVIdMappingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArHVIdMappingAlg.h"
7 #include "CoralBase/Blob.h"
8 
13 
15 
16 #include <fstream>
17 
19 
20  ATH_MSG_DEBUG("initializing");
21 
22  // Read Handles
25 
26  return StatusCode::SUCCESS;
27 }
28 
29 
31  ATH_MSG_DEBUG("executing");
32 
34 
35  if (writeHandle.isValid()) {
36  ATH_MSG_DEBUG("Found valid write handle");
37  return StatusCode::SUCCESS;
38  }
39 
41  const AthenaAttributeList* attr{*readHandle};
42  writeHandle.addDependency(readHandle);
43 
44  if (!attr) {
45  ATH_MSG_WARNING( " Cannot find /LAR/IdentifierOfl/HVLineToElectrodeMap from database, Use ASCII file indeed !!!");
46  }
47 
48  const CaloCell_ID* calocellID = nullptr;
49  ATH_CHECK(detStore()->retrieve(calocellID,"CaloCell_ID"));
50 
51  const LArHVLineID* hvlineID = nullptr;
52  ATH_CHECK(detStore()->retrieve(hvlineID,"LArHVLineID"));
53 
54  const LArElectrodeID* electrodeID = nullptr;
55  ATH_CHECK(detStore()->retrieve(electrodeID,"LArElectrodeID"));
56 
57  std::unique_ptr<LArHVIdMapping> HVIdMap = std::make_unique<LArHVIdMapping>(calocellID, hvlineID, electrodeID);
58  std::map<HWIdentifier,HWIdentifier> &elecLineMap = HVIdMap->m_electrode_hvline_map; //basically a shorthand
59  std::map<HWIdentifier,std::vector<HWIdentifier> > &lineElecMap = HVIdMap->m_hvline_electrode_map;
60 
62  ATH_CHECK( reader.read (attr,
63  *hvlineID,
64  *electrodeID,
65  elecLineMap,
66  lineElecMap) );
67 
68 
69  if(writeHandle.record(std::move(HVIdMap)).isFailure()) {
70  ATH_MSG_ERROR("Could not record LArCalibLineMapping object with "
71  << writeHandle.key()
72  << " with EventRange " << writeHandle.getRange()
73  << " into Conditions Store");
74  return StatusCode::FAILURE;
75  }
76 
77  ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << writeHandle.getRange() << " into Conditions Store");
78 
79 
80  return StatusCode::SUCCESS;
81 }
82 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArHVIdMapping::m_electrode_hvline_map
std::map< HWIdentifier, HWIdentifier > m_electrode_hvline_map
Definition: LArHVIdMapping.h:64
LArHVIdMappingAlg::execute
virtual StatusCode execute() override
Definition: LArHVIdMappingAlg.cxx:30
LArHVIdMappingAlg.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArHVIdMapping::m_hvline_electrode_map
std::map< HWIdentifier, std::vector< HWIdentifier > > m_hvline_electrode_map
Definition: LArHVIdMapping.h:65
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition: LArElectrodeID.h:101
LArHVLineID.h
AthenaAttributeList.h
LArHVIdMappingReader
Helper to read HV ID mapping data from a file or conditions.
Definition: LArHVIdMappingReader.h:33
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArHVIdMappingAlg::m_writeKey
SG::WriteCondHandleKey< LArHVIdMapping > m_writeKey
Definition: LArHVIdMappingAlg.h:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArHVIdMappingReader.h
Helper to read HV ID mapping data from a file or conditions.
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
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
PathResolver.h
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArHVIdMappingAlg::m_readKey
SG::ReadCondHandleKey< AthenaAttributeList > m_readKey
Definition: LArHVIdMappingAlg.h:26
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArHVIdMappingAlg::initialize
virtual StatusCode initialize() override
Definition: LArHVIdMappingAlg.cxx:18
LArElectrodeID.h
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
LArHVLineID
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition: LArHVLineID.h:48