ATLAS Offline Software
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 
8 #include "LArHV/EMBHVManager.h"
9 #include "LArHV/EMBHVModule.h"
10 #include "LArHV/EMBHVElectrode.h"
14 
16 = default;
17 
18 
19 double EMBCell::getPhiLocalLower(double /*r*/) const {
20  return getPhiLocalLower();
21 }
22 
23 double EMBCell::getPhiLocalUpper(double /*r*/) const {
24  return getPhiLocalUpper();
25 }
26 
27 unsigned int EMBCell::getNumElectrodes() const {
28  return getHVInfo().m_electrode.size();
29 }
30 
31 const EMBHVElectrode & EMBCell::getElectrode (unsigned int i) const {
32  return *getHVInfo().m_electrode[i];
33 }
34 
36  return *getHVInfo().m_presamplerModule;
37 }
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 
51 void EMBCell::initHV (HVInfo& hvinfo) const
52 {
53  if (getSamplingIndex()==0) {
54  const EMBPresamplerHVManager& presamplerHVManager=getDescriptor()->getManager()->getPresamplerHVManager();
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 
119 unsigned int EMBCell::getNumHVPathologies ()const{
120  return m_hvPathologies.size();
121 }
122 
124  return m_hvPathologies[i];
125 }
EMBCell::getHVInfo
const HVInfo & getHVInfo() const
Definition: EMBCell.cxx:40
EMBHVPathologiesConstLink
GeoIntrusivePtr< const EMBHVPathologies > EMBHVPathologiesConstLink
Definition: EMBHVPathologies.h:49
EMBPresamplerHVDescriptor.h
EMBHVElectrode
Definition: EMBHVElectrode.h:15
EMBCell::getPhiLocalUpper
double getPhiLocalUpper() const
Gets the phi value at the "upper" edge of a cell.
Definition: EMBCell.h:264
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
EMBCell::addHVPathologies
void addHVPathologies(const EMBHVPathologiesConstLink &)
@Add HVPathologies
Definition: EMBCell.cxx:115
EMBPresamplerHVManager.h
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
EMBCell::getSamplingIndex
unsigned int getSamplingIndex() const
The sampling index of this cell.
Definition: EMBCell.h:220
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
EMBDetDescr.h
EMBCell::getNumElectrodes
unsigned int getNumElectrodes() const
@Get num electrodes
Definition: EMBCell.cxx:27
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
EMBCell::getElectrode
const EMBHVElectrode & getElectrode(unsigned int i) const
@Get electrode
Definition: EMBCell.cxx:31
EMBDetectorManager::getHVManager
const EMBHVManager & getHVManager() const
Get the HV Manager.
Definition: EMBDetectorManager.cxx:102
EMBDetDescr::getManager
const EMBDetectorManager * getManager() const
The manager.
Definition: EMBDetDescr.h:156
EMBCell::initHV
void initHV(HVInfo &hvinfo) const
Definition: EMBCell.cxx:51
EMBHVElectrode.h
EMBCell::HVInfo
Definition: EMBCell.h:178
EMBCell::HVInfo::m_electrode
std::vector< const EMBHVElectrode * > m_electrode
Definition: EMBCell.h:180
EMBHVManager::getHVModule
const EMBHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
Definition: EMBHVManager.cxx:194
EMBHVManager::getDescriptor
const EMBHVDescriptor & getDescriptor() const
Definition: EMBHVManager.cxx:169
EMBPresamplerHVManager
This class provides direct access to information on the HV electrodes within the barrels....
Definition: EMBPresamplerHVManager.h:37
EMBCell.h
EMBCell::m_hvPathologies
std::vector< EMBHVPathologiesConstLink > m_hvPathologies
Definition: EMBCell.h:185
EMBCell::getPresamplerHVModule
const EMBPresamplerHVModule & getPresamplerHVModule() const
@Get HVModule (presampler cells)
Definition: EMBCell.cxx:35
lumiFormat.i
int i
Definition: lumiFormat.py:92
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
EMBCell::HVInfo::m_presamplerModule
const EMBPresamplerHVModule * m_presamplerModule
Definition: EMBCell.h:181
EMBCell::getEtaMin
double getEtaMin() const
Minimum Eta.
Definition: EMBCell.h:279
EMBPresamplerHVManager::getDescriptor
const EMBPresamplerHVDescriptor * getDescriptor() const
Definition: EMBPresamplerHVManager.cxx:147
EMBCell::getDescriptor
const EMBDetDescr * getDescriptor() const
Returns a pointer to the descriptor.
Definition: EMBCell.h:230
EMBCell::getNumHVPathologies
unsigned int getNumHVPathologies() const
@Get num HVPathologies
Definition: EMBCell.cxx:119
EMBCell::getPhiMaxNominal
double getPhiMaxNominal() const
returns a nominal phi max in global coords; assume canonical placement
Definition: EMBCell.h:274
EMBPresamplerHVModule.h
EMBHVModule::getPhiMin
double getPhiMin() const
Definition: EMBHVModule.cxx:99
EMBCell::getPhiMinNominal
double getPhiMinNominal() const
returns a nominal phi min in global coords; assume canonical placement
Definition: EMBCell.h:269
EMBHVManager
This class provides direct access to information on the HV electrodes within the barrels....
Definition: EMBHVManager.h:36
EMBDetectorManager::getPresamplerHVManager
const EMBPresamplerHVManager & getPresamplerHVManager() const
Get the HV Manager (Presampler)
Definition: EMBDetectorManager.cxx:108
EMBPresamplerHVDescriptor::getEtaPartitioning
const CellPartitioning & getEtaPartitioning() const
Definition: EMBPresamplerHVDescriptor.h:17
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:53
EMBHVDescriptor::getEtaBinning
const CellBinning & getEtaBinning() const
Definition: EMBHVDescriptor.h:16
EMBCell::getEndcapIndex
unsigned int getEndcapIndex() const
The Side Index of this Cell (0=negatiive, 1=positive)
Definition: EMBCell.h:210
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
EMBCell::~EMBCell
virtual ~EMBCell()
EMBPresamplerHVDescriptor::getPhiBinning
const CellBinning & getPhiBinning() const
Definition: EMBPresamplerHVDescriptor.h:22
EMBHVModule::getElectrode
const EMBHVElectrode & getElectrode(unsigned int iElectrode) const
Definition: EMBHVModule.cxx:69
EMBCell::getEtaMax
double getEtaMax() const
Maximum Eta.
Definition: EMBCell.h:284
EMBCell::getHVPathologies
const EMBHVPathologiesConstLink & getHVPathologies(unsigned int i) const
@Get HVPathologies
Definition: EMBCell.cxx:123
EMBHVModule
Describes one HV Module within the EMB.
Definition: EMBHVModule.h:20
EMBHVDescriptor::getPhiBinning
const CellBinning & getPhiBinning() const
Definition: EMBHVDescriptor.h:21
EMBPresamplerHVManager::getHVModule
const EMBPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi) const
Definition: EMBPresamplerHVManager.cxx:172
EMBCell::m_hvinfo
CxxUtils::CachedValue< HVInfo > m_hvinfo
Definition: EMBCell.h:183
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
EMBCell::getPhiLocalLower
double getPhiLocalLower() const
Gets the phi value at the "lower" edge of a cell.
Definition: EMBCell.h:259
EMBDetectorManager.h
EMBHVModule.h
EMBHVManager.h
EMBPresamplerHVModule
Describes one HV Module within the EMB Presampler.
Definition: EMBPresamplerHVModule.h:22