15 #include "GaudiKernel/ISvcLocator.h"
16 #include "GaudiKernel/IToolSvc.h"
17 #include "GaudiKernel/Bootstrap.h"
18 #include "GaudiKernel/ServiceHandle.h"
27 #ifndef SIMULATIONBASE
28 #ifndef GENERATIONBASE
44 std::vector<HWIdentifier> operator()(
HWIdentifier id)
const
46 return m_cablingTool->getLArElectrodeIDvec (
id);
52 SimIdFunc::SimIdFunc()
54 ToolHandle<LArHVCablingSimTool>
tool (
"LArHVCablingSimTool");
55 if (!
tool.retrieve().isSuccess()) {
58 m_cablingTool =
tool.get();
68 std::unique_ptr<EMECHVDescriptor> the_descriptor)
72 for(
int iSide=0; iSide<2; ++iSide) {
75 for(
int iSector=0; iSector<8; ++iSector) {
83 if (StatusCode::SUCCESS!=
detStore->retrieve(
elecId,
"LArElectrodeID")) {
84 throw std::runtime_error(
"EMECHVManager failed to retrieve LArElectrodeID");
87 if (StatusCode::SUCCESS!=
detStore->retrieve(
hvId,
"LArHVLineID")) {
88 throw std::runtime_error(
"EMECHVManager failed to retrieve LArHVLineID");
112 : m_payload (std::move (
payload))
120 if (
this != &
other) {
121 m_payload = std::move (
other.m_payload);
133 return voltage (electrode, iGap) >
INVALID;
139 return m_payload->m_payloadArray[
index(electrode)].voltage[iGap];
145 return m_payload->m_payloadArray[
index(electrode)].current[iGap];
151 return m_payload->m_payloadArray[
index(electrode)].hvLineNo[iGap];
159 unsigned int etaIndex =
module.getEtaIndex();
161 unsigned int sectorIndex =
module.getSectorIndex();
162 unsigned int sideIndex =
module.getSideIndex();
164 unsigned int index=0;
174 std::unique_ptr<EMECHVDescriptor> descriptor;
176 CellPartitioning etaBinning;
177 etaBinning.addValue(1.375);
178 etaBinning.addValue(1.50);
179 etaBinning.addValue(1.6);
180 etaBinning.addValue(1.8);
181 etaBinning.addValue(2.0);
182 etaBinning.addValue(2.1);
183 etaBinning.addValue(2.3);
184 etaBinning.addValue(2.5);
185 descriptor = std::make_unique<EMECHVDescriptor>(etaBinning,CellBinning(0.0, 2*
M_PI, 8),CellBinning(0,
M_PI/4.0,4));
188 CellPartitioning etaBinning;
189 etaBinning.addValue(2.5);
190 etaBinning.addValue(2.8);
191 etaBinning.addValue(3.2);
192 descriptor = std::make_unique<EMECHVDescriptor>(etaBinning,CellBinning(0.0, 2*
M_PI, 8),CellBinning(0,
M_PI/4.0,8));
194 m_c = std::make_unique<Clockwork> (
this, wheel, std::move(descriptor));
199 return *(
m_c->descriptor);
204 return m_c->descriptor->getPhiBinning().getFirstDivisionNumber();
209 return m_c->descriptor->getPhiBinning().getFirstDivisionNumber() +
m_c->descriptor->getPhiBinning().getNumDivisions();
214 return m_c->descriptor->getEtaBinning().getFirstDivisionNumber();
219 return m_c->descriptor->getEtaBinning().getFirstDivisionNumber() +
m_c->descriptor->getEtaBinning().getNumDivisions();
224 return *(
m_c->moduleArray[iSide][
iEta][
iPhi][iSector]);
242 return m_c->descriptor->getSectorBinning().getFirstDivisionNumber();
247 return m_c->descriptor->getSectorBinning().getFirstDivisionNumber() +
m_c->descriptor->getSectorBinning().getNumDivisions();
257 const std::vector<const CondAttrListCollection*>& attrLists)
const
259 auto payload = std::make_unique<EMECHVData::Payload>();
262 payload->m_payloadArray.reserve(2*7*8*4*24);
263 for (
unsigned int i=0;
i<10752;
i++) {
269 payload->m_payloadArray.reserve(2*2*8*8*4);
270 for (
unsigned int i=0;
i<1024;
i++) {
281 unsigned int chanID = (*citr).first;
282 int cannode = chanID/1000;
283 int line = chanID%1000;
289 std::vector<HWIdentifier> electrodeIdVec = idfunc(
id);
291 for(
size_t i=0;
i<electrodeIdVec.size();
i++) {
299 unsigned int etaIndex=
m_c->elecId->hv_eta(elecHWID);
303 unsigned int sideIndex=1-
m_c->elecId->zside(elecHWID);
304 unsigned int phiIndex=
m_c->elecId->module(elecHWID);
310 unsigned int sectorIndex=
m_c->elecId->hv_phi(elecHWID)-1;
314 else sectorIndex=7-sectorIndex;
317 m_c->elecId->electrode(elecHWID)%24:
318 m_c->elecId->electrode(elecHWID)%4;
322 else electrodeIndex=3-electrodeIndex;
326 5376*sideIndex+768*etaIndex+96*
phiIndex+24*sectorIndex+electrodeIndex:
327 512*sideIndex+256*(etaIndex-7)+32*
phiIndex+4*sectorIndex+electrodeIndex;
331 msg << MSG::ERROR <<
"invalid index outer " <<
index <<
" side,eta,phi,sector,electrode " << sideIndex <<
" " << etaIndex <<
" " <<
phiIndex <<
332 " " << sectorIndex <<
" " << electrodeIndex <<
endmsg;
337 msg << MSG::ERROR <<
"invalid index inner " <<
index <<
" side,eta,phi,sector,electrode " << sideIndex <<
" " << etaIndex <<
" " <<
phiIndex <<
338 " " << sectorIndex <<
" " << electrodeIndex <<
endmsg;
342 unsigned int gapIndex=
m_c->elecId->gap(elecHWID);
345 msg << MSG::ERROR <<
"invalid gapIndex " << gapIndex <<
endmsg;
348 if (sideIndex==0) gapIndex=1-gapIndex;
351 if (!((*citr).second)[
"R_VMEAS"].isNull()) voltage = ((*citr).second)[
"R_VMEAS"].data<float>();
353 if (!((*citr).second)[
"R_IMEAS"].isNull())
current = ((*citr).second)[
"R_IMEAS"].data<
float>();
356 payload->m_payloadArray[
index].voltage[gapIndex]=voltage;
358 payload->m_payloadArray[
index].hvLineNo[gapIndex]=chanID;
372 std::vector<const CondAttrListCollection*> attrLists;
376 if (
detStore->retrieve(atrlistcol,
"/LAR/DCS/HV/BARREl/I16").isSuccess()) {
377 attrLists.push_back (atrlistcol);
379 if (
detStore->retrieve(atrlistcol,
"/LAR/DCS/HV/BARREL/I8").isSuccess()) {
380 attrLists.push_back (atrlistcol);
382 return getData (SimIdFunc(), attrLists);
386 #if !(defined(SIMULATIONBASE) || defined(GENERATIONBASE))
389 const std::vector<const CondAttrListCollection*>& attrLists)
const
392 return getData (idfunc, attrLists);
402 int etaIndex =
module.getEtaIndex();
404 int sectorIndex =
module.getSectorIndex();
405 int sideIndex =
module.getSideIndex();
410 int id_zside = 1-sideIndex;
429 id_hv_phi=4-sectorIndex;
432 id_hv_phi=8-sectorIndex;
436 id_hv_phi=sectorIndex+1;
442 tmpElec = 23-electrodeIndex;
445 tmpElec = 3 - electrodeIndex;
449 tmpElec = electrodeIndex;
452 ? (id_hv_phi-1)*24 + tmpElec
453 : (id_hv_phi-1)*4 + tmpElec;
455 int id_gap = sideIndex==0 ? 1-
gap :
gap;
472 return m_c->hvId->can_node(
id)*1000 +
m_c->hvId->hv_line(
id);