ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LVL1::CPRoIDecoder Class Reference

A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word. More...

#include <CPRoIDecoder.h>

Inheritance diagram for LVL1::CPRoIDecoder:
Collaboration diagram for LVL1::CPRoIDecoder:

Public Member Functions

 CPRoIDecoder ()
 
virtual ~CPRoIDecoder ()
 
TrigT1CaloDefs::RoIType roiType (unsigned int word) const
 CP-RoI specific, but can distinguish Run 1/Run 2. More...
 
virtual CoordinateRange coordinate (const unsigned int roiWord) const override
 RoI coordinate information. More...
 
unsigned int crate (const unsigned int roiWord) const
 Decode crate number from RoI word. More...
 
unsigned int module (const unsigned int roiWord) const
 Decode module number from RoI word. More...
 
unsigned int chip (const unsigned int roiWord) const
 Decode CP chip number from RoI word. More...
 
unsigned int localcoord (const unsigned int roiWord) const
 Decode local coordinate from RoI word. More...
 
const std::vector< unsigned int > thresholdsPassed (const unsigned int word) const
 Thresholds passed (Run 1 RoIs) More...
 
unsigned int et (const unsigned int roiWord) const
 ET and Isolation information (Run 2 RoIs) More...
 
unsigned int isolationWord (const unsigned int roiWord) const
 Extract isolation results from Run 2 RoI word. More...
 

Protected Member Functions

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" More...
 

Protected Attributes

bool m_DEBUG
 

Detailed Description

A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.

Author
E. Moyse
Todo:
this should probably be a static class.
Revision
615360
Date
2014-09-05 21:34:47 +0200 (Fri, 05 Sep 2014)

Definition at line 37 of file CPRoIDecoder.h.

Constructor & Destructor Documentation

◆ CPRoIDecoder()

LVL1::CPRoIDecoder::CPRoIDecoder ( )

Definition at line 21 of file CPRoIDecoder.cxx.

22  {
23  }

◆ ~CPRoIDecoder()

LVL1::CPRoIDecoder::~CPRoIDecoder ( )
virtual

Definition at line 25 of file CPRoIDecoder.cxx.

25  {
26 
27  }

Member Function Documentation

◆ chip()

unsigned int LVL1::CPRoIDecoder::chip ( const unsigned int  roiWord) const

Decode CP chip number from RoI word.

Definition at line 118 of file CPRoIDecoder.cxx.

118  {
119  int offset = 0;
121  return extractBits( roiWord, 20+offset, 3 );
122  }

◆ coordinate()

CoordinateRange LVL1::CPRoIDecoder::coordinate ( const unsigned int  roiWord) const
overridevirtual

RoI coordinate information.

Return coordinate information for RoI.

Implements LVL1::RoIDecoder.

Definition at line 50 of file CPRoIDecoder.cxx.

50  {
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 
97  CoordinateRange coord;
98  coord.setRanges( phiMin, phiMax, etaMin, etaMax );
99  return coord;
100 
101  }

◆ crate()

unsigned int LVL1::CPRoIDecoder::crate ( const unsigned int  roiWord) const

Decode crate number from RoI word.

Definition at line 104 of file CPRoIDecoder.cxx.

104  {
105  int offset = 0;
107  return extractBits( roiWord, 27+offset, 2 );
108  }

◆ et()

unsigned int LVL1::CPRoIDecoder::et ( const unsigned int  roiWord) const

ET and Isolation information (Run 2 RoIs)

Extract cluster ET from Run 2 RoI word.

Definition at line 132 of file CPRoIDecoder.cxx.

132  {
133  unsigned int type = roiType( roiWord );
134 
136  return extractBits(roiWord, 1, 8);
137 
138  return 0;
139  }

◆ extractBits()

unsigned int LVL1::RoIDecoder::extractBits ( unsigned int  word,
const unsigned int  start,
const unsigned int  length 
) const
protectedinherited

returns the value of bits in word between bit "start" and bit "start" + "length"

