ATLAS Offline Software
JetTopoTOB.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <cmath>
7 #include <stdlib.h>
8 
9 namespace LVL1 {
10 
11 // Static constants
12 
13 const int JetTopoTOB::s_jemBit;
14 const int JetTopoTOB::s_frameBit;
15 const int JetTopoTOB::s_lcBit;
16 const int JetTopoTOB::s_etSmallBit;
17 const int JetTopoTOB::s_etLargeBit;
18 
19 const int JetTopoTOB::s_jemMask;
20 const int JetTopoTOB::s_frameMask;
21 const int JetTopoTOB::s_lcMask;
24 
25 JetTopoTOB::JetTopoTOB() : m_crate(0), m_tobWord(0)
26 {
27 }
28 
29 JetTopoTOB::JetTopoTOB(int crate, uint32_t tobWord) : m_crate(crate), m_tobWord(tobWord)
30 {
31 }
32 
33 JetTopoTOB::JetTopoTOB(int crate, int jem, int frame, int localCoord, int etSmall, int etLarge) : m_crate(crate)
34 {
35  m_tobWord = 0;
36  m_tobWord |= (jem & s_jemMask) << s_jemBit;
41 }
42 
44 {
45  m_crate = (roiWord>>28) & 0x1;
46  m_tobWord = (roiWord&0xfffffff);
47 }
48 
50 {
51 }
52 
55 {
56  return (localCoord()&1) + (frame()>>2)*s_frameEtaWidth + (jem()&7)*s_jemEtaWidth;
57 }
58 
62 int JetTopoTOB::ieta() const
63 {
64 
65  int index = etaIndex();
66 
67  int ieta = 0;
68  if (index < 4 || index > 26) {
69  if (index==0) ieta = -s_jemFJEta;
70  else if (index==1) ieta = -s_jemEC1Eta;
71  else if (index==2) ieta = -s_jemEC2Eta;
72  else if (index==3) ieta = -s_jemEC3Eta;
73  else if (index==27) ieta = s_jemEC3Eta;
74  else if (index==28) ieta = s_jemEC2Eta;
75  else if (index==29) ieta = s_jemEC1Eta;
76  else if (index==30) ieta = s_jemFJEta;
77  else if (index==31) ieta = s_jemFJEta;
78  }
79  else {
81  }
82 
83  return ieta;
84 }
85 
86 // Extract eta coordinate from TOB data
87 
88 float JetTopoTOB::eta() const
89 {
90 
91  float eta = ieta()*0.1;
92 
93  /*
94  int absEta = abs(ieta());
95  int sign = (eta > 0 ? 1 : -1);
96 
97  switch (absEta) {
98  case s_jemEC3Eta:
99  eta = sign*2.45;
100  break;
101  case s_jemEC2Eta:
102  eta = sign*2.65;
103  break;
104  case s_jemEC1Eta:
105  eta = sign*2.95;
106  break;
107  }
108  */
109 
110  return eta;
111 }
112 
113 
116 {
117  int index = (localCoord() >> 1) + (frame()&3)*s_framePhiWidth + m_crate*s_jemPhiWidth;
118  if (jem() >= s_nJemPerQuadrant) index += 2*s_jemPhiWidth;
119 
120  return index;
121 }
122 
123 
127 int JetTopoTOB::iphi() const
128 {
129  int index = phiIndex();
130 
131  int iphi = (index+1)*s_jetElementWidth;
132  if (iphi > 63) iphi -= 64;
133  return iphi;
134 }
135 
139 {
140  int index = phiIndex();
141 
142  int iphi = (index+1)*s_jetElementWidth;
143  if (iphi > 32) iphi -= 64;
144  return iphi;
145 }
146 
147 // Extract phi coordinate from TOB data
148 
149 float JetTopoTOB::phi() const
150 {
151  float phi = iphiSigned()*M_PI/32;
152  return phi;
153 }
154 
155 // Construct RoI word and return
157 {
158  // ET values and coordinate within crate
159  uint32_t word = m_tobWord&0xfffffff;
160  // Crate number
161  word += (m_crate<<28);
162  // Type is 000 anyway, so nothing more to do
163 
164  return word;
165 }
166 
167 } // end namespace
LVL1::JetTopoTOB::s_jemFJEta
static const int s_jemFJEta
Definition: JetTopoTOB.h:84
LVL1::JetTopoTOB::iphi
int iphi() const
Extract integer phi coordinate from TOB data.
Definition: JetTopoTOB.cxx:127
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LVL1::JetTopoTOB::etaIndex
int etaIndex() const
Extract eta index from the TOB data (0-31)
Definition: JetTopoTOB.cxx:54
LVL1::JetTopoTOB::s_etLargeMask
static const int s_etLargeMask
Definition: JetTopoTOB.h:76
LVL1::JetTopoTOB::frame
int frame() const
Return JEM frame number (0-7)
Definition: JetTopoTOB.h:109
LVL1::JetTopoTOB::s_jemMask
static const int s_jemMask
Definition: JetTopoTOB.h:72
LVL1::JetTopoTOB::~JetTopoTOB
~JetTopoTOB()
Definition: JetTopoTOB.cxx:49
LVL1::JetTopoTOB::iphiSigned
int iphiSigned() const
Signed iphi (-30 -> 32)
Definition: JetTopoTOB.cxx:138
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
index
Definition: index.py:1
LVL1::JetTopoTOB::eta
float eta() const
Definition: JetTopoTOB.cxx:88
LVL1::JetTopoTOB::s_nJemPerQuadrant
static const int s_nJemPerQuadrant
Definition: JetTopoTOB.h:88
LVL1::JetTopoTOB::jem
int jem() const
Return JEM number (0-15)
Definition: JetTopoTOB.h:104
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::JetTopoTOB::s_framePhiWidth
static const int s_framePhiWidth
Definition: JetTopoTOB.h:78
LVL1::JetTopoTOB::etSmall
unsigned int etSmall() const
Small cluster ET value.
Definition: JetTopoTOB.h:119
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
JetTopoTOB.h
LVL1::JetTopoTOB::roiWord
uint32_t roiWord() const
Return corresponding RoI word (useful for Topo simulation)
Definition: JetTopoTOB.cxx:156
LVL1::JetTopoTOB::s_lcMask
static const int s_lcMask
Definition: JetTopoTOB.h:74
LVL1::JetTopoTOB::phiIndex
int phiIndex() const
Extract phi index from the TOB data (0-31)
Definition: JetTopoTOB.cxx:115
LVL1::JetTopoTOB::s_etSmallMask
static const int s_etSmallMask
Definition: JetTopoTOB.h:75
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
LVL1::JetTopoTOB::s_jemEtaWidth
static const int s_jemEtaWidth
Definition: JetTopoTOB.h:80
LVL1::JetTopoTOB::s_jemEtaOffset
static const int s_jemEtaOffset
Definition: JetTopoTOB.h:82
LVL1::JetTopoTOB::JetTopoTOB
JetTopoTOB()
Definition: JetTopoTOB.cxx:25
LVL1::JetTopoTOB::s_frameEtaWidth
static const int s_frameEtaWidth
Definition: JetTopoTOB.h:79
LVL1::JetTopoTOB::s_jemPhiWidth
static const int s_jemPhiWidth
Definition: JetTopoTOB.h:81
LVL1::JetTopoTOB::m_tobWord
uint32_t m_tobWord
RoI word.
Definition: JetTopoTOB.h:95
LVL1::JetTopoTOB::etLarge
unsigned int etLarge() const
Large cluster ET value.
Definition: JetTopoTOB.h:124
LVL1::JetTopoTOB::s_jemEC2Eta
static const int s_jemEC2Eta
Definition: JetTopoTOB.h:86
LVL1::JetTopoTOB::m_crate
int m_crate
crate
Definition: JetTopoTOB.h:92
LVL1::JetTopoTOB::s_jemBit
static const int s_jemBit
Definition: JetTopoTOB.h:66
LVL1::JetTopoTOB::s_frameMask
static const int s_frameMask
Definition: JetTopoTOB.h:73
LVL1::JetTopoTOB::s_jemEC1Eta
static const int s_jemEC1Eta
Definition: JetTopoTOB.h:85
LVL1::JetTopoTOB::s_etSmallBit
static const int s_etSmallBit
Definition: JetTopoTOB.h:69
DeMoScan.index
string index
Definition: DeMoScan.py:362
LVL1::JetTopoTOB::ieta
int ieta() const
Extract eta coordinate from TOB data The index is an integer eta coordinate in multiples of 0....
Definition: JetTopoTOB.cxx:62
LVL1::JetTopoTOB::localCoord
unsigned int localCoord() const
Return local coordinate (RoI local coords) (0-)
Definition: JetTopoTOB.h:114
LVL1::JetTopoTOB::s_jemEC3Eta
static const int s_jemEC3Eta
Definition: JetTopoTOB.h:87
LVL1::JetTopoTOB::s_frameBit
static const int s_frameBit
Definition: JetTopoTOB.h:67
LVL1::JetTopoTOB::s_etLargeBit
static const int s_etLargeBit
Definition: JetTopoTOB.h:70
LVL1::JetTopoTOB::phi
float phi() const
Definition: JetTopoTOB.cxx:149
LVL1::JetTopoTOB::s_jetElementWidth
static const int s_jetElementWidth
Definition: JetTopoTOB.h:89
LVL1::JetTopoTOB::s_lcBit
static const int s_lcBit
Definition: JetTopoTOB.h:68