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"
43 std::vector<HWIdentifier> operator()(HWIdentifier
id)
const
45 return m_cablingTool->getLArElectrodeIDvec (
id);
47 LArHVCablingSimTool* m_cablingTool;
53 ToolHandle<LArHVCablingSimTool>
tool (
"LArHVCablingSimTool");
54 if (!
tool.retrieve().isSuccess()) {
57 m_cablingTool =
tool.get();
67 for(
int iSide=0; iSide<2; ++iSide) {
68 for(
int iEta=0; iEta<8; ++iEta) {
69 for(
int iPhi=0; iPhi<16; ++iPhi) {
70 for(
int iSector=0; iSector<2; ++iSector) {
71 moduleArray[iSide][iEta][iPhi][iSector] = std::make_unique<EMBHVModule>(manager,iSide,iEta,iPhi,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");
113 if (
this != &other) {
144 return m_payload->m_payloadArray[
index(electrode)].hvLineNo[iGap];
152 unsigned int etaIndex =
module.getEtaIndex();
153 unsigned int phiIndex =
module.getPhiIndex();
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++)
249 int detector =
m_c->elecId->detector(elecHWID);
254 unsigned int sideIndex=1-
m_c->elecId->zside(elecHWID);
256 unsigned int etaIndex=
m_c->elecId->hv_eta(elecHWID);
266 unsigned int phiIndex;
267 unsigned int sectorIndex;
269 phiIndex=
m_c->elecId->module(elecHWID);
270 sectorIndex=
m_c->elecId->hv_phi(elecHWID);
280 int imodule=
m_c->elecId->module(elecHWID);
281 if (imodule<9) phiIndex = 8 - imodule;
282 else phiIndex = 24 - imodule;
283 sectorIndex = 1-
m_c->elecId->hv_phi(elecHWID);
286 if (sectorIndex==1) {
287 if (phiIndex>0) phiIndex = phiIndex - 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;
312 payload->m_payloadArray[
index].current[gapIndex]=current;
313 payload->m_payloadArray[
index].hvLineNo[gapIndex]=chanID;
319 return {std::move (payload)};
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();
359 int phiIndex =
module.getPhiIndex();
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);
370 int tmpPhi = phiIndex;
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);
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
char data[hepevt_bytes_allocation_ATLAS]
This class is a collection of AttributeLists where each one is associated with a channel number.
ChanAttrListMap::const_iterator const_iterator
const EMBHVModule & getModule() const
unsigned int getElectrodeIndex() const
Clockwork(const EMBHVManager *manager)
const LArElectrodeID * elecId
Clockwork(const Clockwork &)=delete
EMBHVDescriptor descriptor
std::unique_ptr< const EMBHVModule > moduleArray[2][8][16][2]
std::vector< EMBHVPayload > m_payloadArray
static int index(const EMBHVElectrode &electrode)
static constexpr double INVALID
int hvLineNo(const EMBHVElectrode &electrode, const int &iGap) const
bool hvOn(const EMBHVElectrode &electrode, const int &iGap) const
std::unique_ptr< Payload > m_payload
double voltage(const EMBHVElectrode &electrode, const int &iGap) const
EMBHVData & operator=(EMBHVData &&other) noexcept
double current(const EMBHVElectrode &electrode, const int &iGap) const
unsigned int beginPhiIndex() const
unsigned int endEtaIndex() const
static unsigned int endSectorIndex()
unsigned int beginEtaIndex() const
const EMBHVDescriptor & getDescriptor() const
std::function< std::vector< HWIdentifier >(HWIdentifier)> idfunc_t
static unsigned int beginSectorIndex()
const EMBHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
int hvLineNo(const EMBHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
EMBHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
EMBHVData getDataSim() const
unsigned int endPhiIndex() const
static unsigned int beginSideIndex()
std::unique_ptr< const Clockwork > m_c
static unsigned int endSideIndex()
Describes one HV Module within the EMB.
Helper for the Liquid Argon Calorimeter cell at the electrode level.
const std::vector< HWIdentifier > & getLArElectrodeIDvec(HWIdentifier &hvlineId) const
Return a vector of LArElectrodeID corresponding to a given LArHVLineID.
const HWIdentifier getLArHVLineID(HWIdentifier &electrodeId) const
Return the LArHVLineID corresponding to a given LArElectrodeId.
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.