15#include "CoralBase/Attribute.h"
16#include "CoralBase/AttributeListSpecification.h"
20#include "nlohmann/json.hpp"
24 ISvcLocator* pSvcLocator)
32 return StatusCode::SUCCESS;
41 <<
". In theory this should not be called, but may happen"
42 <<
" if multiple concurrent events are being processed out of order.");
43 return StatusCode::SUCCESS;
47 std::unique_ptr<Nsw_CablingMap> writeCdo{std::make_unique<Nsw_CablingMap>(
m_idHelperSvc.get())};
54 return StatusCode::FAILURE;
56 std::string payload{};
57 while (std::getline(
inf, payload)) {
67 ATH_MSG_FATAL(
"Failed to retrieve the cabling data from the database "
69 return StatusCode::FAILURE;
74 <<
" readCdo->size()= " << readHandle->size());
76 <<
", range of output is " << writeHandle.
getRange());
80 for(itr = readHandle->begin(); itr != readHandle->end(); ++itr) {
81 const coral::AttributeList& atr = itr->second;
82 std::string payload = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
91 <<
" into Conditions Store");
92 return StatusCode::SUCCESS;
99 return StatusCode::SUCCESS;
100 nlohmann::json payload = nlohmann::json::parse(theJSON);
103 for (
const auto& db_channel : payload.items()) {
104 nlohmann::json cabling_payload = db_channel.value();
106 std::string stName = cabling_payload[
"station"];
107 const int eta = cabling_payload[
"eta"];
108 const int phi = cabling_payload[
"phi"];
109 const int multilayer = cabling_payload[
"multilayer"];
110 const int gap = cabling_payload[
"gasgap"];
113 if (stName[0] ==
'M') {
116 const int chType{cabling_payload[
"channeltype"]};
121 << stName <<
" eta: " <<
eta <<
" phi: " <<
phi
122 <<
" multilayer: " << multilayer
123 <<
" gasgap: " << gap);
124 return StatusCode::FAILURE;
128 zebra_connector.
firstChannel = cabling_payload[
"FirstZebra"];
129 zebra_connector.
lastChannel = cabling_payload[
"LastZebra"];
130 zebra_connector.
shiftChannel = cabling_payload[
"ZebraShift"];
131 if (!cabling_map.
addConnector(gap_id, zebra_connector, msgStream()))
132 return StatusCode::FAILURE;
134 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
sTgcIdHelper::sTgcChannelTypes chType
An algorithm that can be simultaneously executed in multiple threads.
ChanAttrListMap::const_iterator const_iterator
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Gaudi::Property< std::string > m_JSONFile
StatusCode loadCablingSchema(const std::string &payload, Nsw_CablingMap &cabling_map) const
MuonNSW_CablingAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_readCablingKeys
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteCondHandleKey< Nsw_CablingMap > m_writeKey
virtual StatusCode initialize() override
bool addConnector(const Identifier &gapID, const NswZebraData &connector, MsgStream &msg)
const DataObjID & fullKey() const
const EventIDRange & getRange()
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
const DataObjID & fullKey() const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const