Definition at line 34 of file RoIDecoder.cxx.

35  {
36 
37  // this works as follows. Imagine start=3, bits=4 and word=11011100
38  // so this routine should return 0111
39  // now:
40  // word>>(first-1) = 110111
41  // (1<<length) = 010000
42  // (1<<length)-1 = 001111
43  word = ( word >> ( start - 1 ) );
44 
45  unsigned int bitmask = ( 1 << length ) - 1;
46  // and finally:
47  // 110111&001111 = 0111
48  return ( word & bitmask ); // return only bits in bitmask
49 }

◆ isolationWord()

unsigned int LVL1::CPRoIDecoder::isolationWord ( const unsigned int  roiWord) const

Extract isolation results from Run 2 RoI word.

Definition at line 142 of file CPRoIDecoder.cxx.

142  {
143  unsigned int type = roiType( roiWord );
144 
146  return extractBits(roiWord, 9, 5);
147 
148  return 0;
149  }

◆ localcoord()

unsigned int LVL1::CPRoIDecoder::localcoord ( const unsigned int  roiWord) const

Decode local coordinate from RoI word.

Definition at line 125 of file CPRoIDecoder.cxx.

125  {
126  int offset = 0;
128  return extractBits( roiWord, 17+offset, 3 );
129  }

◆ module()

unsigned int LVL1::CPRoIDecoder::module ( const unsigned int  roiWord) const

Decode module number from RoI word.

Definition at line 111 of file CPRoIDecoder.cxx.

111  {
112  int offset = 0;
114  return extractBits( roiWord, 23+offset, 4 );
115  }

◆ roiType()

LVL1::TrigT1CaloDefs::RoIType LVL1::CPRoIDecoder::roiType ( unsigned int  word) const

CP-RoI specific, but can distinguish Run 1/Run 2.

Override base method - allows us to handle both Run 1 & Run 2 data for CP system.

Definition at line 31 of file CPRoIDecoder.cxx.

31  {
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  }

◆ thresholdsPassed()

const std::vector< unsigned int > LVL1::CPRoIDecoder::thresholdsPassed ( const unsigned int  word) const

Thresholds passed (Run 1 RoIs)

Override default version by adding a check on Run 1/Run 2.

Definition at line 153 of file CPRoIDecoder.cxx.

153  {
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  }

Member Data Documentation

◆ m_DEBUG

bool LVL1::RoIDecoder::m_DEBUG
protectedinherited

Definition at line 63 of file RoIDecoder.h.


The documentation for this class was generated from the following files:
LVL1::CPRoIDecoder::crate
unsigned int crate(const unsigned int roiWord) const
Decode crate number from RoI word.
Definition: CPRoIDecoder.cxx:104
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
LVL1::TrigT1CaloDefs::TauRoIWordType
@ TauRoIWordType
Definition: TrigT1CaloDefs.h:173
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:35
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
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
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
LVL1::TrigT1CaloDefs::RoIWordTypeError
@ RoIWordTypeError
Definition: TrigT1CaloDefs.h:174
LVL1::TrigT1CaloDefs::EMRoIWord
@ EMRoIWord
Definition: TrigT1CaloDefs.h:185
LVL1::TrigT1CaloDefs::TauRoIWord
@ TauRoIWord
Definition: TrigT1CaloDefs.h:186
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:175
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
LVL1::TrigT1CaloDefs::EMTauRoIWord
@ EMTauRoIWord
Definition: TrigT1CaloDefs.h:184
LVL1::CPRoIDecoder::localcoord
unsigned int localcoord(const unsigned int roiWord) const
Decode local coordinate from RoI word.
Definition: CPRoIDecoder.cxx:125
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
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:172
LVL1::RoIDecoder::m_DEBUG
bool m_DEBUG
Definition: RoIDecoder.h:63
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
LVL1::TrigT1CaloDefs::CpRoIWordType
@ CpRoIWordType
Definition: TrigT1CaloDefs.h:166
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