ATLAS Offline Software
Loading...
Searching...
No Matches
CPRoIDecoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4/***************************************************************************
5 CPRoIDecoder.cxx - description
6 -------------------
7 begin : Fri Apr 19 2002
8 email : moyse@ph.qmw.ac.uk
9***************************************************************************/
10
11#include <cmath>
12#include <iostream>
13
15
16using std::cout;
17using std::endl;
18
19namespace LVL1 {
20
24
28
29
32 unsigned int temp=extractBits(word, 31, 2);
33 if (temp == TrigT1CaloDefs::EMTauRoIWord) {
35 }
36 else {
37 unsigned int temp2 = extractBits(word, 29, 4);
38 if (temp2 == TrigT1CaloDefs::EMRoIWord) {
40 }
41 else if (temp2 == TrigT1CaloDefs::TauRoIWord) {
43 }
44 }
46 }
47
48
50 CoordinateRange CPRoIDecoder::coordinate( const unsigned int roiWord ) const {
51
52 //phi
53 const double cratePhiSize = M_PI / 2.0;
54 const double fpgaPhiSize = M_PI / 16.0;
55 const double localCoordPhiSize = M_PI / 32.0;
56
57 //eta
58 const double cpmEtaSize = 0.4;
59 const double localCoordEtaSize = 0.1;
60
61 // the FPGAs local ROI coords are arranged like this:
62 // 2 3 6 7 (top)
63 // 0 1 4 5 (bot)
64 // (where each cell is 0.1x0.1)
65 // so
66
67 unsigned int crate = this->crate (roiWord);
68 unsigned int cpm = this->module (roiWord);
69 unsigned int cp = this->chip (roiWord);
70 unsigned int lc = this->localcoord (roiWord);
71
72 unsigned int top = ( lc & 2 ) >> 1; // top=1, bot=0
73 double localCoordEta = ( ( ( lc & 4 ) >> 1 ) + ( lc & 1 ) ) * localCoordEtaSize;
74
75 double phiMin = ( static_cast< double >( crate ) * cratePhiSize ) +
76 ( static_cast< double >( cp ) * fpgaPhiSize ) + ( top * localCoordPhiSize );
77 double phiMax = ( static_cast< double >( crate ) * cratePhiSize ) +
78 ( static_cast< double >( cp ) * fpgaPhiSize ) + ( top * localCoordPhiSize ) + 2. * localCoordPhiSize;
79 double etaMin = ( ( static_cast< double >( static_cast< int >( cpm ) - 8 ) ) * cpmEtaSize ) + localCoordEta;
80
81 double etaMax = ( static_cast< double >( static_cast< int >( cpm ) - 8 ) * cpmEtaSize ) + localCoordEta + 2. * localCoordEtaSize;
82
83 if ( RoIDecoder::m_DEBUG ) {
84
85 cout << "phiMin : " << phiMin << "phiMax : " << phiMax << endl
86 << "etaMin : " << etaMin << "etaMax : " << etaMax << endl
87 << "Phi" << endl << "===" << endl
88 << "Crate phi min : " << ( crate * cratePhiSize ) << " (size: " << ( cratePhiSize ) << ")" << endl
89 << "CP FPGA phi min : " << ( cp * fpgaPhiSize ) << " (size: " << ( fpgaPhiSize ) << ")" << endl
90 << "Local coord min : " << ( top * localCoordPhiSize ) << " (size: " << ( localCoordPhiSize ) << ")" << endl
91 << "Eta" << endl << "===" << endl
92 << "CPM eta min : " << ( ( cpm - 8 ) * cpmEtaSize ) << " (size: " << ( cpmEtaSize ) << ")" << endl
93 << "CP FPGA phi min : " << localCoordEta << " (size: " << ( localCoordEtaSize ) << ")" << endl;
94
95 }
96
98 coord.setRanges( phiMin, phiMax, etaMin, etaMax );
99 return coord;
100
101 }
102
104 unsigned int CPRoIDecoder::crate( const unsigned int roiWord ) const {
105 int offset = 0;
106 if (roiType( roiWord ) == TrigT1CaloDefs::CpRoIWordType) offset = 2;
107 return extractBits( roiWord, 27+offset, 2 );
108 }
109
111 unsigned int CPRoIDecoder::module( const unsigned int roiWord ) const {
112 int offset = 0;
113 if (roiType( roiWord ) == TrigT1CaloDefs::CpRoIWordType) offset = 2;
114 return extractBits( roiWord, 23+offset, 4 );
115 }
116
118 unsigned int CPRoIDecoder::chip( const unsigned int roiWord ) const {
119 int offset = 0;
120 if (roiType( roiWord ) == TrigT1CaloDefs::CpRoIWordType) offset = 2;
121 return extractBits( roiWord, 20+offset, 3 );
122 }
123
125 unsigned int CPRoIDecoder::localcoord( const unsigned int roiWord ) const {
126 int offset = 0;
127 if (roiType( roiWord ) == TrigT1CaloDefs::CpRoIWordType) offset = 2;
128 return extractBits( roiWord, 17+offset, 3 );
129 }
130
132 unsigned int CPRoIDecoder::et( const unsigned int roiWord ) const {
133 unsigned int type = roiType( roiWord );
134
136 return extractBits(roiWord, 1, 8);
137
138 return 0;
139 }
140
142 unsigned int CPRoIDecoder::isolationWord( const unsigned int roiWord ) const {
143 unsigned int type = roiType( roiWord );
144
146 return extractBits(roiWord, 9, 5);
147
148 return 0;
149 }
150
151
153 const std::vector<unsigned int> CPRoIDecoder::thresholdsPassed( const unsigned int word ) const {
154
155 std::vector<unsigned int> threshPassedVec;
156
158 unsigned int hitmask = word&0xffff;
159 for ( unsigned int thresh = 0; thresh < 16; ++thresh ) {
160 if ( ( 1 << thresh ) & hitmask ) {
161 threshPassedVec.push_back( thresh + 1 );
162 }
163 }
164 }
165
166 return threshPassedVec;
167
168 }
169
170
171
172} // namespace LVL1
#define M_PI
double coord
Type of coordination system.
@ top
unsigned int chip(const unsigned int roiWord) const
Decode CP chip number from RoI word.
unsigned int localcoord(const unsigned int roiWord) const
Decode local coordinate from RoI word.
unsigned int et(const unsigned int roiWord) const
ET and Isolation information (Run 2 RoIs)
const std::vector< unsigned int > thresholdsPassed(const unsigned int word) const
Thresholds passed (Run 1 RoIs)
unsigned int isolationWord(const unsigned int roiWord) const
Extract isolation results from Run 2 RoI word.
unsigned int crate(const unsigned int roiWord) const
Decode crate number from RoI word.
TrigT1CaloDefs::RoIType roiType(unsigned int word) const
CP-RoI specific, but can distinguish Run 1/Run 2.
unsigned int module(const unsigned int roiWord) const
Decode module number from RoI word.
virtual CoordinateRange coordinate(const unsigned int roiWord) const override
RoI coordinate information.
CoordinateRange class declaration.
unsigned int extractBits(unsigned int word, const unsigned int start, const unsigned int length) const
returns the value of bits in word between bit "start" and bit "start" + "length"
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...