14#include "GaudiKernel/ISvcLocator.h"
15#include "GaudiKernel/IToolSvc.h"
16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/ServiceHandle.h"
25#if !(defined(SIMULATIONBASE) || defined(GENERATIONBASE))
30#include "GeoModelKernel/CellBinning.h"
38 for(
int iSide=0; iSide<2; ++iSide) {
39 for(
int iPhi=0; iPhi<64; ++iPhi) {
40 moduleArray[iSide][iPhi] = std::make_unique<EMECPresamplerHVModule>(manager, iSide, iPhi);
44 if (StatusCode::SUCCESS!=detStore->retrieve(
elecId,
"LArElectrodeID")) {
45 throw std::runtime_error(
"EMECPresamplerHVManager failed to retrieve LArElectrodeID");
48 if (StatusCode::SUCCESS!=detStore->retrieve(
hvId,
"LArHVLineID")) {
49 throw std::runtime_error(
"EMECPresamplerHVManager failed to retrieve LArHVLineID");
54 std::unique_ptr<const EMECPresamplerHVModule>
moduleArray[2][64];
72 (std::unique_ptr<Payload> payload)
122 unsigned int phiIndex =
module.getPhiIndex();
123 unsigned int sideIndex =
module.getSideIndex();
124 unsigned int index = 64*sideIndex+phiIndex;
139 return &(
m_c->phiBinning);
144 return m_c->phiBinning.getFirstDivisionNumber();
149 return m_c->phiBinning.getFirstDivisionNumber() +
m_c->phiBinning.getNumDivisions();
154 return *(
m_c->moduleArray[iSide][iPhi]);
169 const std::vector<const CondAttrListCollection*>& attrLists)
const
171 auto payload = std::make_unique<EMECPresamplerHVData::Payload>();
172 payload->m_payloadArray.reserve(2*64);
173 for (
unsigned int i=0;i<64;i++) {
183 unsigned int chanID = (*citr).first;
184 int cannode = chanID/1000;
185 int line = chanID%1000;
191 const std::vector<HWIdentifier>& electrodeIdVec = idfunc(
id);
193 for(
size_t i=0;i<electrodeIdVec.size();i++) {
195 int detector =
m_c->elecId->detector(elecHWID);
200 unsigned int sideIndex=1-
m_c->elecId->zside(elecHWID);
201 unsigned int phiIndex=
m_c->elecId->module(elecHWID);
204 if (phiIndex<16) phiIndex=15-phiIndex;
205 else phiIndex=47-phiIndex;
216 unsigned int gapIndex=
m_c->elecId->gap(elecHWID);
218 unsigned int index = 64*sideIndex+2*phiIndex+gapIndex;
222 if (!((*citr).second)[
"R_VMEAS"].isNull()) voltage = ((*citr).second)[
"R_VMEAS"].
data<float>();
224 if (!((*citr).second)[
"R_IMEAS"].isNull()) current = ((*citr).second)[
"R_IMEAS"].
data<float>();
227 payload->m_payloadArray[
index].voltage=voltage;
228 payload->m_payloadArray[
index].current=current;
229 payload->m_payloadArray[
index].hvLineNo=chanID;
235 return {std::move (payload)};
239#if !(defined(SIMULATIONBASE) || defined(GENERATIONBASE))
242 const std::vector<const CondAttrListCollection*>& attrLists)
const
244 auto idfunc = [&] (
HWIdentifier id) ->
const std::vector<HWIdentifier>
246 return getData (idfunc, attrLists);
252 int sideIndex =
module.getSideIndex();
253 int phiIndex =
module.getPhiIndex()/2;
257 int id_zside = 1 - sideIndex;
260 id_module = phiIndex;
264 id_module = 15 - phiIndex;
267 id_module = 47 - phiIndex;
272 int id_gap =
module.getPhiIndex()%2;
287 if(hvlId) *hvlId = id;
290 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
std::unique_ptr< const EMECPresamplerHVModule > moduleArray[2][64]
Clockwork(const EMECPresamplerHVManager *manager)
const LArElectrodeID * elecId
std::vector< EMECPresamplerHVPayload > m_payloadArray
EMECPresamplerHVData & operator=(EMECPresamplerHVData &&other) noexcept
bool hvOn(const EMECPresamplerHVModule &module, const int &iGap) const
double voltage(const EMECPresamplerHVModule &module, const int &iGap) const
double current(const EMECPresamplerHVModule &module, const int &iGap) const
static constexpr double INVALID
int hvLineNo(const EMECPresamplerHVModule &module, const int &iGap) const
static int index(const EMECPresamplerHVModule &module)
std::unique_ptr< Payload > m_payload
EMECPresamplerHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
EMECPresamplerHVManager()
const CellBinning * getPhiBinning() const
unsigned int beginPhiIndex() const
int hvLineNo(const EMECPresamplerHVModule &module, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlineId=nullptr) const
unsigned int endPhiIndex() const
std::unique_ptr< const Clockwork > m_c
const EMECPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iPhi) const
std::function< std::vector< HWIdentifier >(HWIdentifier)> idfunc_t
static unsigned int endSideIndex()
static unsigned int beginSideIndex()
~EMECPresamplerHVManager()
Describes one HV Module within the EMEc 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.