14#include "GaudiKernel/ISvcLocator.h"
15#include "GaudiKernel/IToolSvc.h"
16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/ServiceHandle.h"
26#if !(defined(SIMULATIONBASE) || defined(GENERATIONBASE))
39 std::vector<HWIdentifier> operator()(HWIdentifier
id)
const
41 return m_cablingTool->getLArElectrodeIDvec (
id);
43 LArHVCablingSimTool* m_cablingTool;
49 ToolHandle<LArHVCablingSimTool>
tool (
"LArHVCablingSimTool");
50 if (!
tool.retrieve().isSuccess()) {
53 m_cablingTool =
tool.get();
64 for(
int iSide=0; iSide<2; ++iSide) {
65 for(
int iPhi=0; iPhi<32; ++iPhi) {
66 for(
int iSampling=0; iSampling<4; ++iSampling) {
67 moduleArray[iSide][iPhi][iSampling] = std::make_unique<HECHVModule>(manager,iSide,iPhi,iSampling);
73 if (StatusCode::SUCCESS!=detStore->retrieve(
elecId,
"LArElectrodeID")) {
74 throw std::runtime_error(
"HECHVManager failed to retrieve LArElectrodeID");
77 if (StatusCode::SUCCESS!=detStore->retrieve(
hvId,
"LArHVLineID")) {
78 throw std::runtime_error(
"HECHVManager failed to retrieve LArHVLineID");
107 if (
this != &other) {
146 unsigned int phiIndex =
module.getPhiIndex();
147 unsigned int samplingIndex =
module.getSamplingIndex();
148 unsigned int sideIndex =
module.getSideIndex();
149 unsigned int index = 512*sideIndex+16*phiIndex+4*samplingIndex+subgapIndex;
161 return m_c->descriptor;
196 ,
unsigned int iSampling)
const
198 return *(
m_c->moduleArray[iSide][iPhi][iSampling]);
206 const std::vector<const CondAttrListCollection*>& attrLists)
const
208 auto payload = std::make_unique<HECHVData::Payload>();
209 payload->m_payloadArray.reserve(2*32*4*4);
210 for (
unsigned int i=0;i<1024;i++) {
220 unsigned int chanID = (*citr).first;
221 int cannode = chanID/1000;
222 int line = chanID%1000;
227 const std::vector<HWIdentifier>& electrodeIdVec = idfunc(
id);
229 for(
size_t i=0;i<electrodeIdVec.size();i++) {
232 int detector =
m_c->elecId->detector(elecHWID);
240 if (!((*citr).second)[
"R_VMEAS"].isNull()) voltage = ((*citr).second)[
"R_VMEAS"].
data<float>();
242 if (!((*citr).second)[
"R_IMEAS"].isNull()) current = ((*citr).second)[
"R_IMEAS"].
data<float>();
245 unsigned int sideIndex=1-
m_c->elecId->zside(elecHWID);
246 unsigned int phiIndex=
m_c->elecId->module(elecHWID);
247 unsigned int samplingIndex=
m_c->elecId->hv_eta(elecHWID)-1;
248 unsigned int subgapIndex=
m_c->elecId->gap(elecHWID);
250 unsigned int index = 512*sideIndex+16*phiIndex+4*samplingIndex+subgapIndex;
255 msg << MSG::ERROR <<
"invalid index " <<
index <<
" side,phi,sampling,gap " << sideIndex <<
" " << phiIndex <<
" " << samplingIndex
256 <<
" " << subgapIndex <<
endmsg;
260 payload->m_payloadArray[
index].voltage=voltage;
261 payload->m_payloadArray[
index].current=current;
262 payload->m_payloadArray[
index].hvLineNo=chanID;
267 return {std::move (payload)};
274 std::vector<const CondAttrListCollection*> attrLists;
278 if (detStore->retrieve(atrlistcol,
"/LAR/DCS/HV/BARREl/I16").isSuccess()) {
279 attrLists.push_back (atrlistcol);
281 if (detStore->retrieve(atrlistcol,
"/LAR/DCS/HV/BARREL/I8").isSuccess()) {
282 attrLists.push_back (atrlistcol);
284 return getData (SimIdFunc(), attrLists);
288#if !(defined(SIMULATIONBASE) || defined(GENERATIONBASE))
291 const std::vector<const CondAttrListCollection*>& attrLists)
const
293 auto idfunc = [&] (
HWIdentifier id) ->
const std::vector<HWIdentifier>
295 return getData (idfunc, attrLists);
304 int sideIndex =
module.getSideIndex();
305 int phiIndex =
module.getPhiIndex();
306 int samplingIndex =
module.getSamplingIndex();
311 int id_zside = 1-sideIndex;
312 int id_module = phiIndex;
314 int id_hv_eta = samplingIndex+1;
315 int id_gap = subgapIndex;
318 switch(samplingIndex) {
332 throw std::runtime_error(
"Unexpected value for samplingIndex in HEC: " + std::to_string(samplingIndex));
350 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
HECHVDescriptor descriptor
Clockwork(const HECHVManager *manager)
const LArElectrodeID * elecId
std::unique_ptr< const HECHVModule > moduleArray[2][32][4]
std::vector< HECHVPayload > m_payloadArray
double current(const HECHVSubgap &subgap) const
bool hvOn(const HECHVSubgap &subgap) const
std::unique_ptr< Payload > m_payload
int hvLineNo(const HECHVSubgap &subgap) const
static int index(const HECHVSubgap &subgap)
static constexpr double INVALID
HECHVData & operator=(HECHVData &&other) noexcept
double voltage(const HECHVSubgap &subgap) const
static unsigned int beginPhiIndex()
std::unique_ptr< const Clockwork > m_c
static unsigned int endSamplingIndex()
const HECHVModule & getHVModule(unsigned int iSide, unsigned int iPhi, unsigned int iSampling) const
const HECHVDescriptor & getDescriptor() const
static unsigned int endSideIndex()
HECHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
static unsigned int beginSideIndex()
int hvLineNo(const HECHVSubgap &subgap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
HECHVData getDataSim() const
std::function< std::vector< HWIdentifier >(HWIdentifier)> idfunc_t
static unsigned int beginSamplingIndex()
static unsigned int endPhiIndex()
Describes one HV Module within the HEC.
const HECHVModule & getModule() const
unsigned int getSubgapIndex() const
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)