ATLAS Offline Software
Loading...
Searching...
No Matches
HECHVManager Class Reference

This class provides direct access to information on the HV electrodes within the barrels. More...

#include <HECHVManager.h>

Collaboration diagram for HECHVManager:

Classes

class  Clockwork
class  HECHVData

Public Member Functions

 HECHVManager ()
 ~HECHVManager ()
const HECHVDescriptorgetDescriptor () const
const HECHVModulegetHVModule (unsigned int iSide, unsigned int iPhi, unsigned int iSampling) const
HECHVData getDataSim () const
HECHVData getData (const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
int hvLineNo (const HECHVSubgap &subgap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const

Static Public Member Functions

static unsigned int beginSideIndex ()
static unsigned int endSideIndex ()
static unsigned int beginPhiIndex ()
static unsigned int endPhiIndex ()
static unsigned int beginSamplingIndex ()
static unsigned int endSamplingIndex ()

Private Types

using idfunc_t = std::function<std::vector<HWIdentifier>(HWIdentifier)>

Private Member Functions

HECHVData getData (const idfunc_t &idfunc, const std::vector< const CondAttrListCollection * > &attrLists) const
 HECHVManager (const HECHVManager &right)=delete
HECHVManageroperator= (const HECHVManager &right)=delete

Private Attributes

std::unique_ptr< const Clockworkm_c

Detailed Description

This class provides direct access to information on the HV electrodes within the barrels.

The information may be accessed either directly or iteratively. Direct access is provided by the getHVModule() method. Iterative access is by looping over valid side, eta, phi, and sector indices to retrieve a HV module. From the high voltage modules one can obtain a list of electrodes (iteratively or directly).

The manager owns the pointers to the HV Modules.

Definition at line 35 of file HECHVManager.h.

Member Typedef Documentation

◆ idfunc_t

using HECHVManager::idfunc_t = std::function<std::vector<HWIdentifier>(HWIdentifier)>
private

Definition at line 89 of file HECHVManager.h.

Constructor & Destructor Documentation

◆ HECHVManager() [1/2]

HECHVManager::HECHVManager ( )

Definition at line 154 of file HECHVManager.cxx.

155 : m_c (std::make_unique<Clockwork> (this))
156{
157}
std::unique_ptr< const Clockwork > m_c

◆ ~HECHVManager()

HECHVManager::~HECHVManager ( )
default

◆ HECHVManager() [2/2]

HECHVManager::HECHVManager ( const HECHVManager & right)
privatedelete

Member Function Documentation

◆ beginPhiIndex()

unsigned int HECHVManager::beginPhiIndex ( )
static

Definition at line 174 of file HECHVManager.cxx.

175{
176 return 0;
177}

◆ beginSamplingIndex()

unsigned int HECHVManager::beginSamplingIndex ( )
static

Definition at line 184 of file HECHVManager.cxx.

185{
186 return 0;
187}

◆ beginSideIndex()

unsigned int HECHVManager::beginSideIndex ( )
static

Definition at line 164 of file HECHVManager.cxx.

165{
166 return 0;
167}

◆ endPhiIndex()

unsigned int HECHVManager::endPhiIndex ( )
static

Definition at line 179 of file HECHVManager.cxx.

180{
181 return 32;
182}

◆ endSamplingIndex()

unsigned int HECHVManager::endSamplingIndex ( )
static

Definition at line 189 of file HECHVManager.cxx.

190{
191 return 4;
192}

◆ endSideIndex()

unsigned int HECHVManager::endSideIndex ( )
static

Definition at line 169 of file HECHVManager.cxx.

170{
171 return 2;
172}

◆ getData() [1/2]

HECHVManager::HECHVData HECHVManager::getData ( const idfunc_t & idfunc,
const std::vector< const CondAttrListCollection * > & attrLists ) const
private

Definition at line 205 of file HECHVManager.cxx.

207{
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++) {
211 payload->m_payloadArray[i].voltage = HECHVData::INVALID;
212 }
213
214 for (const CondAttrListCollection* atrlistcol : attrLists) {
215
216 for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) {
217
218 // Construct HWIdentifier
219 // 1. decode COOL Channel ID
220 unsigned int chanID = (*citr).first;
221 int cannode = chanID/1000;
222 int line = chanID%1000;
223
224 // 2. Construct the identifier
225 HWIdentifier id = m_c->hvId->HVLineId(1,1,cannode,line);
226
227 const std::vector<HWIdentifier>& electrodeIdVec = idfunc(id);
228
229 for(size_t i=0;i<electrodeIdVec.size();i++) {
230 HWIdentifier elecHWID = electrodeIdVec[i];
231
232 int detector = m_c->elecId->detector(elecHWID);
233
234 // check we are in HEC
235 if (detector != 4) {
236 continue;
237 }
238
239 float voltage = HECHVData::INVALID;
240 if (!((*citr).second)["R_VMEAS"].isNull()) voltage = ((*citr).second)["R_VMEAS"].data<float>();
241 float current = 0.;
242 if (!((*citr).second)["R_IMEAS"].isNull()) current = ((*citr).second)["R_IMEAS"].data<float>();
243
244
245 unsigned int sideIndex=1-m_c->elecId->zside(elecHWID); // 0 for C side, 1 for A side, opposite to HV numbering
246 unsigned int phiIndex=m_c->elecId->module(elecHWID); // 0 to 31
247 unsigned int samplingIndex=m_c->elecId->hv_eta(elecHWID)-1; // 0 to 3
248 unsigned int subgapIndex=m_c->elecId->gap(elecHWID); // 0 to 3
249
250 unsigned int index = 512*sideIndex+16*phiIndex+4*samplingIndex+subgapIndex;
251
252
253 if (index>1023) {
254 MsgStream msg (Athena::getMessageSvc(), "EMECHVManager");
255 msg << MSG::ERROR << "invalid index " << index << " side,phi,sampling,gap " << sideIndex << " " << phiIndex << " " << samplingIndex
256 << " " << subgapIndex << endmsg;
257 continue;
258 }
259
260 payload->m_payloadArray[index].voltage=voltage;
261 payload->m_payloadArray[index].current=current;
262 payload->m_payloadArray[index].hvLineNo=chanID;
263 } // For (electrodeIdVec)
264 } // for (atrlistcol)
265 }
266
267 return {std::move (payload)};
268}
#define endmsg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
ChanAttrListMap::const_iterator const_iterator
static constexpr double INVALID
IMessageSvc * getMessageSvc(bool quiet=false)
str index
Definition DeMoScan.py:362
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition EtaPhiLUT.cxx:23
MsgStream & msg
Definition testRead.cxx:32

