ATLAS Offline Software
Loading...
Searching...
No Matches
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
23 ATH_CHECK( m_readKey.initialize() );
24 ATH_CHECK( m_writeKey.initialize() );
25
26 return StatusCode::SUCCESS;
27}
28
29
30StatusCode LArHVIdMappingAlg::execute(const EventContext& ctx) const {
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helper to read HV ID mapping data from a file or conditions.
const ServiceHandle< StoreGateSvc > & detStore() const
An AttributeList represents a logical row of attributes in a metadata table.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
Helper for the Liquid Argon Calorimeter cell at the electrode level.
SG::WriteCondHandleKey< LArHVIdMapping > m_writeKey
SG::ReadCondHandleKey< AthenaAttributeList > m_readKey
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
Helper to read HV ID mapping data from a file or conditions.
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition LArHVLineID.h:43
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED