ATLAS Offline Software
CPTopoTOB.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 
8 namespace LVL1 {
9 
10 // Static constants
11 
12 const int CPTopoTOB::s_cpmBit;
13 const int CPTopoTOB::s_chipBit;
14 const int CPTopoTOB::s_locationBit;
15 const int CPTopoTOB::s_isolBit;
16 const int CPTopoTOB::s_etBit;
17 
18 const int CPTopoTOB::s_cpmMask;
19 const int CPTopoTOB::s_chipMask;
21 const int CPTopoTOB::s_isolMask;
22 const int CPTopoTOB::s_etMask;
23 
25 const int CPTopoTOB::s_cpmEtaWidth;
26 const int CPTopoTOB::s_cpmPhiWidth;
29 const int CPTopoTOB::s_cpmPhiBins;
30 
31 
32 CPTopoTOB::CPTopoTOB() : m_crate(0), m_cmx(0), m_tobWord(0)
33 {
34 }
35 
36 CPTopoTOB::CPTopoTOB(int crate, int cmx, uint32_t tobWord) : m_crate(crate), m_cmx(cmx), m_tobWord(tobWord)
37 {
38 }
39 
40 CPTopoTOB::CPTopoTOB(int crate, int cmx, int cpm, int chip, int location, int isolation, int et) : m_crate(crate), m_cmx(cmx)
41 {
42  m_tobWord = 0;
43  m_tobWord |= (cpm & s_cpmMask) << s_cpmBit;
47  m_tobWord |= (et & s_etMask) << s_etBit;
48 }
49 
50 
52 {
53  m_crate = (roiWord>>26) & 0x3;
54  if ((roiWord&0xf0000000) == 0xa0000000) m_cmx = 0;
55  else m_cmx = 1;
56 
57  uint32_t coord = (roiWord>>16) & 0x3ff;
58  uint32_t data = (roiWord&0x1fff);
59  m_tobWord = data + (coord<<13);
60 }
61 
63 {
64 }
65 
68 {
69  int loc = location();
70  return cpm()*s_cpmEtaWidth + (loc >> 2)*2 + (loc&1);
71 }
72 
73 // Integer eta coordinate of RoI
74 
75 int CPTopoTOB::ieta() const
76 {
77  return etaIndex() - s_cpmEtaOffset + 1;
78 }
79 
80 // Extract eta coordinate from TOB data (RoI centre coordinate)
81 
82 float CPTopoTOB::eta() const
83 {
84  return ieta()*0.1;
85 }
86 
89 {
90  return ((location()>>1)&1) + chip()*s_chipPhiWidth + m_crate*s_cpmPhiWidth;
91 }
92 
93 // Extract integer phi coordinate from TOB data
94 
95 int CPTopoTOB::iphi() const
96 {
97  int iphi = phiIndex() + 1;
98  if (iphi > 63) iphi -= 64;
99  return iphi;
100 }
101 
103 {
104  int iphi = phiIndex() + 1;
105  if (iphi > 32) iphi -= 64;
106  return iphi;
107 }
108 
109 // Extract phi coordinate from TOB data
110 
111 float CPTopoTOB::phi() const
112 {
113  return iphiSigned()*M_PI/32;
114 }
115 
116 // Construct RoI word and return
118 {
119  // ET, isolation
120  uint32_t word = m_tobWord&0x1fff;
121  // Coordinate within crate
122  word += ((m_tobWord&0x7fe000)<<3);
123  // Crate number
124  word += (m_crate<<26);
125  // Type
126  if (m_cmx == 0) word += 0xa0000000;
127  else word += 0xb0000000;
128 
129  return word;
130 }
131 
132 } // end namespace
LVL1::CPTopoTOB::phiIndex
int phiIndex() const
Extract phi index from the TOB data (0-63)
Definition: CPTopoTOB.cxx:88
LVL1::CPTopoTOB::CPTopoTOB
CPTopoTOB()
Definition: CPTopoTOB.cxx:32
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LVL1::CPTopoTOB::s_isolMask
static const int s_isolMask
Definition: CPTopoTOB.h:77
et
Extra patterns decribing particle interation process.
LVL1::CPTopoTOB::eta
float eta() const
Definition: CPTopoTOB.cxx:82
LVL1::CPTopoTOB::cpm
int cpm() const
Return CPM number (1-14)
Definition: CPTopoTOB.h:108
LVL1::CPTopoTOB::s_chipBit
static const int s_chipBit
Definition: CPTopoTOB.h:69
LVL1::CPTopoTOB::location
unsigned int location() const
Return location (RoI local coords) (0-7)
Definition: CPTopoTOB.h:118
LVL1::CPTopoTOB::s_locationBit
static const int s_locationBit
Definition: CPTopoTOB.h:70
LVL1::CPTopoTOB::s_cpmMask
static const int s_cpmMask
Definition: CPTopoTOB.h:74
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1::CPTopoTOB::roiWord
uint32_t roiWord() const
Return corresponding RoI word (useful for Topo simulation)
Definition: CPTopoTOB.cxx:117
LVL1::CPTopoTOB::m_crate
int m_crate
crate
Definition: CPTopoTOB.h:88
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::CPTopoTOB::s_locationMask
static const int s_locationMask
Definition: CPTopoTOB.h:76
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::CPTopoTOB::s_cpmPhiBins
static const int s_cpmPhiBins
Definition: CPTopoTOB.h:85
LVL1::CPTopoTOB::s_cpmEtaOffset
static const int s_cpmEtaOffset
Definition: CPTopoTOB.h:83
LVL1::CPTopoTOB::iphi
int iphi() const
Definition: CPTopoTOB.cxx:95
LVL1::CPTopoTOB::s_cpmPhiWidth
static const int s_cpmPhiWidth
Definition: CPTopoTOB.h:82
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
LVL1::CPTopoTOB::s_cpmBit
static const int s_cpmBit
Definition: CPTopoTOB.h:68
LVL1::CPTopoTOB::s_isolBit
static const int s_isolBit
Definition: CPTopoTOB.h:71
python.sizes.location
string location
Definition: sizes.py:11
LVL1::CPTopoTOB::m_tobWord
uint32_t m_tobWord
RoI word.
Definition: CPTopoTOB.h:94
LVL1::CPTopoTOB::s_cpmPhiOffset
static const int s_cpmPhiOffset
Definition: CPTopoTOB.h:84
LVL1::CPTopoTOB::m_cmx
int m_cmx
CMX (EM or Tau)
Definition: CPTopoTOB.h:91
CPTopoTOB.h
LVL1::CPTopoTOB::iphiSigned
int iphiSigned() const
Definition: CPTopoTOB.cxx:102
LVL1::CPTopoTOB::s_etBit
static const int s_etBit
Definition: CPTopoTOB.h:72
LVL1::CPTopoTOB::s_chipMask
static const int s_chipMask
Definition: CPTopoTOB.h:75
LVL1::CPTopoTOB::s_cpmEtaWidth
static const int s_cpmEtaWidth
Definition: CPTopoTOB.h:81
LVL1::CPTopoTOB::isolation
unsigned int isolation() const
Return isolation mask.
Definition: CPTopoTOB.h:123
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
LVL1::CPTopoTOB::phi
float phi() const
Definition: CPTopoTOB.cxx:111
LVL1::CPTopoTOB::chip
int chip() const
Return CP chip number (0-7)
Definition: CPTopoTOB.h:113
LVL1::CPTopoTOB::~CPTopoTOB
~CPTopoTOB()
Definition: CPTopoTOB.cxx:62
LVL1::CPTopoTOB::etaIndex
int etaIndex() const
Extract eta index from the TOB data (0-49)
Definition: CPTopoTOB.cxx:67
LVL1::CPTopoTOB::ieta
int ieta() const
Definition: CPTopoTOB.cxx:75
LVL1::CPTopoTOB::s_etMask
static const int s_etMask
Definition: CPTopoTOB.h:78
LVL1::CPTopoTOB::s_chipPhiWidth
static const int s_chipPhiWidth
Definition: CPTopoTOB.h:80