14 #include "CoralBase/Attribute.h"
15 #include "CoralBase/AttributeListSpecification.h"
28 return StatusCode::SUCCESS;
37 if (writeCablingHandle.isValid()) {
38 ATH_MSG_DEBUG(
"CondHandle "<< writeCablingHandle.fullKey() <<
" is already valid."
39 <<
". In theory this should not be called, but may happen"
40 <<
" if multiple concurrent events are being processed out of order.");
41 return StatusCode::SUCCESS;
46 auto writeCdo{std::make_unique<RpcCablingMap>(
m_idHelperSvc.get())};
51 if (!in_json.good()) {
53 return StatusCode::FAILURE;
60 if (!coolHandle.isValid()) {
62 return StatusCode::FAILURE;
64 writeCablingHandle.addDependency(coolHandle);
65 for (
const auto& itr : **coolHandle) {
71 if (!writeCdo->finalize(msgStream()))
72 return StatusCode::FAILURE;
74 ATH_CHECK(writeCablingHandle.record(std::move(writeCdo)));
75 return StatusCode::SUCCESS;
84 std::map<unsigned, FlatCablePtr> readoutCards{};
85 for (
const auto& flatCable :
payload[
"readoutCards"].
items()) {
87 const unsigned id = cabl_payload[
"flatCableId"];
88 FlatCablePtr& newCard = readoutCards[
id];
89 newCard = std::make_unique<RpcFlatCableTranslator>(
id);
90 for (
const auto& pinAssign : cabl_payload[
"pinAssignment"]) {
91 const std::array<unsigned, 2> pin = pinAssign;
92 if (!newCard->mapChannels(pin[0], pin[1], msgStream())){
93 return StatusCode::FAILURE;
98 constexpr int8_t phiBit = CablingData::measPhiBit;
99 constexpr int8_t sideBit = CablingData::stripSideBit;
100 for (
const auto& cabl_chan :
payload[
"chamberMap"].
items()) {
102 CablingData cabl_data{};
103 const std::string stName{cabl_payload[
"station"]};
104 cabl_data.stationIndex =
m_idHelperSvc->rpcIdHelper().stationNameIndex(stName);
105 cabl_data.eta = cabl_payload[
"eta"];
106 cabl_data.phi = cabl_payload[
"phi"];
107 cabl_data.doubletR = cabl_payload[
"doubletR"];
108 cabl_data.doubletPhi = cabl_payload[
"doubletPhi"];
109 cabl_data.doubletZ = cabl_payload[
"doubletZ"];
110 const int8_t phiAndStrip = cabl_payload[
"measPhi"];
111 cabl_data.setMeasPhiAndSide(phiAndStrip & phiBit, phiAndStrip & sideBit);
112 cabl_data.gasGap = cabl_payload[
"gasGap"];
114 cabl_data.subDetector = cabl_payload[
"subDetector"];
115 cabl_data.tdcSector = cabl_payload[
"tdcSector"];
116 cabl_data.tdc = cabl_payload[
"tdc"];
117 cabl_data.firstStrip = cabl_payload[
"firstStrip"];
118 unsigned int flatCable = cabl_payload[
"flatCableId"];
119 if (!readoutCards[flatCable]) {
121 return StatusCode::FAILURE;
123 cabl_data.flatCable = readoutCards[flatCable];
124 if (!cabling_map.
insertChannels(std::move(cabl_data), msgStream())) {
125 return StatusCode::FAILURE;
128 return StatusCode::SUCCESS;