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

This class provides direct access to information on the HV electrodes within the EMEC. 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 <EMECHVManager.h>

Collaboration diagram for EMECHVManager:

Classes

class  Clockwork
 
class  EMECHVData
 

Public Types

typedef EMECHVModule::IOType IOType
 

Public Member Functions

 EMECHVManager (IOType wheel)
 
 ~EMECHVManager ()
 
const EMECHVDescriptorgetDescriptor () const
 
unsigned int beginPhiIndex () const
 
unsigned int endPhiIndex () const
 
unsigned int beginEtaIndex () const
 
unsigned int endEtaIndex () const
 
const EMECHVModulegetHVModule (unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
 
unsigned int beginSectorIndex () const
 
unsigned int endSectorIndex () const
 
EMECHVManager::IOType getWheelIndex () const
 
EMECHVData getDataSim () const
 
EMECHVData getData (const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
 
int hvLineNo (const EMECHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
 

Static Public Member Functions

static unsigned int beginSideIndex ()
 
static unsigned int endSideIndex ()
 

Private Types

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

Private Member Functions

EMECHVData getData (const idfunc_t &idfunc, const std::vector< const CondAttrListCollection * > &attrLists) const
 
EMECHVManageroperator= (const EMECHVManager &right)=delete
 
 EMECHVManager (const EMECHVManager &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 EMEC. 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 EMECHVManager.h.

Member Typedef Documentation

◆ idfunc_t

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

Definition at line 99 of file EMECHVManager.h.

◆ IOType

Definition at line 38 of file EMECHVManager.h.

Constructor & Destructor Documentation

◆ EMECHVManager() [1/2]

EMECHVManager::EMECHVManager ( IOType  wheel)

Definition at line 172 of file EMECHVManager.cxx.

173 {
174  std::unique_ptr<EMECHVDescriptor> descriptor;
175  if (wheel==EMECHVModule::OUTER) {
176  CellPartitioning etaBinning;
177  etaBinning.addValue(1.375);
178  etaBinning.addValue(1.50);
179  etaBinning.addValue(1.6);
180  etaBinning.addValue(1.8);
181  etaBinning.addValue(2.0);
182  etaBinning.addValue(2.1);
183  etaBinning.addValue(2.3);
184  etaBinning.addValue(2.5);
185  descriptor = std::make_unique<EMECHVDescriptor>(etaBinning,CellBinning(0.0, 2*M_PI, 8),CellBinning(0,M_PI/4.0,4));
186  }
187  else {
188  CellPartitioning etaBinning;
189  etaBinning.addValue(2.5);
190  etaBinning.addValue(2.8);
191  etaBinning.addValue(3.2);
192  descriptor = std::make_unique<EMECHVDescriptor>(etaBinning,CellBinning(0.0, 2*M_PI, 8),CellBinning(0,M_PI/4.0,8));
193  }
194  m_c = std::make_unique<Clockwork> (this, wheel, std::move(descriptor));
195 }

◆ ~EMECHVManager()

EMECHVManager::~EMECHVManager ( )
default

◆ EMECHVManager() [2/2]

EMECHVManager::EMECHVManager ( const EMECHVManager right)
privatedelete

Member Function Documentation

◆ beginEtaIndex()

unsigned int EMECHVManager::beginEtaIndex ( ) const

Definition at line 212 of file EMECHVManager.cxx.

213 {
214  return m_c->descriptor->getEtaBinning().getFirstDivisionNumber();
215 }

◆ beginPhiIndex()

unsigned int EMECHVManager::beginPhiIndex ( ) const

Definition at line 202 of file EMECHVManager.cxx.

203 {
204  return m_c->descriptor->getPhiBinning().getFirstDivisionNumber();
205 }

◆ beginSectorIndex()

unsigned int EMECHVManager::beginSectorIndex ( ) const

Definition at line 240 of file EMECHVManager.cxx.

241 {
242  return m_c->descriptor->getSectorBinning().getFirstDivisionNumber();
243 }

◆ beginSideIndex()

unsigned int EMECHVManager::beginSideIndex ( )
static

Definition at line 230 of file EMECHVManager.cxx.

231 {
232  return 0;
233 }

◆ endEtaIndex()

unsigned int EMECHVManager::endEtaIndex ( ) const

Definition at line 217 of file EMECHVManager.cxx.

218 {
219  return m_c->descriptor->getEtaBinning().getFirstDivisionNumber() + m_c->descriptor->getEtaBinning().getNumDivisions();
220 }

◆ endPhiIndex()

unsigned int EMECHVManager::endPhiIndex ( ) const

Definition at line 207 of file EMECHVManager.cxx.

208 {
209  return m_c->descriptor->getPhiBinning().getFirstDivisionNumber() + m_c->descriptor->getPhiBinning().getNumDivisions();
210 }

◆ endSectorIndex()

unsigned int EMECHVManager::endSectorIndex ( ) const

Definition at line 245 of file EMECHVManager.cxx.

246 {
247  return m_c->descriptor->getSectorBinning().getFirstDivisionNumber() + m_c->descriptor->getSectorBinning().getNumDivisions();
248 }

◆ endSideIndex()

unsigned int EMECHVManager::endSideIndex ( )
static

Definition at line 235 of file EMECHVManager.cxx.

236 {
237  return 2;
238 }

◆ getData() [1/2]

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

Definition at line 256 of file EMECHVManager.cxx.

258 {
259  auto payload = std::make_unique<EMECHVData::Payload>();
260 
261  if (m_c->iWheel==EMECHVModule::OUTER) {
262  payload->m_payloadArray.reserve(2*7*8*4*24);
263  for (unsigned int i=0;i<10752;i++) {
264  payload->m_payloadArray[i].voltage[0] = EMECHVData::INVALID;
265  payload->m_payloadArray[i].voltage[1] = EMECHVData::INVALID;
266  }
267  }
268  else if (m_c->iWheel==EMECHVModule::INNER) {
269  payload->m_payloadArray.reserve(2*2*8*8*4);
270  for (unsigned int i=0;i<1024;i++) {
271  payload->m_payloadArray[i].voltage[0] = EMECHVData::INVALID;
272  payload->m_payloadArray[i].voltage[1] = EMECHVData::INVALID;
273  }
274  }
275 
276  for (const CondAttrListCollection* atrlistcol : attrLists) {
277 
278  for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) {
279  // Construct HWIdentifier
280  // 1. decode COOL Channel ID
281  unsigned int chanID = (*citr).first;
282  int cannode = chanID/1000;
283  int line = chanID%1000;
284 
285  // 2. Construct the identifier
286  HWIdentifier id = m_c->hvId->HVLineId(1,1,cannode,line);
287 
288 
289  std::vector<HWIdentifier> electrodeIdVec = idfunc(id);
290 
291  for(size_t i=0;i<electrodeIdVec.size();i++) {
292  HWIdentifier& elecHWID = electrodeIdVec[i];
293 
294  int detector = m_c->elecId->detector(elecHWID);
295  // check we are in EMEC
296  if (detector==2) {
297 
298 
299  unsigned int etaIndex=m_c->elecId->hv_eta(elecHWID);
300 
301  if ( (etaIndex>6 && m_c->iWheel==EMECHVModule::INNER) || (etaIndex<7 && m_c->iWheel==EMECHVModule::OUTER) ) {
302 
303  unsigned int sideIndex=1-m_c->elecId->zside(elecHWID);
304  unsigned int phiIndex=m_c->elecId->module(elecHWID); // 0 to 7
305 // rotation for C side
306  if (sideIndex==0) {
307  if (phiIndex<4) phiIndex=3-phiIndex;
308  else phiIndex=11-phiIndex;
309  }
310  unsigned int sectorIndex=m_c->elecId->hv_phi(elecHWID)-1; // 0 to 3 in Outer, 0 to 7 in Inner
311 // rotation for C side
312  if (sideIndex==0) {
313  if (m_c->iWheel==EMECHVModule::OUTER) sectorIndex=3-sectorIndex;
314  else sectorIndex=7-sectorIndex;
315  }
316  unsigned int electrodeIndex = m_c->iWheel==EMECHVModule::OUTER ?
317  m_c->elecId->electrode(elecHWID)%24:
318  m_c->elecId->electrode(elecHWID)%4;
319 // rotation for C side
320  if (sideIndex==0) {
321  if (m_c->iWheel==EMECHVModule::OUTER) electrodeIndex=23-electrodeIndex;
322  else electrodeIndex=3-electrodeIndex;
323  }
324 
325  unsigned int index = m_c->iWheel==EMECHVModule::OUTER ?
326  5376*sideIndex+768*etaIndex+96*phiIndex+24*sectorIndex+electrodeIndex:
327  512*sideIndex+256*(etaIndex-7)+32*phiIndex+4*sectorIndex+electrodeIndex;
328 
329  if (m_c->iWheel==EMECHVModule::OUTER && index>10752) {
330  MsgStream msg (Athena::getMessageSvc(), "EMECHVManager");
331  msg << MSG::ERROR << "invalid index outer " << index << " side,eta,phi,sector,electrode " << sideIndex << " " << etaIndex << " " << phiIndex <<
332  " " << sectorIndex << " " << electrodeIndex << endmsg;
333  continue;
334  }
335  if (m_c->iWheel==EMECHVModule::INNER && index>1024) {
336  MsgStream msg (Athena::getMessageSvc(), "EMECHVManager");
337  msg << MSG::ERROR << "invalid index inner " << index << " side,eta,phi,sector,electrode " << sideIndex << " " << etaIndex << " " << phiIndex <<
338  " " << sectorIndex << " " << electrodeIndex << endmsg;
339  continue;
340  }
341 
342  unsigned int gapIndex=m_c->elecId->gap(elecHWID);
343  if (gapIndex>1) {
344  MsgStream msg (Athena::getMessageSvc(), "EMECHVManager");
345  msg << MSG::ERROR << "invalid gapIndex " << gapIndex << endmsg;
346  continue;
347  }
348  if (sideIndex==0) gapIndex=1-gapIndex;
349 
350  float voltage = EMECHVData::INVALID;;
351  if (!((*citr).second)["R_VMEAS"].isNull()) voltage = ((*citr).second)["R_VMEAS"].data<float>();
352  float current = 0.;
353  if (!((*citr).second)["R_IMEAS"].isNull()) current = ((*citr).second)["R_IMEAS"].data<float>();
354 
355 
356  payload->m_payloadArray[index].voltage[gapIndex]=voltage;
357  payload->m_payloadArray[index].current[gapIndex]=current;
358  payload->m_payloadArray[index].hvLineNo[gapIndex]=chanID;
359  } // if etaIndex...
360  } // for (electrodeIdVec)
361  } // is EMEC
362  } // for (atrlistcol)
363  }
364 
365  return {std::move (payload)};
366 }

◆ getData() [2/2]

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

Definition at line 388 of file EMECHVManager.cxx.

390 {
391  auto idfunc = [&] (HWIdentifier id) { return hvIdMapping.getLArElectrodeIDvec(id); };
392  return getData (idfunc, attrLists);
393 }

◆ getDataSim()

EMECHVManager::EMECHVData EMECHVManager::getDataSim ( ) const

Definition at line 370 of file EMECHVManager.cxx.

371 {
372  std::vector<const CondAttrListCollection*> attrLists;
373  ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "EMBHVManager");
374  const CondAttrListCollection* atrlistcol = nullptr;
375  // Not a typo --- this folder has a lower-case l in the database...
376  if (detStore->retrieve(atrlistcol, "/LAR/DCS/HV/BARREl/I16").isSuccess()) {
377  attrLists.push_back (atrlistcol);
378  }
379  if (detStore->retrieve(atrlistcol, "/LAR/DCS/HV/BARREL/I8").isSuccess()) {
380  attrLists.push_back (atrlistcol);
381  }
382  return getData (SimIdFunc(), attrLists);
383 }

◆ getDescriptor()

const EMECHVDescriptor & EMECHVManager::getDescriptor ( ) const

Definition at line 197 of file EMECHVManager.cxx.

198 {
199  return *(m_c->descriptor);
200 }

◆ getHVModule()

const EMECHVModule & EMECHVManager::getHVModule ( unsigned int  iSide,
unsigned int  iEta,
unsigned int  iPhi,
unsigned int  iSector 
) const

Definition at line 222 of file EMECHVManager.cxx.

223 {
224  return *(m_c->moduleArray[iSide][iEta][iPhi][iSector]);
225 }

◆ getWheelIndex()

EMECHVManager::IOType EMECHVManager::getWheelIndex ( ) const

Definition at line 250 of file EMECHVManager.cxx.

251 {
252  return m_c->iWheel;
253 }

◆ hvLineNo()

int EMECHVManager::hvLineNo ( const EMECHVElectrode electrode,
int  gap,
const LArHVIdMapping hvIdMapping,
HWIdentifier hvlId = nullptr 
) const

Definition at line 396 of file EMECHVManager.cxx.

400 {
401  const EMECHVModule& module = electrode.getModule();
402  int etaIndex = module.getEtaIndex();
403  int phiIndex = module.getPhiIndex();
404  int sectorIndex = module.getSectorIndex();
405  int sideIndex = module.getSideIndex();
406  int electrodeIndex = electrode.getElectrodeIndex();
407 
408  // ________________________ Construct ElectrodeID ________________________________
409  int id_detector = 2;
410  int id_zside = 1-sideIndex;
411  int id_hv_eta = m_c->iWheel==EMECHVModule::OUTER ? etaIndex : etaIndex+7;
412 
413  int id_module{0};
414  if(sideIndex==0) {
415  if(phiIndex<4) {
416  id_module=3-phiIndex;
417  }
418  else {
419  id_module=11-phiIndex;
420  }
421  }
422  else {
423  id_module = phiIndex;
424  }
425 
426  int id_hv_phi{0};
427  if(sideIndex==0) {
428  if (m_c->iWheel==EMECHVModule::OUTER) {
429  id_hv_phi=4-sectorIndex;
430  }
431  else {
432  id_hv_phi=8-sectorIndex;
433  }
434  }
435  else {
436  id_hv_phi=sectorIndex+1;
437  }
438 
439  int tmpElec{0};
440  if(sideIndex==0) {
441  if (m_c->iWheel==EMECHVModule::OUTER) {
442  tmpElec = 23-electrodeIndex;
443  }
444  else {
445  tmpElec = 3 - electrodeIndex;
446  }
447  }
448  else {
449  tmpElec = electrodeIndex;
450  }
451  int id_electrode = m_c->iWheel==EMECHVModule::OUTER
452  ? (id_hv_phi-1)*24 + tmpElec
453  : (id_hv_phi-1)*4 + tmpElec;
454 
455  int id_gap = sideIndex==0 ? 1-gap : gap;
456 
457  HWIdentifier elecHWID = m_c->elecId->ElectrodeId(id_detector
458  , id_zside
459  , id_module
460  , id_hv_phi
461  , id_hv_eta
462  , id_gap
463  , id_electrode);
464  // ________________________ Construct ElectrodeID ________________________________
465 
466  // Get LArHVLineID corresponding to a given LArElectrodeId
467  HWIdentifier id = hvIdMapping->getLArHVLineID(elecHWID);
468 
469  if(hvlId) *hvlId=id;
470 
471  // Extract HV Line No
472  return m_c->hvId->can_node(id)*1000 + m_c->hvId->hv_line(id);
473 }

◆ operator=()

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

Member Data Documentation

◆ m_c

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

Definition at line 107 of file EMECHVManager.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
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
EMECHVManager::getData
EMECHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
Definition: EMECHVManager.cxx:388
M_PI
#define M_PI
Definition: ActiveFraction.h:11
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
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
EMECHVModule
Definition: EMECHVModule.h:20
python.PyAthena.module
module
Definition: PyAthena.py:131
EMECHVManager::m_c
std::unique_ptr< const Clockwork > m_c
Definition: EMECHVManager.h:106
EMECHVModule::INNER
@ INNER
Definition: EMECHVModule.h:22
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EMECHVManager::EMECHVData::INVALID
static constexpr double INVALID
Definition: EMECHVManager.h:43
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
EMECHVElectrode::getModule
const EMECHVModule & getModule() const
Definition: EMECHVElectrode.cxx:37
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
EMECHVModule::OUTER
@ OUTER
Definition: EMECHVModule.h:22
DeMoScan.index
string index
Definition: DeMoScan.py:364
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
EMECHVElectrode::getElectrodeIndex
unsigned int getElectrodeIndex() const
Definition: EMECHVElectrode.cxx:27
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:77
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
LArHVIdMapping::getLArElectrodeIDvec
const std::vector< HWIdentifier > & getLArElectrodeIDvec(HWIdentifier &hvlineId) const
Return a vector of LArElectrodeID corresponding to a given LArHVLineID.
Definition: LArHVIdMapping.cxx:84
ServiceHandle< StoreGateSvc >