◆ getData() [2/2]

HECHVManager::HECHVData HECHVManager::getData ( const LArHVIdMapping & hvIdMapping,
const std::vector< const CondAttrListCollection * > & attrLists ) const

Definition at line 290 of file HECHVManager.cxx.

292{
293 auto idfunc = [&] (HWIdentifier id) -> const std::vector<HWIdentifier>
294 { return hvIdMapping.getLArElectrodeIDvec(id); };
295 return getData (idfunc, attrLists);
296}
HECHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
const std::vector< HWIdentifier > & getLArElectrodeIDvec(HWIdentifier &hvlineId) const
Return a vector of LArElectrodeID corresponding to a given LArHVLineID.

◆ getDataSim()

HECHVManager::HECHVData HECHVManager::getDataSim ( ) const

Definition at line 272 of file HECHVManager.cxx.

273{
274 std::vector<const CondAttrListCollection*> attrLists;
275 ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "EMBHVManager");
276 const CondAttrListCollection* atrlistcol = nullptr;
277 // Not a typo --- this folder has a lower-case l in the database...
278 if (detStore->retrieve(atrlistcol, "/LAR/DCS/HV/BARREl/I16").isSuccess()) {
279 attrLists.push_back (atrlistcol);
280 }
281 if (detStore->retrieve(atrlistcol, "/LAR/DCS/HV/BARREL/I8").isSuccess()) {
282 attrLists.push_back (atrlistcol);
283 }
284 return getData (SimIdFunc(), attrLists);
285}

◆ getDescriptor()

const HECHVDescriptor & HECHVManager::getDescriptor ( ) const

Definition at line 159 of file HECHVManager.cxx.

160{
161 return m_c->descriptor;
162}

◆ getHVModule()

const HECHVModule & HECHVManager::getHVModule ( unsigned int iSide,
unsigned int iPhi,
unsigned int iSampling ) const

Definition at line 194 of file HECHVManager.cxx.

197{
198 return *(m_c->moduleArray[iSide][iPhi][iSampling]);
199}
@ iPhi
Definition ParamDefs.h:47

◆ hvLineNo()

int HECHVManager::hvLineNo ( const HECHVSubgap & subgap,
const LArHVIdMapping * hvIdMapping,
HWIdentifier * hvlId = nullptr ) const

Definition at line 299 of file HECHVManager.cxx.

301 {
302
303 const HECHVModule& module = subgap.getModule();
304 int sideIndex = module.getSideIndex();
305 int phiIndex = module.getPhiIndex();
306 int samplingIndex = module.getSamplingIndex();
307 int subgapIndex = subgap.getSubgapIndex();
308
309 // ________________________ Construct ElectrodeID ________________________________
310 int id_detector = 4;
311 int id_zside = 1-sideIndex;
312 int id_module = phiIndex;
313 int id_hv_phi = 0;
314 int id_hv_eta = samplingIndex+1;
315 int id_gap = subgapIndex;
316 int id_electrode{0};
317
318 switch(samplingIndex) {
319 case 0:
320 id_electrode=1;
321 break;
322 case 1:
323 id_electrode=9;
324 break;
325 case 2:
326 id_electrode=25;
327 break;
328 case 3:
329 id_electrode=33;
330 break;
331 default:
332 throw std::runtime_error("Unexpected value for samplingIndex in HEC: " + std::to_string(samplingIndex));
333 }
334
335 HWIdentifier elecHWID = m_c->elecId->ElectrodeId(id_detector
336 , id_zside
337 , id_module
338 , id_hv_phi
339 , id_hv_eta
340 , id_gap
341 , id_electrode);
342 // ________________________ ________________________________
343
344 // Get LArHVLineID corresponding to a given LArElectrodeId
345 HWIdentifier id = hvIdMapping->getLArHVLineID(elecHWID);
346
347 if(hvlId) *hvlId=id;
348
349 // Extract HV Line No
350 return m_c->hvId->can_node(id)*1000 + m_c->hvId->hv_line(id);
351}
const HECHVModule & getModule() const
unsigned int getSubgapIndex() const
const HWIdentifier getLArHVLineID(HWIdentifier &electrodeId) const
Return the LArHVLineID corresponding to a given LArElectrodeId.

◆ operator=()

HECHVManager & HECHVManager::operator= ( const HECHVManager & right)
privatedelete

Member Data Documentation

◆ m_c

std::unique_ptr<const Clockwork> HECHVManager::m_c
private

Definition at line 97 of file HECHVManager.h.


The documentation for this class was generated from the following files: