ATLAS Offline Software
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 
16 using std::cout;
17 using std::endl;
18 
19 namespace LVL1 {
20 
22  {
23  }
24 
26 
27  }
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;
107  return extractBits( roiWord, 27+offset, 2 );
108  }
109 
111  unsigned int CPRoIDecoder::module( const unsigned int roiWord ) const {
112  int offset = 0;
114  return extractBits( roiWord, 23+offset, 4 );
115  }
116 
118  unsigned int CPRoIDecoder::chip( const unsigned int roiWord ) const {
119  int offset = 0;
121  return extractBits( roiWord, 20+offset, 3 );
122  }
123 
125  unsigned int CPRoIDecoder::localcoord( const unsigned int roiWord ) const {
126  int offset = 0;
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 
157  if (roiType(word) == TrigT1CaloDefs::CpRoIWordType) {
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
LVL1::CPRoIDecoder::isolationWord
unsigned int isolationWord(const unsigned int roiWord) const
Extract isolation results from Run 2 RoI word.
Definition: CPRoIDecoder.cxx:142
LVL1::CPRoIDecoder::crate
unsigned int crate(const unsigned int roiWord) const
Decode crate number from RoI word.
Definition: CPRoIDecoder.cxx:104
LVL1::TrigT1CaloDefs::TauRoIWordType
@ TauRoIWordType
Definition: TrigT1CaloDefs.h:174
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:36
CPRoIDecoder.h
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
python.LumiCalcHtml.lc
lc
Definition: LumiCalcHtml.py:579
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
LVL1::CPRoIDecoder::et
unsigned int et(const unsigned int roiWord) const
ET and Isolation information (Run 2 RoIs)
Definition: CPRoIDecoder.cxx:132
LVL1::CoordinateRange
CoordinateRange class declaration.
Definition: CoordinateRange.h:36
LVL1::CPRoIDecoder::thresholdsPassed
const std::vector< unsigned int > thresholdsPassed(const unsigned int word) const
Thresholds passed (Run 1 RoIs)
Definition: CPRoIDecoder.cxx:153
LVL1::TrigT1CaloDefs::RoIWordTypeError
@ RoIWordTypeError
Definition: TrigT1CaloDefs.h:175
LVL1::CPRoIDecoder::CPRoIDecoder
CPRoIDecoder()
Definition: CPRoIDecoder.cxx:21
LVL1::TrigT1CaloDefs::EMRoIWord
@ EMRoIWord
Definition: TrigT1CaloDefs.h:186
LVL1::CPRoIDecoder::~CPRoIDecoder
virtual ~CPRoIDecoder()
Definition: CPRoIDecoder.cxx:25
LVL1::TrigT1CaloDefs::TauRoIWord
@ TauRoIWord
Definition: TrigT1CaloDefs.h:187
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:188
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
LVL1::TrigT1CaloDefs::EMTauRoIWord
@ EMTauRoIWord
Definition: TrigT1CaloDefs.h:185
LVL1::CPRoIDecoder::localcoord
unsigned int localcoord(const unsigned int roiWord) const
Decode local coordinate from RoI word.
Definition: CPRoIDecoder.cxx:125
LVL1::TrigT1CaloDefs::RoIType
RoIType
Definition: TrigT1CaloDefs.h:166
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
LVL1::CPRoIDecoder::coordinate
virtual CoordinateRange coordinate(const unsigned int roiWord) const override
RoI coordinate information.
Definition: CPRoIDecoder.cxx:50
LVL1::CPRoIDecoder::module
unsigned int module(const unsigned int roiWord) const
Decode module number from RoI word.
Definition: CPRoIDecoder.cxx:111
LVL1::CPRoIDecoder::chip
unsigned int chip(const unsigned int roiWord) const
Decode CP chip number from RoI word.
Definition: CPRoIDecoder.cxx:118
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1::TrigT1CaloDefs::EMRoIWordType
@ EMRoIWordType
Definition: TrigT1CaloDefs.h:173
top
@ top
Definition: TruthClasses.h:64
LVL1::RoIDecoder::m_DEBUG
bool m_DEBUG
Definition: RoIDecoder.h:63
LVL1::TrigT1CaloDefs::CpRoIWordType
@ CpRoIWordType
Definition: TrigT1CaloDefs.h:167
LVL1::RoIDecoder::extractBits
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"
Definition: RoIDecoder.cxx:34
LVL1::CPRoIDecoder::roiType
TrigT1CaloDefs::RoIType roiType(unsigned int word) const
CP-RoI specific, but can distinguish Run 1/Run 2.
Definition: CPRoIDecoder.cxx:31