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

This class provides direct access to information on the HV electrodes within the EMEC. 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}
#define M_PI
std::unique_ptr< const Clockwork > m_c

◆ ~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 const 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}
#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]

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) -> const std::vector<HWIdentifier>
392 { return hvIdMapping.getLArElectrodeIDvec(id); };
393 return getData (idfunc, attrLists);
394}
EMECHVData 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()

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}
@ iPhi
Definition ParamDefs.h:47
setScale setgFexType iEta

◆ 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 397 of file EMECHVManager.cxx.

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

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