15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/IToolSvc.h"
17#include "GaudiKernel/Bootstrap.h"
18#include "GaudiKernel/ServiceHandle.h"
44 std::vector<HWIdentifier> operator()(HWIdentifier
id)
const
46 return m_cablingTool->getLArElectrodeIDvec (
id);
48 LArHVCablingSimTool* m_cablingTool;
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) {
73 for(
int iEta=0; iEta<8; ++iEta) {
74 for(
int iPhi=0; iPhi<8; ++iPhi) {
75 for(
int iSector=0; iSector<8; ++iSector) {
76 moduleArray[iSide][iEta][iPhi][iSector] = std::make_unique<EMECHVModule>(manager,wheel,iSide,iEta,iPhi,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");
120 if (
this != &other) {
151 return m_payload->m_payloadArray[
index(electrode)].hvLineNo[iGap];
159 unsigned int etaIndex =
module.getEtaIndex();
160 unsigned int phiIndex =
module.getPhiIndex();
161 unsigned int sectorIndex =
module.getSectorIndex();
162 unsigned int sideIndex =
module.getSideIndex();
164 unsigned int index=0;
165 if (module.getWheelIndex()==
EMECHVModule::OUTER)
index= 5376*sideIndex+768*etaIndex+96*phiIndex+24*sectorIndex+electrodeIndex;
166 else if (module.getWheelIndex()==
EMECHVModule::INNER)
index= 512*sideIndex+256*etaIndex+32*phiIndex+4*sectorIndex+electrodeIndex;
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 const std::vector<HWIdentifier>& electrodeIdVec = idfunc(
id);
291 for(
size_t i=0;i<electrodeIdVec.size();i++) {
294 int detector =
m_c->elecId->detector(elecHWID);
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);
307 if (phiIndex<4) phiIndex=3-phiIndex;
308 else phiIndex=11-phiIndex;
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;
357 payload->m_payloadArray[
index].current[gapIndex]=current;
358 payload->m_payloadArray[
index].hvLineNo[gapIndex]=chanID;
365 return {std::move (payload)};
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
391 auto idfunc = [&] (
HWIdentifier id) ->
const std::vector<HWIdentifier>
393 return getData (idfunc, attrLists);
403 int etaIndex =
module.getEtaIndex();
404 int phiIndex =
module.getPhiIndex();
405 int sectorIndex =
module.getSectorIndex();
406 int sideIndex =
module.getSideIndex();
411 int id_zside = 1-sideIndex;
417 id_module=3-phiIndex;
420 id_module=11-phiIndex;
424 id_module = phiIndex;
430 id_hv_phi=4-sectorIndex;
433 id_hv_phi=8-sectorIndex;
437 id_hv_phi=sectorIndex+1;
443 tmpElec = 23-electrodeIndex;
446 tmpElec = 3 - electrodeIndex;
450 tmpElec = electrodeIndex;
453 ? (id_hv_phi-1)*24 + tmpElec
454 : (id_hv_phi-1)*4 + tmpElec;
456 int id_gap = sideIndex==0 ? 1-gap : gap;
473 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
unsigned int getElectrodeIndex() const
const EMECHVModule & getModule() const
const LArElectrodeID * elecId
Clockwork(const EMECHVManager *manager, IOType wheel, std::unique_ptr< EMECHVDescriptor > the_descriptor)
std::unique_ptr< EMECHVDescriptor > descriptor
std::unique_ptr< const EMECHVModule > moduleArray[2][8][8][8]
std::vector< EMECHVPayload > m_payloadArray
std::unique_ptr< Payload > m_payload
static constexpr double INVALID
EMECHVData & operator=(EMECHVData &&other) noexcept
static int index(const EMECHVElectrode &electrode)
double current(const EMECHVElectrode &electrode, const int &iGap) const
bool hvOn(const EMECHVElectrode &electrode, const int &iGap) const
double voltage(const EMECHVElectrode &electrode, const int &iGap) const
int hvLineNo(const EMECHVElectrode &electrode, const int &iGap) const
unsigned int beginEtaIndex() const
const EMECHVDescriptor & getDescriptor() const
int hvLineNo(const EMECHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
const EMECHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
unsigned int beginSectorIndex() const
unsigned int endPhiIndex() const
static unsigned int beginSideIndex()
std::function< std::vector< HWIdentifier >(HWIdentifier)> idfunc_t
std::unique_ptr< const Clockwork > m_c
static unsigned int endSideIndex()
unsigned int endEtaIndex() const
EMECHVManager::IOType getWheelIndex() const
EMECHVModule::IOType IOType
unsigned int endSectorIndex() const
unsigned int beginPhiIndex() const
EMECHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
EMECHVData getDataSim() const
EMECHVManager(IOType wheel)
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.
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)