ATLAS Offline Software
Loading...
Searching...
No Matches
EMECCell.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12// Class EMECCell
13
15= default;
16
17unsigned int EMECCell::getNumElectrodes() const {
18 return getHVInfo().m_electrode.size();
19}
20
21const EMECHVElectrode& EMECCell::getElectrode (unsigned int i) const {
22 return *getHVInfo().m_electrode[i];
23}
24
28
29
31{
32 if (!m_hvinfo.isValid()) {
33 HVInfo hvinfo;
34 initHV (hvinfo);
35 m_hvinfo.set (std::move (hvinfo));
36 }
37 return *m_hvinfo.ptr();
38}
39
40
41void EMECCell::initHV (HVInfo& hvinfo) const
42{
43 if (getSamplingIndex()==0) {
45 double phiUpper = getPhiMaxNominal();
46 double phiLower = getPhiMinNominal();
47 double phi=fabs(phiUpper+phiLower)/2.0;
48
49 const CellBinning * phiBinning=presamplerHVManager.getPhiBinning();
50 unsigned int iPhi = int((phi - phiBinning->getStart())/phiBinning->getDelta()) + phiBinning->getFirstDivisionNumber();
51 unsigned int iSide=getEndcapIndex();
52 hvinfo.m_presamplerModule = &(presamplerHVManager.getHVModule(iSide,iPhi));
53
54 }
55 else {
56
57 double eta=fabs(getEtaMax()+getEtaMin())/2.0;
59 //std::cout << "in EMECCell::initHV() eta,type " << eta << " " << iotype << std::endl;
60
61 const EMECHVManager& hvManager=getDescriptor()->getManager()->getHVManager(iotype);
62 double phiLower = getPhiMinNominal();
63 double phiUpper = getPhiMaxNominal();
64 double phiMid=(phiLower+phiUpper)/2.0;
65
66 const CellPartitioning & etaBinning=hvManager.getDescriptor().getEtaBinning();
67 const CellBinning & phiBinning=hvManager.getDescriptor().getPhiBinning();
68 const CellBinning & sectorBinning=hvManager.getDescriptor().getSectorBinning();
69 unsigned int iEta=0;
70 for (unsigned int i=etaBinning.getFirstDivisionNumber();i<=etaBinning.getFirstDivisionNumber()+etaBinning.getNumDivisions();i++) {
71 if (eta>=etaBinning.binLower(i) && eta<=etaBinning.binUpper(i)) {
72 iEta=i;
73 }
74 }
75 unsigned int iPhi = int((phiMid - phiBinning.getStart())/phiBinning.getDelta()) + phiBinning.getFirstDivisionNumber();
76
77 double N = iotype==EMECHVModule::OUTER ? 768:256;
78
79 unsigned int iSector = int((phiMid - phiBinning.binLower(iPhi) - sectorBinning.getStart())/sectorBinning.getDelta()) + sectorBinning.getFirstDivisionNumber();
80 double phiSectorStart = phiBinning.binLower(iPhi) +iSector*sectorBinning.getDelta();
81
82 unsigned int iSide=getEndcapIndex();
83
84 double phi0 = (iSide==1) ? M_PI/N : -(M_PI)/N; // delta phi between first absorber and electrode at phi=0
85
86 const double inv_2pi = M_1_PI/2;
87 unsigned int iOffset = int(N*(phiLower-phiSectorStart + phi0)*inv_2pi +0.5);
88 double dPhi = fabs((phiUpper-phiLower));
89 unsigned int NE =int(dPhi*inv_2pi*N+0.5);
90
91 //std::cout << " iSide,iEta,iPhi,iSector " << iSide << " " << iEta << " " << iPhi << " " << iSector << std::endl;
92 //std::cout << " phi1,phi2 cell, phi1 sector " << phiLower << " " << phiUpper << " " << phiSectorStart << std::endl;
93 //std::cout << " first electrode " << iOffset << " " << " Nelectrodes " << NE << std::endl;
94
95
96
97 const EMECHVModule& hvMod = hvManager.getHVModule(iSide,iEta,iPhi,iSector);
98 //std::cout << " hvMod << " << hvMod << std::endl;
99 for (unsigned int iElectrode=iOffset;iElectrode<iOffset+NE;iElectrode++) {
100 const EMECHVElectrode& hvElec = hvMod.getElectrode(iElectrode);
101 hvinfo.m_electrode.push_back(&hvElec);
102 }
103
104 }
105}
106
107
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
double getEtaMax() const
Maximum Eta.
Definition EMECCell.h:300
const EMECHVElectrode & getElectrode(unsigned int i) const
@Get electrode
Definition EMECCell.cxx:21
const EMECPresamplerHVModule & getPresamplerHVModule() const
@Get HVModule (presampler cells)
Definition EMECCell.cxx:25
unsigned int getEndcapIndex() const
The EndcapIndex of this Cell (0=negatiive, 1=positive)
Definition EMECCell.h:194
double getPhiMaxNominal() const
returns a nominal phi max in global coords; assume canonical placement
Definition EMECCell.h:288
virtual ~EMECCell()
const EMECDetDescr * getDescriptor() const
Returns a pointer to the descriptor.
Definition EMECCell.h:229
CxxUtils::CachedValue< HVInfo > m_hvinfo
Definition EMECCell.h:163
void initHV(HVInfo &hvinfo) const
Definition EMECCell.cxx:41
double getEtaMin() const
Minimum Eta.
Definition EMECCell.h:293
unsigned int getSamplingIndex() const
The sampling index of this cell.
Definition EMECCell.h:208
const HVInfo & getHVInfo() const
Definition EMECCell.cxx:30
unsigned int getNumElectrodes() const
@Get num electrodes
Definition EMECCell.cxx:17
double getPhiMinNominal() const
returns a nominal phi min in global coords; assume canonical placement
Definition EMECCell.h:283
const EMECDetectorManager * getManager() const
The manager.
const EMECPresamplerHVManager & getPresamplerHVManager() const
Get the HV Manager (presampler)
const EMECHVManager & getHVManager(EMECHVManager::IOType io) const
Get the HV Managers.
const CellPartitioning & getEtaBinning() const
const CellBinning & getSectorBinning() const
const CellBinning & getPhiBinning() const
This class provides direct access to information on the HV electrodes within the EMEC.
const EMECHVDescriptor & getDescriptor() const
const EMECHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
const EMECHVElectrode & getElectrode(unsigned int iElectrode) const
This class provides direct access to information on the HV electrodes within the EMEC.
const CellBinning * getPhiBinning() const
const EMECPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iPhi) const
Describes one HV Module within the EMEc Presampler.
std::vector< const EMECHVElectrode * > m_electrode
Definition EMECCell.h:160
const EMECPresamplerHVModule * m_presamplerModule
Definition EMECCell.h:161