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

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

#include <EMBHVManager.h>

Collaboration diagram for EMBHVManager:

Classes

class  Clockwork
class  EMBHVData

Public Member Functions

 EMBHVManager ()
 ~EMBHVManager ()
const EMBHVDescriptorgetDescriptor () const
unsigned int beginPhiIndex () const
unsigned int endPhiIndex () const
unsigned int beginEtaIndex () const
unsigned int endEtaIndex () const
const EMBHVModulegetHVModule (unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
EMBHVData getDataSim () const
EMBHVData getData (const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
int hvLineNo (const EMBHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const

Static Public Member Functions

static unsigned int beginSectorIndex ()
static unsigned int endSectorIndex ()
static unsigned int beginSideIndex ()
static unsigned int endSideIndex ()

Private Types

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

Private Member Functions

EMBHVData getData (const idfunc_t &idfunc, const std::vector< const CondAttrListCollection * > &attrLists) const
 EMBHVManager (const EMBHVManager &right)=delete
EMBHVManageroperator= (const EMBHVManager &right)=delete

Private Attributes

std::unique_ptr< const Clockworkm_c

Friends

class ImaginaryFriend

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 EMBHVManager.h.

Member Typedef Documentation

◆ idfunc_t

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

Definition at line 96 of file EMBHVManager.h.

Constructor & Destructor Documentation

◆ EMBHVManager() [1/2]

EMBHVManager::EMBHVManager ( )

Definition at line 161 of file EMBHVManager.cxx.

162 : m_c (std::make_unique<Clockwork> (this))
163{
164}
std::unique_ptr< const Clockwork > m_c

◆ ~EMBHVManager()

EMBHVManager::~EMBHVManager ( )
default

◆ EMBHVManager() [2/2]

EMBHVManager::EMBHVManager ( const EMBHVManager & right)
privatedelete

Member Function Documentation

◆ beginEtaIndex()

unsigned int EMBHVManager::beginEtaIndex ( ) const

Definition at line 184 of file EMBHVManager.cxx.

185{
186 return m_c->descriptor.getEtaBinning().getFirstDivisionNumber();
187}

◆ beginPhiIndex()

unsigned int EMBHVManager::beginPhiIndex ( ) const

Definition at line 174 of file EMBHVManager.cxx.

175{
176 return m_c->descriptor.getPhiBinning().getFirstDivisionNumber();
177}

◆ beginSectorIndex()

unsigned int EMBHVManager::beginSectorIndex ( )
static

Definition at line 199 of file EMBHVManager.cxx.

200{
201 return 0;
202}

◆ beginSideIndex()

unsigned int EMBHVManager::beginSideIndex ( )
static

Definition at line 209 of file EMBHVManager.cxx.

210{
211 return 0;
212}

◆ endEtaIndex()

unsigned int EMBHVManager::endEtaIndex ( ) const

Definition at line 189 of file EMBHVManager.cxx.

190{
191 return m_c->descriptor.getEtaBinning().getFirstDivisionNumber() + m_c->descriptor.getEtaBinning().getNumDivisions();
192}

◆ endPhiIndex()

unsigned int EMBHVManager::endPhiIndex ( ) const

Definition at line 179 of file EMBHVManager.cxx.

180{
181 return m_c->descriptor.getPhiBinning().getFirstDivisionNumber() + m_c->descriptor.getPhiBinning().getNumDivisions();
182}

◆ endSectorIndex()

unsigned int EMBHVManager::endSectorIndex ( )
static

Definition at line 204 of file EMBHVManager.cxx.

205{
206 return 2;
207}

◆ endSideIndex()

unsigned int EMBHVManager::endSideIndex ( )
static

Definition at line 214 of file EMBHVManager.cxx.

215{
216 return 2;
217}

◆ getData() [1/2]

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

Definition at line 220 of file EMBHVManager.cxx.

222{
223 auto payload = std::make_unique<EMBHVData::Payload>();
224 payload->m_payloadArray.reserve(2*8*16*2*32);
225
226 for (int i=0;i<16384;i++) {
227 payload->m_payloadArray[i].voltage[0] = EMBHVData::INVALID;
228 payload->m_payloadArray[i].voltage[1] = EMBHVData::INVALID;
229 }
230
231 for (const CondAttrListCollection* atrlistcol : attrLists) {
232
233 for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) {
234
235 // Construct HWIdentifier
236 // 1. decode COOL Channel ID
237 unsigned int chanID = (*citr).first;
238 int cannode = chanID/1000;
239 int line = chanID%1000;
240
241 // 2. Construct the identifier
242 HWIdentifier id = m_c->hvId->HVLineId(1,1,cannode,line);
243
244 const std::vector<HWIdentifier>& electrodeIdVec = idfunc(id);
245
246 for(size_t i=0;i<electrodeIdVec.size();i++)
247 {
248 HWIdentifier elecHWID = electrodeIdVec[i];
249 int detector = m_c->elecId->detector(elecHWID);
250 if (detector==0) {
251
252// side in standard offline 0 for z<0 (C) 1 for z>0 (A)
253// in electrode numbering, this is the opposite (0 for A and 1 for C)
254 unsigned int sideIndex=1-m_c->elecId->zside(elecHWID);
255// eta index, no trouble
256 unsigned int etaIndex=m_c->elecId->hv_eta(elecHWID);
257// phi index
258// offline 0 to 2pi in 2pi/16 bins
259// this is module in the electrode numbering: on the A side 0 to 15, 0 is halfway around phi=0 (FT-1 (hv_phi=1 is a lower phi)
260// offline phi 0 pi 2pi
261// Module M0 M1 M1 M15 M0
262// FT 0 -1 0 0 -1
263// hv_phi 0 1 0 0 1
264// phiIndex 0 0 1 15 15
265// sector Index 0 1 0 0 1
266 unsigned int phiIndex;
267 unsigned int sectorIndex;
268 if (sideIndex==1) {
269 phiIndex=m_c->elecId->module(elecHWID);
270 sectorIndex=m_c->elecId->hv_phi(elecHWID);
271 }
272// module numbering on the C side 0 around phi=pi, running backwards
273// offline phi 0 pi 2pi
274// Module P8 P7 P7 P0 P0 P9 P8
275// FT -1 0 -1 0 -1 -1 0
276// hv_phi 1 0 1 0 1 1 0
277// phiIndex 0 0 1 7 8 15 15
278// sectorIndex 0 1 0 1 0 0 1
279 else {
280 int imodule=m_c->elecId->module(elecHWID);
281 if (imodule<9) phiIndex = 8 - imodule;
282 else phiIndex = 24 - imodule;
283 sectorIndex = 1-m_c->elecId->hv_phi(elecHWID);
284 }
285
286 if (sectorIndex==1) {
287 if (phiIndex>0) phiIndex = phiIndex - 1;
288 else phiIndex=15;
289 }
290
291 unsigned int electrodeIndex=m_c->elecId->electrode(elecHWID);
292 if (sideIndex==0) {
293 if (m_c->elecId->hv_phi(elecHWID)==1) electrodeIndex=31-electrodeIndex; // FT-1 change 0->31 to 31->0
294 else electrodeIndex=63-electrodeIndex; // FT 0 change 32->63 to 31-0
295 }
296 else {
297 if (m_c->elecId->hv_phi(elecHWID)==0) electrodeIndex=electrodeIndex-32; // FT 0 change 31-63 to 0-31
298 }
299
300 unsigned int index = 8192*sideIndex+1024*etaIndex+64*phiIndex+32*sectorIndex+electrodeIndex;
301
302 unsigned int gapIndex=m_c->elecId->gap(elecHWID);
303 if (sideIndex==0) gapIndex=1-gapIndex;
304
305 float voltage = EMBHVData::INVALID;
306 if (!((*citr).second)["R_VMEAS"].isNull()) voltage = ((*citr).second)["R_VMEAS"].data<float>();
307 float current = 0.;
308 if (!((*citr).second)["R_IMEAS"].isNull()) current = ((*citr).second)["R_IMEAS"].data<float>();
309
310
311 payload->m_payloadArray[index].voltage[gapIndex]=voltage;
312 payload->m_payloadArray[index].current[gapIndex]=current;
313 payload->m_payloadArray[index].hvLineNo[gapIndex]=chanID;
314 }
315 }
316 }
317 }
318
319 return {std::move (payload)};
320}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
ChanAttrListMap::const_iterator const_iterator
static constexpr double INVALID
str index
Definition DeMoScan.py:362
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition EtaPhiLUT.cxx:23

◆ getData() [2/2]

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

Definition at line 343 of file EMBHVManager.cxx.

345{
346 auto idfunc = [&] (HWIdentifier id) -> const std::vector<HWIdentifier>
347 { return hvIdMapping.getLArElectrodeIDvec(id); };
348 return getData (idfunc, attrLists);
349}
EMBHVData 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()

EMBHVManager::EMBHVData EMBHVManager::getDataSim ( ) const

Definition at line 324 of file EMBHVManager.cxx.

325{
326 std::vector<const CondAttrListCollection*> attrLists;
327 ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "EMBHVManager");
328 const CondAttrListCollection* atrlistcol = nullptr;
329 // Not a typo --- this folder has a lower-case l in the database...
330 if (detStore->retrieve(atrlistcol, "/LAR/DCS/HV/BARREl/I16").isSuccess()) {
331 attrLists.push_back (atrlistcol);
332 }
333 if (detStore->retrieve(atrlistcol, "/LAR/DCS/HV/BARREL/I8").isSuccess()) {
334 attrLists.push_back (atrlistcol);
335 }
336 return getData (SimIdFunc(), attrLists);
337}

◆ getDescriptor()

const EMBHVDescriptor & EMBHVManager::getDescriptor ( ) const

Definition at line 169 of file EMBHVManager.cxx.

170{
171 return m_c->descriptor;
172}

◆ getHVModule()

const EMBHVModule & EMBHVManager::getHVModule ( unsigned int iSide,
unsigned int iEta,
unsigned int iPhi,
unsigned int iSector ) const

Definition at line 194 of file EMBHVManager.cxx.

195{
196 return *(m_c->moduleArray[iSide][iEta][iPhi][iSector]);
197}
@ iPhi
Definition ParamDefs.h:47
setScale setgFexType iEta

◆ hvLineNo()

int EMBHVManager::hvLineNo ( const EMBHVElectrode & electrode,
int gap,
const LArHVIdMapping * hvIdMapping,
HWIdentifier * hvlId = nullptr ) const

Definition at line 352 of file EMBHVManager.cxx.

356{
357 const EMBHVModule& module = electrode.getModule();
358 int etaIndex = module.getEtaIndex();
359 int phiIndex = module.getPhiIndex();
360 int sectorIndex = module.getSectorIndex();
361 int sideIndex = module.getSideIndex();
362 int electrodeIndex = electrode.getElectrodeIndex();
363
364 // ________________________ Construct ElectrodeID ________________________________
365 int id_detector = 0;
366 int id_zside = 1 - sideIndex;
367 int id_hv_phi = (sideIndex==1 ? sectorIndex : 1-sectorIndex);
368 int id_hv_eta = etaIndex;
369 int id_gap = (sideIndex==0 ? 1-gap : gap);
370 int tmpPhi = phiIndex;
371 if(sectorIndex==1) {
372 if(tmpPhi==15) {
373 tmpPhi=0;
374 }
375 else {
376 tmpPhi += 1;
377 }
378 }
379
380 int id_module;
381 if(sideIndex==1) {
382 id_module = tmpPhi;
383 }
384 else {
385 if(tmpPhi<9) {
386 id_module = 8-tmpPhi;
387 }
388 else {
389 id_module = 24-tmpPhi;
390 }
391 }
392
393 int id_electrode;
394 if(sideIndex==0) {
395 if(id_hv_phi==1) {
396 id_electrode = 31-electrodeIndex;
397 }
398 else {
399 id_electrode = 63-electrodeIndex;
400 }
401 }
402 else {
403 if(id_hv_phi==0) {
404 id_electrode = electrodeIndex+32;
405 }
406 else {
407 id_electrode = electrodeIndex;
408 }
409 }
410
411 HWIdentifier elecHWID = m_c->elecId->ElectrodeId(id_detector
412 , id_zside
413 , id_module
414 , id_hv_phi
415 , id_hv_eta
416 , id_gap
417 , id_electrode);
418 // ________________________ ________________________________
419
420 // Get LArHVLineID corresponding to a given LArElectrodeId
421 HWIdentifier id = hvIdMapping->getLArHVLineID(elecHWID);
422
423 if(hvlId) *hvlId=id;
424
425 // Extract HV Line No
426 return m_c->hvId->can_node(id)*1000 + m_c->hvId->hv_line(id);
427}
const EMBHVModule & getModule() const
unsigned int getElectrodeIndex() const
const HWIdentifier getLArHVLineID(HWIdentifier &electrodeId) const
Return the LArHVLineID corresponding to a given LArElectrodeId.
gap(flags, cells_name, *args, **kw)

◆ operator=()

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

◆ ImaginaryFriend

friend class ImaginaryFriend
friend

Definition at line 103 of file EMBHVManager.h.

Member Data Documentation

◆ m_c

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

Definition at line 105 of file EMBHVManager.h.


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