ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
EMBHVManager Class Reference

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). 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) 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 95 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 }

◆ ~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  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 }

◆ 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) { return hvIdMapping.getLArElectrodeIDvec(id); };
347  return getData (idfunc, attrLists);
348 }

◆ 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 }

◆ hvLineNo()

int EMBHVManager::hvLineNo ( const EMBHVElectrode electrode,
int  gap,
const LArHVIdMapping hvIdMapping 
) const

Definition at line 351 of file EMBHVManager.cxx.

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

◆ operator=()

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

Friends And Related Function Documentation

◆ ImaginaryFriend

friend class ImaginaryFriend
friend

Definition at line 102 of file EMBHVManager.h.

Member Data Documentation

◆ m_c

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

Definition at line 104 of file EMBHVManager.h.


The documentation for this class was generated from the following files:
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
checkFileSG.line
line
Definition: checkFileSG.py:75
index
Definition: index.py:1
LArHVIdMapping::getLArHVLineID
const HWIdentifier getLArHVLineID(HWIdentifier &electrodeId) const
Return the LArHVLineID corresponding to a given LArElectrodeId.
Definition: LArHVIdMapping.cxx:22
HWIdentifier
Definition: HWIdentifier.h:13
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
TRT::Hit::detector
@ detector
Definition: HitInfo.h:78
python.PyAthena.module
module
Definition: PyAthena.py:134
lumiFormat.i
int i
Definition: lumiFormat.py:92
EMBHVElectrode::getElectrodeIndex
unsigned int getElectrodeIndex() const
Definition: EMBHVElectrode.cxx:48
EMBHVManager::m_c
std::unique_ptr< const Clockwork > m_c
Definition: EMBHVManager.h:103
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
EMBHVElectrode::getModule
const EMBHVModule & getModule() const
Definition: EMBHVElectrode.cxx:32
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
EMBHVManager::EMBHVData::INVALID
static constexpr double INVALID
Definition: EMBHVManager.h:41
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:53
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
DeMoScan.index
string index
Definition: DeMoScan.py:362
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
EMBHVManager::getData
EMBHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
Definition: EMBHVManager.cxx:343
EMBHVModule
Describes one HV Module within the EMB.
Definition: EMBHVModule.h:20
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
LArHVIdMapping::getLArElectrodeIDvec
const std::vector< HWIdentifier > & getLArElectrodeIDvec(HWIdentifier &hvlineId) const
Return a vector of LArElectrodeID corresponding to a given LArHVLineID.
Definition: LArHVIdMapping.cxx:83
ServiceHandle< StoreGateSvc >