ATLAS Offline Software
JemRoiSubBlockV2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 
8 #include "JemRoiSubBlockV2.h"
9 
10 namespace LVL1BS {
11 
12 // Constant definitions
13 
15 
24 
25 
27 {
28 }
29 
31 {
32 }
33 
34 // Clear all data
35 
37 {
39  m_roiData.clear();
40 }
41 
42 // Store header
43 
44 void JemRoiSubBlockV2::setRoiHeader(const int version, const int crate,
45  const int module)
46 {
48 }
49 
50 // Store RoI
51 
53 {
54  const LVL1::JEMTobRoI roiTemp(crate(), module(), 0, 0, 0, 0);
55  if (roi.crate() == roiTemp.crate() && roi.jem() == roiTemp.jem()) {
56  m_roiData.resize(s_frames);
57  const int pos = roi.frame();
58  m_roiData[pos] = roi;
59  }
60 }
61 
62 // Return RoI for given frame
63 
64 LVL1::JEMTobRoI JemRoiSubBlockV2::roi(const int frame) const
65 {
66  if (frame >= 0 && frame < s_frames && !m_roiData.empty()) {
67  return m_roiData[frame];
68  } else return LVL1::JEMTobRoI(0);
69 }
70 
71 // Packing/Unpacking routines
72 
74 {
75  bool rc = false;
76  switch (version()) {
77  case 1: //<< CHECK
78  switch (format()) {
79  case NEUTRAL:
80  rc = packNeutral();
81  break;
82  default:
83  break;
84  }
85  break;
86  default:
87  break;
88  }
89  return rc;
90 }
91 
93 {
94  bool rc = false;
95  switch (version()) {
96  case 2: //<< CHECK
97  switch (format()) {
98  case NEUTRAL:
99  rc = unpackNeutral();
100  break;
101  default:
103  break;
104  }
105  break;
106  default:
108  break;
109  }
110  return rc;
111 }
112 
113 // Pack neutral data
114 
116 {
117  m_roiData.resize(s_frames);
118  int maxPin = 0;
119  // RoI data
120  for (int frame = 0; frame < s_frames; ++frame) {
121  const LVL1::JEMTobRoI& roi(m_roiData[frame]);
122  const int pin1 = frame / s_framesPerPin;
123  const int pin2 = s_bunchCrossingPin + pin1 + 1;
125  packerNeutral(pin1, 0, 1);
128  maxPin = pin2;
129  }
130  // Bunch Crossing number
133  // G-Link parity
134  for (int pin = 0; pin <= maxPin; ++pin) packerNeutralParity(pin);
135 
136  return true;
137 }
138 
139 // Unpack neutral data
140 
142 {
143  m_roiData.resize(s_frames);
144  int maxPin = 0;
145  // RoI data
146  for (int frame = 0; frame < s_frames; ++frame) {
147  const int pin1 = frame / s_framesPerPin;
148  const int pin2 = s_bunchCrossingPin + pin1 + 1;
149  const int enLarge = unpackerNeutral(pin1, s_energyLargeBits);
150  unpackerNeutral(pin1, 1);
151  const int enSmall = unpackerNeutral(pin2, s_energySmallBits);
152  const int loc = unpackerNeutral(pin2, s_locationBits);
153  m_roiData[frame] = LVL1::JEMTobRoI(crate(), module(),
154  frame, loc, enLarge, enSmall);
155  maxPin = pin2;
156  }
157  // Bunch Crossing number
160  // G-Link parity
161  for (int pin = 0; pin <= maxPin; ++pin) unpackerNeutralParityError(pin);
162  const bool rc = unpackerSuccess();
164  return rc;
165 }
166 
167 } // end namespace
LVL1BS::L1CaloSubBlock::setBunchCrossing
void setBunchCrossing(int bc)
Set the Bunch Crossing number (neutral format only)
Definition: L1CaloSubBlock.h:328
LVL1BS::JemRoiSubBlockV2::fillRoi
void fillRoi(LVL1::JEMTobRoI roi)
Store RoI.
Definition: JemRoiSubBlockV2.cxx:52
LVL1::JEMTobRoI::location
int location() const
Return location (RoI local coords) (0-3)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:89
LVL1BS::JemRoiSubBlockV2::s_wordIdVal
static const int s_wordIdVal
Header word ID.
Definition: JemRoiSubBlockV2.h:50
LVL1BS::L1CaloSubBlock::clear
void clear()
Clear all data.
Definition: L1CaloSubBlock.cxx:82
LVL1BS::JemRoiSubBlockV2::m_roiData
std::vector< LVL1::JEMTobRoI > m_roiData
RoIs.
Definition: JemRoiSubBlockV2.h:67
LVL1BS::L1CaloSubBlock::packerNeutral
void packerNeutral(int pin, uint32_t datum, int nbits)
Pack given neutral data from given pin.
Definition: L1CaloSubBlock.cxx:413
LVL1BS::JemRoiSubBlockV2::JemRoiSubBlockV2
JemRoiSubBlockV2()
Definition: JemRoiSubBlockV2.cxx:26
LVL1BS::JemRoiSubBlockV2::clear
void clear()
Clear all data.
Definition: JemRoiSubBlockV2.cxx:36
xAOD::JEMTobRoI
JEMTobRoI_v1 JEMTobRoI
Define the latest version of the JEMTobRoI class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/JEMTobRoI.h:17
LVL1BS::JemRoiSubBlockV2::packNeutral
bool packNeutral()
Pack neutral data.
Definition: JemRoiSubBlockV2.cxx:115
LVL1::JEMTobRoI::frame
int frame() const
Return RoI frame number (0-7)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:84
LVL1BS::L1CaloSubBlock::NEUTRAL
@ NEUTRAL
Definition: L1CaloSubBlock.h:28
LVL1BS::L1CaloSubBlock::setHeader
void setHeader(int wordId, int version, int format, int seqno, int crate, int module, int slices2, int slices1)
Store header data.
Definition: L1CaloSubBlock.cxx:99
LVL1BS::L1CaloSubBlock::bunchCrossing
int bunchCrossing() const
Return the Bunch Crossing number (neutral format only)
Definition: L1CaloSubBlock.h:333
LVL1BS::JemRoiSubBlockV2::s_bunchCrossingBits
static const int s_bunchCrossingBits
Definition: JemRoiSubBlockV2.h:58
LVL1BS::L1CaloSubBlock::crate
int crate() const
Definition: L1CaloSubBlock.h:263
python.PyAthena.module
module
Definition: PyAthena.py:131
LVL1BS::L1CaloSubBlock::UNPACK_DATA_TRUNCATED
@ UNPACK_DATA_TRUNCATED
Definition: L1CaloSubBlock.h:40
LVL1BS::JemRoiSubBlockV2::s_energySmallBits
static const int s_energySmallBits
Definition: JemRoiSubBlockV2.h:55
LVL1BS::L1CaloSubBlock::unpackerNeutralParityError
bool unpackerNeutralParityError(int pin)
Unpack and test G-Link parity bit for given pin.
Definition: L1CaloSubBlock.cxx:464
LVL1BS::L1CaloSubBlock::format
int format() const
Definition: L1CaloSubBlock.h:248
JEMTobRoI.h
LVL1BS::JemRoiSubBlockV2::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition: JemRoiSubBlockV2.cxx:141
LVL1BS::JemRoiSubBlockV2::~JemRoiSubBlockV2
~JemRoiSubBlockV2()
Definition: JemRoiSubBlockV2.cxx:30
LVL1BS::JemRoiSubBlockV2::s_locationBits
static const int s_locationBits
Definition: JemRoiSubBlockV2.h:57
LVL1BS::JemRoiSubBlockV2::roi
LVL1::JEMTobRoI roi(int frame) const
Return RoI for given frame.
Definition: JemRoiSubBlockV2.cxx:64
LVL1BS::L1CaloSubBlock::UNPACK_VERSION
@ UNPACK_VERSION
Definition: L1CaloSubBlock.h:38
LVL1::JEMTobRoI::energySmall
int energySmall() const
Return energy small window size.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:99
LVL1BS::JemRoiSubBlockV2::s_framesPerPin
static const int s_framesPerPin
Definition: JemRoiSubBlockV2.h:53
LVL1::JEMTobRoI
JEM RoI data.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:19
LVL1BS::L1CaloSubBlock::version
int version() const
Definition: L1CaloSubBlock.h:243
LVL1BS::L1CaloSubBlock::unpackerSuccess
bool unpackerSuccess() const
Return unpacker success flag.
Definition: L1CaloSubBlock.h:354
LVL1BS::JemRoiSubBlockV2::s_bunchCrossingPin
static const int s_bunchCrossingPin
Definition: JemRoiSubBlockV2.h:54
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
LVL1BS::L1CaloSubBlock::module
int module() const
Definition: L1CaloSubBlock.h:268
LVL1BS::JemRoiSubBlockV2::s_energyLargeBits
static const int s_energyLargeBits
Definition: JemRoiSubBlockV2.h:56
JemRoiSubBlockV2.h
get_generator_info.version
version
Definition: get_generator_info.py:33
LVL1BS
Definition: ZdcModifySlices.h:10
LVL1::JEMTobRoI::jem
int jem() const
Return JEM number (0-15)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:79
LVL1BS::L1CaloSubBlock::setUnpackErrorCode
void setUnpackErrorCode(int code)
Set the unpacking error code.
Definition: L1CaloSubBlock.h:338
LVL1::JEMTobRoI::energyLarge
int energyLarge() const
Return energy large window size.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:94
LVL1::JEMTobRoI::crate
int crate() const
Return crate number (0-1)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:74
LVL1BS::JemRoiSubBlockV2::setRoiHeader
void setRoiHeader(int version, int crate, int module)
Store header.
Definition: JemRoiSubBlockV2.cxx:44
LVL1BS::L1CaloSubBlock::unpackerNeutral
uint32_t unpackerNeutral(int pin, int nbits)
Unpack given number of bits of neutral data for given pin.
Definition: L1CaloSubBlock.cxx:445
LVL1BS::JemRoiSubBlockV2::pack
bool pack()
Pack data.
Definition: JemRoiSubBlockV2.cxx:73
LVL1BS::JemRoiSubBlockV2::s_frames
static const int s_frames
Definition: JemRoiSubBlockV2.h:52
LVL1BS::JemRoiSubBlockV2::unpack
bool unpack()
Unpack data.
Definition: JemRoiSubBlockV2.cxx:92
LVL1BS::L1CaloSubBlock::UNPACK_FORMAT
@ UNPACK_FORMAT
Definition: L1CaloSubBlock.h:39
LVL1BS::L1CaloSubBlock::packerNeutralParity
void packerNeutralParity(int pin)
Pack current G-Link parity bit for given pin.
Definition: L1CaloSubBlock.cxx:434
LVL1BS::JemRoiSubBlockV2::s_paddingBits
static const int s_paddingBits
Definition: JemRoiSubBlockV2.h:59