8 #include "GeoModelKernel/CellBinning.h" 
   14 #include "GaudiKernel/ISvcLocator.h" 
   15 #include "GaudiKernel/IToolSvc.h" 
   16 #include "GaudiKernel/Bootstrap.h" 
   17 #include "GaudiKernel/ServiceHandle.h" 
   26 #ifndef SIMULATIONBASE 
   27 #ifndef GENERATIONBASE 
   45     return m_cablingTool->getLArElectrodeIDvec (
id);
 
   51 SimIdFunc::SimIdFunc()
 
   53   ToolHandle<LArHVCablingSimTool> 
tool (
"LArHVCablingSimTool");
 
   54   if (!
tool.retrieve().isSuccess()) {
 
   57   m_cablingTool = 
tool.get();
 
   67     for(
int iSide=0; iSide<2; ++iSide) {
 
   70       for(
int iSector=0; iSector<2; ++iSector) {
 
   78     if (StatusCode::SUCCESS!=
detStore->retrieve(
elecId, 
"LArElectrodeID")) {
 
   79       throw std::runtime_error(
"EMBHVManager failed to retrieve LArElectrodeID");
 
   82     if (StatusCode::SUCCESS!=
detStore->retrieve(
hvId,
"LArHVLineID")) {
 
   83       throw std::runtime_error(
"EMBHVManager failed to retrieve LArHVLineID");
 
  106   : m_payload (std::move (
payload))
 
  113   if (
this != &
other) {
 
  114     m_payload = std::move (
other.m_payload);
 
  126   return voltage (electrode, iGap) > 
INVALID;
 
  132   return m_payload->m_payloadArray[
index(electrode)].voltage[iGap];
 
  138   return m_payload->m_payloadArray[
index(electrode)].current[iGap];
 
  144   return m_payload->m_payloadArray[
index(electrode)].hvLineNo[iGap];
 
  152   unsigned int etaIndex          = 
module.getEtaIndex();
 
  154   unsigned int sectorIndex       = 
module.getSectorIndex();
 
  155   unsigned int sideIndex         = 
module.getSideIndex();
 
  156   unsigned int index             = 8192*sideIndex+1024*etaIndex+64*
phiIndex+32*sectorIndex+electrodeIndex;
 
  171   return m_c->descriptor;
 
  176   return m_c->descriptor.getPhiBinning().getFirstDivisionNumber();
 
  181   return m_c->descriptor.getPhiBinning().getFirstDivisionNumber() + 
m_c->descriptor.getPhiBinning().getNumDivisions();
 
  186   return m_c->descriptor.getEtaBinning().getFirstDivisionNumber();
 
  191   return m_c->descriptor.getEtaBinning().getFirstDivisionNumber() + 
m_c->descriptor.getEtaBinning().getNumDivisions();
 
  196   return *(
m_c->moduleArray[iSide][
iEta][
iPhi][iSector]);
 
  221                        const std::vector<const CondAttrListCollection*>& attrLists)
 const 
  223   auto payload = std::make_unique<EMBHVData::Payload>();
 
  224   payload->m_payloadArray.reserve(2*8*16*2*32);
 
  226   for (
int i=0;
i<16384;
i++) {
 
  237       unsigned int chanID = (*citr).first;
 
  238       int cannode = chanID/1000;
 
  239       int line = chanID%1000;
 
  244       const std::vector<HWIdentifier>& electrodeIdVec = idfunc(
id);
 
  246       for(
size_t i=0;
i<electrodeIdVec.size();
i++)
 
  254           unsigned int sideIndex=1-
m_c->elecId->zside(elecHWID);
 
  256           unsigned int etaIndex=
m_c->elecId->hv_eta(elecHWID);
 
  267           unsigned int sectorIndex;
 
  270             sectorIndex=
m_c->elecId->hv_phi(elecHWID);
 
  280             int imodule=
m_c->elecId->module(elecHWID);
 
  281             if (imodule<9) 
phiIndex = 8 - imodule;
 
  283             sectorIndex = 1-
m_c->elecId->hv_phi(elecHWID);
 
  286           if (sectorIndex==1) {
 
  291           unsigned int electrodeIndex=
m_c->elecId->electrode(elecHWID);
 
  293             if (
m_c->elecId->hv_phi(elecHWID)==1) electrodeIndex=31-electrodeIndex;  
 
  294             else                             electrodeIndex=63-electrodeIndex;  
 
  297             if (
m_c->elecId->hv_phi(elecHWID)==0) electrodeIndex=electrodeIndex-32;  
 
  300           unsigned int index             = 8192*sideIndex+1024*etaIndex+64*
phiIndex+32*sectorIndex+electrodeIndex;
 
  302           unsigned int gapIndex=
m_c->elecId->gap(elecHWID);
 
  303           if (sideIndex==0) gapIndex=1-gapIndex;
 
  306           if (!((*citr).second)[
"R_VMEAS"].isNull()) voltage = ((*citr).second)[
"R_VMEAS"].data<float>();
 
  308           if (!((*citr).second)[
"R_IMEAS"].isNull()) 
current = ((*citr).second)[
"R_IMEAS"].data<
float>();
 
  311           payload->m_payloadArray[
index].voltage[gapIndex]=voltage;
 
  313           payload->m_payloadArray[
index].hvLineNo[gapIndex]=chanID;
 
  326   std::vector<const CondAttrListCollection*> attrLists;
 
  330   if (
detStore->retrieve(atrlistcol, 
"/LAR/DCS/HV/BARREl/I16").isSuccess()) {
 
  331     attrLists.push_back (atrlistcol);
 
  333   if (
detStore->retrieve(atrlistcol, 
"/LAR/DCS/HV/BARREL/I8").isSuccess()) {
 
  334     attrLists.push_back (atrlistcol);
 
  336   return getData (SimIdFunc(), attrLists);
 
  340 #ifndef SIMULATIONBASE 
  341 #ifndef GENERATIONBASE 
  344                        const std::vector<const CondAttrListCollection*>& attrLists)
 const 
  346   auto idfunc = [&] (
HWIdentifier id) -> 
const std::vector<HWIdentifier>
 
  348   return getData (idfunc, attrLists);
 
  358   int etaIndex          = 
module.getEtaIndex();
 
  360   int sectorIndex       = 
module.getSectorIndex();
 
  361   int sideIndex         = 
module.getSideIndex();
 
  366   int id_zside = 1 - sideIndex;
 
  367   int id_hv_phi = (sideIndex==1 ? sectorIndex : 1-sectorIndex);
 
  368   int id_hv_eta = etaIndex;
 
  369   int id_gap = (sideIndex==0 ? 1-
gap : 
gap);
 
  386       id_module = 8-tmpPhi;
 
  389       id_module = 24-tmpPhi;
 
  396       id_electrode = 31-electrodeIndex;
 
  399       id_electrode = 63-electrodeIndex;
 
  404       id_electrode = electrodeIndex+32;
 
  407       id_electrode = electrodeIndex;
 
  426   return m_c->hvId->can_node(
id)*1000 + 
m_c->hvId->hv_line(
id);