ATLAS Offline Software
Loading...
Searching...
No Matches
EMBCell.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "LArHV/EMBHVModule.h"
14
16= default;
17
18
19double EMBCell::getPhiLocalLower(double /*r*/) const {
20 return getPhiLocalLower();
21}
22
23double EMBCell::getPhiLocalUpper(double /*r*/) const {
24 return getPhiLocalUpper();
25}
26
27unsigned int EMBCell::getNumElectrodes() const {
28 return getHVInfo().m_electrode.size();
29}
30
31const EMBHVElectrode & EMBCell::getElectrode (unsigned int i) const {
32 return *getHVInfo().m_electrode[i];
33}
34
38
39
41{
42 if (!m_hvinfo.isValid()) {
43 HVInfo hvinfo;
44 initHV (hvinfo);
45 m_hvinfo.set (std::move (hvinfo));
46 }
47 return *m_hvinfo.ptr();
48}
49
50
51void EMBCell::initHV (HVInfo& hvinfo) const
52{
53 if (getSamplingIndex()==0) {
55 double phiUpper = getPhiMaxNominal();
56 double phiLower = getPhiMinNominal();
57 double eta=fabs(getEtaMax()+getEtaMin())/2.0;
58 double phi=fabs(phiUpper+phiLower)/2.0;
59
60 const CellPartitioning & etaBinning=presamplerHVManager.getDescriptor()->getEtaPartitioning();
61 const CellBinning & phiBinning=presamplerHVManager.getDescriptor()->getPhiBinning();
62
63 unsigned int iPhi = int((phi - phiBinning.getStart())/phiBinning.getDelta()) + phiBinning.getFirstDivisionNumber();
64 unsigned int iEta = etaBinning.getFirstDivisionNumber();
65 unsigned int lastDivision=etaBinning.getFirstDivisionNumber()+etaBinning.getNumDivisions();
66 while (iEta<lastDivision) {
67 double etaMax=etaBinning.binUpper(iEta);
68 double etaMin=etaBinning.binLower(iEta);
69 if (eta>etaMin && eta<etaMax) break;
70 iEta++;
71 }
72 if (iEta==lastDivision) throw std::runtime_error ("Error in EMBCell: Presampler HV not found");
73
74 unsigned int iSide=getEndcapIndex();
75 hvinfo.m_presamplerModule = &(presamplerHVManager.getHVModule(iSide,iEta,iPhi));
76
77 }
78 else {
79 // M_PI - phi for left side
80
81 const EMBHVManager& hvManager=getDescriptor()->getManager()->getHVManager();
82 double phiUpper = getPhiMaxNominal();
83 double phiLower = getPhiMinNominal();
84
85
86
87 double eta=fabs(getEtaMax()+getEtaMin())/2.0;
88 double phi=fabs(phiUpper+phiLower)/2.0;
89 const CellBinning & etaBinning=hvManager.getDescriptor().getEtaBinning();
90 const CellBinning & phiBinning=hvManager.getDescriptor().getPhiBinning();
91 unsigned int iEta = int((eta - etaBinning.getStart())/etaBinning.getDelta()) + etaBinning.getFirstDivisionNumber();
92 unsigned int iPhi = int((phi - phiBinning.getStart())/phiBinning.getDelta()) + phiBinning.getFirstDivisionNumber();
93 unsigned int iSector = int(2.0*(phi - phiBinning.binLower(iPhi))/phiBinning.getDelta());
94 unsigned int iSide=getEndcapIndex();
95
96 if (iEta==8) iEta=7;
97
98 const EMBHVModule& hvMod = hvManager.getHVModule(iSide,iEta,iPhi,iSector);
99 double dPhi = fabs((phiUpper-phiLower));
100 double phi0 = (iSide==1) ? M_PI/1024 : -(M_PI)/1024; // delta phi between first absorber and electrode at phi=0
101 double sPhi = phiLower-hvMod.getPhiMin() + phi0;
102 unsigned int iOffset=int(sPhi*(M_1_PI/2*1024.)+0.5);
103 unsigned int N =int(dPhi*(M_1_PI/2*1024.)+0.5);
104 // std::cout << " EMBCell eta,phi1,phi2 cell, phiMinModule " << eta << " " << phiLower << " " << phiUpper << " " << hvMod->getPhiMin() << std::endl;
105
106 for (unsigned int iElectrode=iOffset;iElectrode<iOffset+N;iElectrode++) {
107 const EMBHVElectrode& hvElec = hvMod.getElectrode(iElectrode);
108 hvinfo.m_electrode.push_back(&hvElec);
109 }
110
111 }
112}
113
114
116 m_hvPathologies.push_back(pathologies);
117}
118
119unsigned int EMBCell::getNumHVPathologies ()const{
120 return m_hvPathologies.size();
121}
122
124 return m_hvPathologies[i];
125}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
GeoIntrusivePtr< const EMBHVPathologies > EMBHVPathologiesConstLink
double getPhiMinNominal() const
returns a nominal phi min in global coords; assume canonical placement
Definition EMBCell.h:269
unsigned int getEndcapIndex() const
The Side Index of this Cell (0=negatiive, 1=positive)
Definition EMBCell.h:210
const EMBHVPathologiesConstLink & getHVPathologies(unsigned int i) const
@Get HVPathologies
Definition EMBCell.cxx:123
void initHV(HVInfo &hvinfo) const
Definition EMBCell.cxx:51
unsigned int getNumElectrodes() const
@Get num electrodes
Definition EMBCell.cxx:27
unsigned int getNumHVPathologies() const
@Get num HVPathologies
Definition EMBCell.cxx:119
double getEtaMin() const
Minimum Eta.
Definition EMBCell.h:279
const HVInfo & getHVInfo() const
Definition EMBCell.cxx:40
CxxUtils::CachedValue< HVInfo > m_hvinfo
Definition EMBCell.h:183
const EMBHVElectrode & getElectrode(unsigned int i) const
@Get electrode
Definition EMBCell.cxx:31
const EMBDetDescr * getDescriptor() const
Returns a pointer to the descriptor.
Definition EMBCell.h:230
double getEtaMax() const
Maximum Eta.
Definition EMBCell.h:284
void addHVPathologies(const EMBHVPathologiesConstLink &)
@Add HVPathologies
Definition EMBCell.cxx:115
virtual ~EMBCell()
double getPhiLocalUpper() const
Gets the phi value at the "upper" edge of a cell.
Definition EMBCell.h:264
unsigned int getSamplingIndex() const
The sampling index of this cell.
Definition EMBCell.h:220
const EMBPresamplerHVModule & getPresamplerHVModule() const
@Get HVModule (presampler cells)
Definition EMBCell.cxx:35
double getPhiMaxNominal() const
returns a nominal phi max in global coords; assume canonical placement
Definition EMBCell.h:274
std::vector< EMBHVPathologiesConstLink > m_hvPathologies
Definition EMBCell.h:185
double getPhiLocalLower() const
Gets the phi value at the "lower" edge of a cell.
Definition EMBCell.h:259
const EMBDetectorManager * getManager() const
The manager.
const EMBPresamplerHVManager & getPresamplerHVManager() const
Get the HV Manager (Presampler)
const EMBHVManager & getHVManager() const
Get the HV Manager.
const CellBinning & getEtaBinning() const
const CellBinning & getPhiBinning() const
This class provides direct access to information on the HV electrodes within the barrels.
const EMBHVDescriptor & getDescriptor() const
const EMBHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
Describes one HV Module within the EMB.
Definition EMBHVModule.h:20
const EMBHVElectrode & getElectrode(unsigned int iElectrode) const
double getPhiMin() const
const CellPartitioning & getEtaPartitioning() const
const CellBinning & getPhiBinning() const
This class provides direct access to information on the HV electrodes within the barrels.
const EMBPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi) const
const EMBPresamplerHVDescriptor * getDescriptor() const
Describes one HV Module within the EMB Presampler.
const EMBPresamplerHVModule * m_presamplerModule
Definition EMBCell.h:181
std::vector< const EMBHVElectrode * > m_electrode
Definition EMBCell.h:180