ATLAS Offline Software
JemMappingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <cmath>
6 
7 #include "GaudiKernel/IInterface.h"
8 #include "GaudiKernel/MsgStream.h"
9 #include "GaudiKernel/StatusCode.h"
10 
11 #include "JemMappingTool.h"
12 
13 namespace LVL1 {
14 
15 // Static constants
16 
17 const int JemMappingTool::s_crates;
20 
25 
26 const double JemMappingTool::s_etaGran = 0.2;
27 const double JemMappingTool::s_phiGran = M_PI/16.;
28 
29 
30 // Initialise the mappings
31 
33 {
34  msg(MSG::INFO) << "Initializing " << name() << endmsg;
35 
36  // Initialise extreme eta data vectors
37  const double etasNeg[s_etaBinsPerRow] = {-4.05, -3.05, -2.8, -2.55 };
38  const double granNeg[s_etaBinsPerRow] = { 1.7, 0.3, 0.2, 0.3 };
39  const double etasPos[s_etaBinsPerRow] = { 2.55, 2.8, 3.05, 4.05 };
40  const double granPos[s_etaBinsPerRow] = { 0.3, 0.2, 0.3, 1.7 };
41  m_etasNegative.assign(etasNeg, etasNeg + s_etaBinsPerRow);
42  m_granNegative.assign(granNeg, granNeg + s_etaBinsPerRow);
43  m_etasPositive.assign(etasPos, etasPos + s_etaBinsPerRow);
44  m_granPositive.assign(granPos, granPos + s_etaBinsPerRow);
45 
46  // Initialise extreme eta channel remapping vectors
47  const int negChans[s_channels] = { 1,-1, 2, 3, -1,-1, 6, 7, 0,36,10,11,
48  5, 9,14,15, 17,13,18,19, 4,12,22,23,
49  28,20,26,27, 21,25,30,31, 33,29,34,35,
50  37,41,38,39, -1,-1,42,43 };
51  const int posChans[s_channels] = { 0, 1, 2,-1, 4, 5,-1,-1, 8, 9, 3,39,
52  12,13, 6,10, 16,17,18,14, 20,21, 7,15,
53  24,25,31,23, 28,29,22,26, 32,33,34,30,
54  36,37,38,42, 40,41,-1,-1 };
55  m_negChans.assign(negChans, negChans + s_channels);
56  m_posChans.assign(posChans, posChans + s_channels);
57 
58  return StatusCode::SUCCESS;
59 }
60 
62 {
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 // Return eta, phi and layer mapping for given crate/module/channel
68 
69 bool JemMappingTool::mapping(const int crate, const int module,
70  const int channel, double& eta, double& phi, int& layer) const
71 {
72  if (crate < 0 || crate >= s_crates || module < 0 || module >= s_modules ||
73  channel < 0 || channel >= s_channels) return false;
74 
75  // Channel remapping needed at extreme eta
76 
77  int chan = channel;
78  const int quadMod = module % s_modulesPerQuadrant;
79  if (quadMod == s_extremeNegModule) chan = m_negChans[channel];
80  else if (quadMod == s_extremePosModule) chan = m_posChans[channel];
81  if (chan < 0) return false;
82  const int etaBin = chan % s_etaBinsPerRow;
83  const int phiBin = chan / s_etaBinsPerRow - 1; // allow for overlap
84 
85  // Phi granularity doubles at FCAL
86 
87  const double twoPi = 2.*M_PI;
88  const double phiBase = M_PI/2. * double(crate)
90  phi = phiBase + s_phiGran * (double(phiBin) + 0.5);
91  if (((quadMod == s_extremeNegModule) && (etaBin == 0)) ||
92  ((quadMod == s_extremePosModule) && (etaBin == s_etaBinsPerRow - 1))) {
93  if (chan < s_etaBinsPerRow) phi -= s_phiGran / 2.;
94  else phi += s_phiGran / 2.;
95  }
96  if (phi < 0.) phi += twoPi;
97  else if (phi >= twoPi) phi -= twoPi;
98 
99  // Eta granularity varies at endcap/FCAL
100 
101  if (quadMod == s_extremeNegModule) eta = m_etasNegative[etaBin];
102  else if (quadMod == s_extremePosModule) eta = m_etasPositive[etaBin];
103  else {
104  const double etaBase = s_etaGran * s_etaBinsPerRow
105  * (quadMod - s_modulesPerQuadrant/2);
106  eta = etaBase + s_etaGran * (double(etaBin) + 0.5);
107  }
108 
109  // Set layer to 1 for overlap channel, 0 for core
110  layer = (phiBin < 0 || phiBin > 7) ? 1 : 0;
111 
112  return true;
113 }
114 
115 // Return crate, module and channel mapping for given eta/phi/layer
116 
117 bool JemMappingTool::mapping(const double /*eta*/, const double /*phi*/,
118  const int /*layer*/, int& crate, int& module, int& channel) const
119 {
120  // Not implemented
121  crate = 0;
122  module = 0;
123  channel = 0;
124  return false;
125 }
126 
127 } // end namespace
LVL1::JemMappingTool::s_etaGran
static const double s_etaGran
Definition: JemMappingTool.h:63
LVL1::JemMappingTool::s_etaBinsPerRow
static const int s_etaBinsPerRow
Definition: JemMappingTool.h:60
LVL1::JemMappingTool::initialize
virtual StatusCode initialize() override
Definition: JemMappingTool.cxx:32
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LVL1::JemMappingTool::finalize
virtual StatusCode finalize() override
Definition: JemMappingTool.cxx:61
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::JemMappingTool::m_etasNegative
std::vector< double > m_etasNegative
Definition: JemMappingTool.h:66
LVL1::JemMappingTool::m_granNegative
std::vector< double > m_granNegative
Definition: JemMappingTool.h:67
LVL1::JemMappingTool::s_channels
static const int s_channels
Definition: JemMappingTool.h:55
python.PyAthena.module
module
Definition: PyAthena.py:131
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
LVL1::JemMappingTool::mapping
virtual bool mapping(int crate, int module, int channel, double &eta, double &phi, int &layer) const override
Return eta, phi and layer mapping for given crate/module/channel.
Definition: JemMappingTool.cxx:69
LVL1::JemMappingTool::s_modules
static const int s_modules
Definition: JemMappingTool.h:54
JemMappingTool.h
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
LVL1::JemMappingTool::m_negChans
std::vector< int > m_negChans
Definition: JemMappingTool.h:72
LVL1::JemMappingTool::s_extremePosModule
static const int s_extremePosModule
Definition: JemMappingTool.h:59
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
LVL1::JemMappingTool::s_phiGran
static const double s_phiGran
Definition: JemMappingTool.h:62
LVL1::JemMappingTool::s_extremeNegModule
static const int s_extremeNegModule
Definition: JemMappingTool.h:58
LVL1::JemMappingTool::s_crates
static const int s_crates
Definition: JemMappingTool.h:53
LVL1::JemMappingTool::s_modulesPerQuadrant
static const int s_modulesPerQuadrant
Definition: JemMappingTool.h:57
LVL1::JemMappingTool::m_etasPositive
std::vector< double > m_etasPositive
Definition: JemMappingTool.h:68
LVL1::JemMappingTool::m_granPositive
std::vector< double > m_granPositive
Definition: JemMappingTool.h:69
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
LVL1::JemMappingTool::m_posChans
std::vector< int > m_posChans
Definition: JemMappingTool.h:73