1 #ifndef UCTCTP7RawData5BX_hh
2 #define UCTCTP7RawData5BX_hh
14 edm::LogError(
"UCTCTP7RawData5BX") <<
"You gave me a nullptr :<";
20 edm::LogError(
"UCTCTP7RawData5BX") <<
"You gave me a nullptr :<";
36 size_t getIndex(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n) {
38 if (cType ==
EBEE || cType ==
HBHE) {
40 edm::LogError(
"UCTCTP7RawData5BX") <<
"Incorrect iPhi; iPhi = " << iPhi <<
"; should be in [0,3]";
43 if (cEta < 1 || cEta > 28) {
44 edm::LogError(
"UCTCTP7RawData5BX") <<
"Incorrect caloEta; cEta = " << cEta <<
"; should be in [1-28]";
53 index = (((cEta - 1) / 2) * (3 + 3) * 5 + ((cEta - 1) % 2)) + 3 * BX_n;
60 index += (6 * (3 + 3)) * 5;
67 index += ((14 * (3 + 3) + (2 * 4))) * 5;
73 }
else if (cType ==
HF) {
75 edm::LogError(
"UCTCTP7RawData5BX") <<
"HF iPhi should be 0 or 1 (for a , b) - invalid iPhi = " << iPhi;
78 if (cEta < 30 || cEta > 41) {
79 edm::LogError(
"UCTCTP7RawData5BX") <<
"HF cEta should be between 30 and 41 - invalid cEta = " << cEta;
87 index = 20 * (3 + 3) * 5 + ((cEta - 30) / 4) + 4 * BX_n;
90 index = 20 * (3 + 3) * 5 + 1 * 4 * 5 + ((cEta - 30) / 4) + 4 * BX_n;
95 index = 2 * 14 * (3 + 3) * 5 + 2 * 4 * 5 + ((cEta - 30) / 4) + 4 * BX_n;
98 index = 2 * 14 * (3 + 3) * 5 + 3 * 4 * 5 + ((cEta - 30) / 4) + 4 * BX_n;
102 edm::LogError(
"UCTCTP7RawData5BX") <<
"Unknown CaloType " << cType;
105 if (index >= 192 * 5) {
106 edm::LogError(
"UCTCTP7RawData5BX") <<
"Managed to calculate an out-of-bounds index, buyer beware";
113 size_t index =
getIndex(cType, negativeEta, cEta, iPhi, BX_n);
114 if (cType ==
EBEE || cType ==
HBHE) {
117 if (((cEta - 1) % 2) == 0) {
126 }
else if (cType ==
HF) {
136 index += (3 - ((cEta - 30) / 4));
139 edm::LogError(
"UCTCTP7RawData5BX") <<
"Managed to calculate an out-of-bounds index, buyer beware";
145 if (index >= 192 * 5) {
146 edm::LogError(
"UCTCTP7RawData5BX") <<
"Managed to calculate an out-of-bounds index, buyer beware";
151 void setET(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t et, uint32_t BX_n) {
153 edm::LogError(
"UCTCTP7RawData5BX") <<
"I was made in read-only mode";
156 size_t index =
getIndex(cType, negativeEta, cEta, iPhi, BX_n);
162 data |= (et & 0xFF) << 16;
164 data |= (et & 0xFF) << (((cEta - 30) % 4) * 8);
168 data |= (et & 0xFF) << (iPhi * 8);
172 uint32_t
getET(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n) {
173 size_t index =
getIndex(cType, negativeEta, cEta, iPhi, BX_n);
175 uint32_t et = 0xDEADBEEF;
180 et = ((data >> 16) & 0xFF);
182 et = ((data >> ((cEta - 30) % 4) * 8) & 0xFF);
185 et = ((data >> (iPhi * 8)) & 0xFF);
190 void setFB(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t fb, uint32_t BX_n) {
192 edm::LogError(
"UCTCTP7RawData5BX") <<
"I was made in read-only mode";
201 uint32_t
tower = iPhi;
202 if (((cEta - 1) % 2) == 1) {
205 data |= (fb & 0x1) << tower;
209 uint32_t
getFB(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n) {
217 uint32_t
tower = iPhi;
218 if (((cEta - 1) % 2) == 1) {
221 fb = ((data & (0x1 <<
tower)) != 0) ? 1 : 0;
226 void setHFFeatureBits(
bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t fb, uint32_t BX_n) {
228 edm::LogError(
"UCTCTP7RawData5BX") <<
"I was made in read-only mode";
232 uint32_t
shift = (cEta - 30) * 2;
237 data |= (fb & 0x3) << (shift - 8);
240 data |= (fb & 0x3) << (shift + 24);
248 uint32_t
shift = (cEta - 30) * 2;
251 return ((data >> shift) & 0x3);
261 size_t index = 2 * 14 * (3 + 3) * 5 + 4 * 4 * 5 + (region / 2) + 4 * BX_n;
264 if (index >= 192 * 5) {
265 edm::LogError(
"UCTCTP7RawData5BX") <<
"Managed to calculate an out-of-bounds index, buyer beware";
272 edm::LogError(
"UCTCTP7RawData5BX") <<
"I was made in read-only mode";
277 data |= (regionData & 0xFFFF) << (16 * (region % 2));
283 return ((data >> (16 * (region % 2))) & 0xFFFF);
303 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi, BX_n);
304 uint32_t
tower = iPhi;
312 return ((linkStatus & (0x1 << tower)) != 0);
316 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi, BX_n);
317 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
318 return ((linkStatus & 0x00000100) != 0);
320 return ((linkStatus & 0x00001000) != 0);
324 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi, BX_n);
325 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
326 return ((linkStatus & 0x00000200) != 0);
328 return ((linkStatus & 0x00002000) != 0);
332 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi, BX_n);
333 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
334 return ((linkStatus & 0x00000400) != 0);
336 return ((linkStatus & 0x00004000) != 0);
340 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi, BX_n);
341 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
342 return ((linkStatus & 0x00000800) != 0);
344 return ((linkStatus & 0x00008000) != 0);
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
const uint32_t * myDataPtr
uint32_t * myDataWritePtr
size_t getFeatureIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
void setET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t et, uint32_t BX_n)
uint32_t getRegionET(bool negativeEta, uint32_t region, uint32_t BX_n)
const uint32_t * dataPtr() const
Log< level::Error, false > LogError
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
void setHFFeatureBits(bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t fb, uint32_t BX_n)
uint32_t getRegionSummary(bool negativeEta, uint32_t region, uint32_t BX_n)
UCTCTP7RawData5BX(const uint32_t *d)
uint32_t getRegionHitLocation(bool negativeEta, uint32_t region, uint32_t BX_n)
size_t getIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
bool getRegionEGVeto(bool negativeEta, uint32_t region, uint32_t BX_n)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
bool getRegionTauVeto(bool negativeEta, uint32_t region, uint32_t BX_n)
uint32_t getHFFeatureBits(bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
virtual ~UCTCTP7RawData5BX()
size_t getSummaryIndex(bool negativeEta, uint32_t region, uint32_t BX_n)
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
char data[epos_bytes_allocation]
static unsigned int const shift
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
void setRegionSummary(bool negativeEta, uint32_t region, uint32_t regionData, uint32_t BX_n)
UCTCTP7RawData5BX(uint32_t *d)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
void setFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t fb, uint32_t BX_n)
const UCTCTP7RawData5BX & operator=(const UCTCTP7RawData5BX &i)=delete