1 #ifndef UCTCTP7RawData_hh 2 #define UCTCTP7RawData_hh 13 if (
sof() != 0xA110CA7E) {
14 edm::LogError(
"UCTCTP7RawData") <<
"Failed to see 0xA110CA7E at start - but continuing" << std::endl;
36 uint32_t
index = 0xDEADBEEF;
37 if (cType ==
EBEE || cType ==
HBHE) {
39 edm::LogError(
"UCTCTP7RawData") <<
"Incorrect iPhi; iPhi = " << iPhi <<
"; should be in [0,3]" << std::endl;
42 if (cEta < 1 || cEta > 28) {
43 edm::LogError(
"UCTCTP7RawData") <<
"Incorrect caloEta; cEta = " << cEta <<
"; should be in [1-28]" << std::endl;
50 index = 2 + (((cEta - 1) / 2) * (3 + 3) + ((cEta - 1) % 2));
57 index += (6 * (3 + 3));
64 index += ((14 * (3 + 3) + (2 * 4)));
70 }
else if (cType ==
HF) {
72 edm::LogError(
"UCTCTP7RawData") <<
"HF iPhi should be 0 or 1 (for a , b) - invalid iPhi = " << iPhi
76 if (cEta < 30 || cEta > 41) {
77 edm::LogError(
"UCTCTP7RawData") <<
"HF cEta should be between 30 and 41 - invalid cEta = " << cEta << std::endl;
85 index = 2 + 20 * (3 + 3) + ((cEta - 30) / 4);
88 index = 2 + 20 * (3 + 3) + 1 * 4 + ((cEta - 30) / 4);
93 index = 2 + 2 * 14 * (3 + 3) + 2 * 4 + ((cEta - 30) / 4);
96 index = 2 + 2 * 14 * (3 + 3) + 3 * 4 + ((cEta - 30) / 4);
100 edm::LogError(
"UCTCTP7RawData") <<
"Unknown CaloType " << cType << std::endl;
109 if (cType ==
EBEE || cType ==
HBHE) {
112 if (((cEta - 1) % 2) == 0) {
121 }
else if (cType ==
HF) {
131 index += (3 - ((cEta - 30) / 4));
138 uint32_t
getET(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi) {
141 uint32_t
et = 0xDEADBEEF;
146 et = ((
data >> 16) & 0xFF);
148 et = ((
data >> ((cEta - 30) % 4) * 8) & 0xFF);
151 et = ((
data >> (iPhi * 8)) & 0xFF);
156 uint32_t
getFB(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi) {
164 uint32_t
tower = iPhi;
165 if (((cEta - 1) % 2) == 1) {
168 fb = ((
data & (0x1 <<
tower)) != 0) ? 1 : 0;
177 uint32_t
shift = (cEta - 30) * 2;
190 uint32_t
index = 2 + 2 * 14 * (3 + 3) + 4 * 4 + (
region / 2);
199 return ((
data >> (16 * (
region % 2))) & 0xFFFF);
213 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
214 uint32_t
tower = iPhi;
215 if (((cEta - 1) % 2) == 1)
222 return ((linkStatus & (0
x1 <<
tower)) != 0);
226 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
227 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
228 return ((linkStatus & 0x00000100) != 0);
230 return ((linkStatus & 0x00001000) != 0);
234 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
235 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
236 return ((linkStatus & 0x00000200) != 0);
238 return ((linkStatus & 0x00002000) != 0);
242 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
243 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
244 return ((linkStatus & 0x00000400) != 0);
246 return ((linkStatus & 0x00004000) != 0);
250 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
251 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
252 return ((linkStatus & 0x00000800) != 0);
254 return ((linkStatus & 0x00008000) != 0);
259 edm::LogError(
"UCTCTP7RawData") <<
"CTP7 Payload Header:" << endl;
263 bool negativeEta =
false;
265 for (uint32_t
i = 0;
i < 2;
i++) {
270 for (uint32_t cEta = 1; cEta <= 28; cEta++) {
271 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
272 if (
getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
getET(cType, negativeEta, cEta, iPhi) != 0) {
274 edm::LogError(
"UCTCTP7RawData") <<
"EcalET FG LinkStatus" << endl;
277 <<
dec << setfill(
' ') << setw(6) <<
getET(cType, negativeEta, cEta, iPhi) <<
" " 278 <<
getFB(cType, negativeEta, cEta, iPhi) <<
" " << showbase <<
internal << setfill(
'0') << setw(10)
280 <<
getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi
287 for (uint32_t cEta = 1; cEta <= 28; cEta++) {
288 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
289 if (
getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
getET(cType, negativeEta, cEta, iPhi) != 0) {
291 edm::LogError(
"UCTCTP7RawData") <<
"HcalET Feature LinkStatus" << endl;
294 <<
dec << setfill(
' ') << setw(6) <<
getET(cType, negativeEta, cEta, iPhi) <<
" " 295 <<
getFB(cType, negativeEta, cEta, iPhi) <<
" " << showbase <<
internal << setfill(
'0') << setw(10)
297 <<
getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi
304 for (uint32_t cEta = 30; cEta <= 40; cEta++) {
305 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
306 if (iPhi == 1 && cEta == 40)
308 if (
getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
getET(cType, negativeEta, cEta, iPhi) != 0) {
310 edm::LogError(
"UCTCTP7RawData") <<
"HF-ET Feature LinkStatus" << endl;
313 <<
dec << setfill(
' ') << setw(6) <<
getET(cType, negativeEta, cEta, iPhi) <<
" " <<
dec 314 << setfill(
' ') << setw(2) <<
getHFFeatureBits(negativeEta, cEta, iPhi) <<
" " << showbase <<
internal 315 << setfill(
'0') << setw(10) << hex <<
getLinkStatus(cType, negativeEta, cEta, iPhi) <<
" (" <<
dec 316 <<
getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi
324 edm::LogError(
"UCTCTP7RawData") <<
"Region ET EGVeto TauVeto HitLocation" << endl;
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool getRegionTauVeto(bool negativeEta, uint32_t region)
uint32_t getSummaryIndex(bool negativeEta, uint32_t region)
uint32_t getHFFeatureBits(bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
size_t getFeatureIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
const UCTCTP7RawData & operator=(const UCTCTP7RawData &i)=delete
Log< level::Error, false > LogError
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool getRegionEGVeto(bool negativeEta, uint32_t region)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
const uint32_t * dataPtr() const
const uint32_t * myDataPtr
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t getIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
UCTCTP7RawData(const uint32_t *d)
size_t getSummaryIndex(bool negativeEta, uint32_t region)
uint32_t getRegionET(bool negativeEta, uint32_t region)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
char data[epos_bytes_allocation]
size_t getIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
static unsigned int const shift
virtual ~UCTCTP7RawData()
uint32_t getRegionSummary(bool negativeEta, uint32_t region)
uint32_t getRegionHitLocation(bool negativeEta, uint32_t region)
uint32_t getFeatureIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)