7#include "GeoModelKernel/CellBinning.h"
8#include "GeoModelKernel/CellPartitioning.h"
15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/IToolSvc.h"
17#include "GaudiKernel/Bootstrap.h"
18#include "GaudiKernel/ServiceHandle.h"
40 CellPartitioning etaPartitioning;
41 for (
unsigned int i= 0; i<4; i++) etaPartitioning.addValue(i*0.4);
42 etaPartitioning.addValue(1.525);
43 descriptor = std::make_unique<EMBPresamplerHVDescriptor>(etaPartitioning,CellBinning(0.0, 2*
M_PI, 32));
45 for(
int iSide=0; iSide<2; ++iSide) {
46 for(
int iEta=0; iEta<4; ++iEta) {
47 for(
int iPhi=0; iPhi<32; ++iPhi) {
48 moduleArray[iSide][iEta][iPhi] = std::make_unique<EMBPresamplerHVModule>(manager, iSide, iEta,iPhi);
54 if (StatusCode::SUCCESS!=detStore->retrieve(
elecId,
"LArElectrodeID")) {
55 throw std::runtime_error(
"EMBPresamplerHVManager failed to retrieve LArElectrodeID");
58 if (StatusCode::SUCCESS!=detStore->retrieve(
hvId,
"LArHVLineID")) {
59 throw std::runtime_error(
"EMBPresamplerHVManager failed to retrieve LArHVLineID");
64 std::unique_ptr<const EMBPresamplerHVModule>
moduleArray[2][4][32];
81 (std::unique_ptr<Payload> payload)
131 unsigned int sideIndex =
module.getSideIndex();
132 unsigned int phiIndex =
module.getPhiIndex();
133 unsigned int etaIndex =
module.getEtaIndex();
134 unsigned int index = 128*sideIndex+32*etaIndex+phiIndex;
149 return m_c->descriptor.get();
154 return m_c->descriptor->getPhiBinning().getFirstDivisionNumber();
159 return m_c->descriptor->getPhiBinning().getFirstDivisionNumber() +
m_c->descriptor->getPhiBinning().getNumDivisions();
164 return m_c->descriptor->getEtaPartitioning().getFirstDivisionNumber();
169 return m_c->descriptor->getEtaPartitioning().getFirstDivisionNumber() +
m_c->descriptor->getEtaPartitioning().getNumDivisions();
174 return *(
m_c->moduleArray[iSide][iEta][iPhi]);
190 const std::vector<const CondAttrListCollection*>& attrLists)
const
192 auto payload = std::make_unique<EMBPresamplerHVData::Payload>();
193 payload->m_payloadArray.reserve(2*4*32);
195 for (
int i=0;i<256;i++) {
206 unsigned int chanID = (*citr).first;
207 int cannode = chanID/1000;
208 int line = chanID%1000;
213 const std::vector<HWIdentifier>& electrodeIdVec = idfunc(
id);
216 for(
size_t i=0;i<electrodeIdVec.size();i++)
219 int detector =
m_c->elecId->detector(elecHWID);
224 unsigned int sideIndex=1-
m_c->elecId->zside(elecHWID);
226 unsigned int etaIndex=
m_c->elecId->hv_eta(elecHWID)-1;
235 unsigned int phiIndex;
237 phiIndex=
m_c->elecId->module(elecHWID);
246 int imodule=
m_c->elecId->module(elecHWID);
247 if (imodule<16) phiIndex = 15 - imodule;
248 else phiIndex = 47 - imodule;
251 unsigned int index = 128*sideIndex+32*etaIndex+phiIndex;
253 unsigned int gapIndex=
m_c->elecId->gap(elecHWID);
254 if (sideIndex==0) gapIndex=1-gapIndex;
258 if (!((*citr).second)[
"R_VMEAS"].isNull()) voltage = ((*citr).second)[
"R_VMEAS"].
data<float>();
260 if (!((*citr).second)[
"R_IMEAS"].isNull()) current = ((*citr).second)[
"R_IMEAS"].
data<float>();
262 payload->m_payloadArray[
index].voltage[gapIndex]=voltage;
263 payload->m_payloadArray[
index].current[gapIndex]=current;
264 payload->m_payloadArray[
index].hvLineNo[gapIndex]=chanID;
270 return {std::move (payload)};
273#ifndef SIMULATIONBASE
274#ifndef GENERATIONBASE
277 const std::vector<const CondAttrListCollection*>& attrLists)
const
279 auto idfunc = [&] (
HWIdentifier id) ->
const std::vector<HWIdentifier>
281 return getData (idfunc, attrLists);
290 int sideIndex =
module.getSideIndex();
291 int phiIndex =
module.getPhiIndex();
292 int etaIndex =
module.getEtaIndex();
296 int id_zside = 1 - sideIndex;
299 id_module = phiIndex;
303 id_module = 15 - phiIndex;
306 id_module = 47 - phiIndex;
310 int id_hv_eta = etaIndex + 1;
311 int id_gap = sideIndex==0 ? 1-gap : gap;
326 if(hvlId) *hvlId = id;
329 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 LArElectrodeID * elecId
std::unique_ptr< EMBPresamplerHVDescriptor > descriptor
Clockwork(const EMBPresamplerHVManager *manager)
std::unique_ptr< const EMBPresamplerHVModule > moduleArray[2][4][32]
std::vector< EMBPresamplerHVPayload > m_payloadArray
double voltage(const EMBPresamplerHVModule &module, const int &iGap) const
std::unique_ptr< Payload > m_payload
bool hvOn(const EMBPresamplerHVModule &module, const int &iGap) const
double current(const EMBPresamplerHVModule &module, const int &iGap) const
EMBPresamplerHVData & operator=(EMBPresamplerHVData &&other) noexcept
int hvLineNo(const EMBPresamplerHVModule &module, const int &iGap) const
static int index(const EMBPresamplerHVModule &module)
static constexpr double INVALID
const EMBPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi) const
std::unique_ptr< const Clockwork > m_c
const EMBPresamplerHVDescriptor * getDescriptor() const
EMBPresamplerHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
~EMBPresamplerHVManager()
static unsigned int beginSideIndex()
unsigned int endPhiIndex() const
unsigned int beginPhiIndex() const
static unsigned int endSideIndex()
std::function< std::vector< HWIdentifier >(HWIdentifier)> idfunc_t
unsigned int endEtaIndex() const
unsigned int beginEtaIndex() const
int hvLineNo(const EMBPresamplerHVModule &module, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
Describes one HV Module within the EMB Presampler.
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.