ATLAS Offline Software
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 
6 #include "LArHV/EMECHVManager.h"
7 #include "LArHV/EMECHVModule.h"
11 
12 // Class EMECCell
13 
15 = default;
16 
17 unsigned int EMECCell::getNumElectrodes() const {
18  return getHVInfo().m_electrode.size();
19 }
20 
21 const EMECHVElectrode& EMECCell::getElectrode (unsigned int i) const {
22  return *getHVInfo().m_electrode[i];
23 }
24 
26  return *getHVInfo().m_presamplerModule;
27 }
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 
41 void 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 
EMECDetDescr::getManager
const EMECDetectorManager * getManager() const
The manager.
Definition: EMECDetDescr.h:142
EMECPresamplerHVManager
This class provides direct access to information on the HV electrodes within the EMEC....
Definition: EMECPresamplerHVManager.h:36
EMECCell::getElectrode
const EMECHVElectrode & getElectrode(unsigned int i) const
@Get electrode
Definition: EMECCell.cxx:21
EMECHVElectrode.h
EMECHVDescriptor.h
EMECHVManager::getHVModule
const EMECHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
Definition: EMECHVManager.cxx:222
EMECCell::getPhiMaxNominal
double getPhiMaxNominal() const
returns a nominal phi max in global coords; assume canonical placement
Definition: EMECCell.h:288
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
EMECCell::HVInfo::m_electrode
std::vector< const EMECHVElectrode * > m_electrode
Definition: EMECCell.h:160
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
EMECHVModule::getElectrode
const EMECHVElectrode & getElectrode(unsigned int iElectrode) const
Definition: EMECHVModule.cxx:81
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
EMECCell::getNumElectrodes
unsigned int getNumElectrodes() const
@Get num electrodes
Definition: EMECCell.cxx:17
EMECHVManager.h
M_PI
#define M_PI
Definition: ActiveFraction.h:11
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
EMECHVDescriptor::getPhiBinning
const CellBinning & getPhiBinning() const
Definition: EMECHVDescriptor.h:21
EMECCell::m_hvinfo
CxxUtils::CachedValue< HVInfo > m_hvinfo
Definition: EMECCell.h:163
EMECCell::getEtaMin
double getEtaMin() const
Minimum Eta.
Definition: EMECCell.h:293
EMECCell::getDescriptor
const EMECDetDescr * getDescriptor() const
Returns a pointer to the descriptor.
Definition: EMECCell.h:229
EMECCell::getEndcapIndex
unsigned int getEndcapIndex() const
The EndcapIndex of this Cell (0=negatiive, 1=positive)
Definition: EMECCell.h:194
EMECPresamplerHVManager::getHVModule
const EMECPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iPhi) const
Definition: EMECPresamplerHVManager.cxx:152
EMECHVModule
Definition: EMECHVModule.h:20
EMECPresamplerHVModule.h
EMECCell::~EMECCell
virtual ~EMECCell()
EMECHVModule::INNER
@ INNER
Definition: EMECHVModule.h:22
lumiFormat.i
int i
Definition: lumiFormat.py:85
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
EMECDetectorManager::getHVManager
const EMECHVManager & getHVManager(EMECHVManager::IOType io) const
Get the HV Managers.
Definition: EMECDetectorManager.cxx:139
EMECCell::getHVInfo
const HVInfo & getHVInfo() const
Definition: EMECCell.cxx:30
EMECCell.h
EMECPresamplerHVManager::getPhiBinning
const CellBinning * getPhiBinning() const
Definition: EMECPresamplerHVManager.cxx:137
EMECCell::HVInfo
Definition: EMECCell.h:158
EMECCell::HVInfo::m_presamplerModule
const EMECPresamplerHVModule * m_presamplerModule
Definition: EMECCell.h:161
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
EMECHVModule::OUTER
@ OUTER
Definition: EMECHVModule.h:22
EMECCell::getPresamplerHVModule
const EMECPresamplerHVModule & getPresamplerHVModule() const
@Get HVModule (presampler cells)
Definition: EMECCell.cxx:25
EMECDetectorManager::getPresamplerHVManager
const EMECPresamplerHVManager & getPresamplerHVManager() const
Get the HV Manager (presampler)
Definition: EMECDetectorManager.cxx:153
EMECHVModule::IOType
IOType
Definition: EMECHVModule.h:22
EMECPresamplerHVModule
Describes one HV Module within the EMEc Presampler.
Definition: EMECPresamplerHVModule.h:22
EMECHVManager::getDescriptor
const EMECHVDescriptor & getDescriptor() const
Definition: EMECHVManager.cxx:197
JetTiledMap::NE
@ NE
Definition: TiledEtaPhiMap.h:44
EMECHVDescriptor::getEtaBinning
const CellPartitioning & getEtaBinning() const
Definition: EMECHVDescriptor.h:16
EMECCell::getEtaMax
double getEtaMax() const
Maximum Eta.
Definition: EMECCell.h:300
EMECHVElectrode
Definition: EMECHVElectrode.h:15
EMECHVManager
This class provides direct access to information on the HV electrodes within the EMEC....
Definition: EMECHVManager.h:36
EMECHVModule.h
EMECCell::initHV
void initHV(HVInfo &hvinfo) const
Definition: EMECCell.cxx:41
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
EMECHVDescriptor::getSectorBinning
const CellBinning & getSectorBinning() const
Definition: EMECHVDescriptor.h:26
EMECCell::getSamplingIndex
unsigned int getSamplingIndex() const
The sampling index of this cell.
Definition: EMECCell.h:208
EMECCell::getPhiMinNominal
double getPhiMinNominal() const
returns a nominal phi min in global coords; assume canonical placement
Definition: EMECCell.h:283