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;
32 uint32_t
index = 0xDEADBEEF;
33 if (cType ==
EBEE || cType ==
HBHE) {
35 edm::LogError(
"UCTCTP7RawData") <<
"Incorrect iPhi; iPhi = " << iPhi <<
"; should be in [0,3]" << std::endl;
38 if (cEta < 1 || cEta > 28) {
39 edm::LogError(
"UCTCTP7RawData") <<
"Incorrect caloEta; cEta = " << cEta <<
"; should be in [1-28]" << std::endl;
46 index = 2 + (((cEta - 1) / 2) * (3 + 3) + ((cEta - 1) % 2));
53 index += (6 * (3 + 3));
60 index += ((14 * (3 + 3) + (2 * 4)));
66 }
else if (cType ==
HF) {
68 edm::LogError(
"UCTCTP7RawData") <<
"HF iPhi should be 0 or 1 (for a , b) - invalid iPhi = " << iPhi
72 if (cEta < 30 || cEta > 41) {
73 edm::LogError(
"UCTCTP7RawData") <<
"HF cEta should be between 30 and 41 - invalid cEta = " << cEta << std::endl;
81 index = 2 + 20 * (3 + 3) + ((cEta - 30) / 4);
84 index = 2 + 20 * (3 + 3) + 1 * 4 + ((cEta - 30) / 4);
89 index = 2 + 2 * 14 * (3 + 3) + 2 * 4 + ((cEta - 30) / 4);
92 index = 2 + 2 * 14 * (3 + 3) + 3 * 4 + ((cEta - 30) / 4);
96 edm::LogError(
"UCTCTP7RawData") <<
"Unknown CaloType " << cType << std::endl;
105 if (cType ==
EBEE || cType ==
HBHE) {
108 if (((cEta - 1) % 2) == 0) {
117 }
else if (cType ==
HF) {
127 index += (3 - ((cEta - 30) / 4));
134 uint32_t
getET(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi) {
137 uint32_t
et = 0xDEADBEEF;
142 et = ((
data >> 16) & 0xFF);
144 et = ((
data >> ((cEta - 30) % 4) * 8) & 0xFF);
147 et = ((
data >> (iPhi * 8)) & 0xFF);
152 uint32_t
getFB(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi) {
160 uint32_t
tower = iPhi;
161 if (((cEta - 1) % 2) == 1) {
173 uint32_t
shift = (cEta - 30) * 2;
186 uint32_t
index = 2 + 2 * 14 * (3 + 3) + 4 * 4 + (
region / 2);
195 return ((
data >> (16 * (
region % 2))) & 0xFFFF);
209 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
210 uint32_t
tower = iPhi;
211 if (((cEta - 1) % 2) == 1)
218 return ((linkStatus & (0
x1 <<
tower)) != 0);
222 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
223 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
224 return ((linkStatus & 0x00000100) != 0);
226 return ((linkStatus & 0x00001000) != 0);
230 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
231 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
232 return ((linkStatus & 0x00000200) != 0);
234 return ((linkStatus & 0x00002000) != 0);
238 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
239 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
240 return ((linkStatus & 0x00000400) != 0);
242 return ((linkStatus & 0x00004000) != 0);
246 uint32_t linkStatus =
getLinkStatus(cType, negativeEta, cEta, iPhi);
247 if (cType ==
EBEE && (cEta == 17 || cEta == 21)) {
248 return ((linkStatus & 0x00000800) != 0);
250 return ((linkStatus & 0x00008000) != 0);
255 edm::LogError(
"UCTCTP7RawData") <<
"CTP7 Payload Header:" << endl;
259 bool negativeEta =
false;
261 for (uint32_t
i = 0;
i < 2;
i++) {
266 for (uint32_t cEta = 1; cEta <= 28; cEta++) {
267 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
268 if (
getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
getET(cType, negativeEta, cEta, iPhi) != 0) {
270 edm::LogError(
"UCTCTP7RawData") <<
"EcalET FG LinkStatus" << endl;
273 <<
dec << setfill(
' ') << setw(6) <<
getET(cType, negativeEta, cEta, iPhi) <<
" "
274 <<
getFB(cType, negativeEta, cEta, iPhi) <<
" " << showbase <<
internal << setfill(
'0') << setw(10)
276 <<
getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi
283 for (uint32_t cEta = 1; cEta <= 28; cEta++) {
284 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
285 if (
getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
getET(cType, negativeEta, cEta, iPhi) != 0) {
287 edm::LogError(
"UCTCTP7RawData") <<
"HcalET Feature LinkStatus" << endl;
290 <<
dec << setfill(
' ') << setw(6) <<
getET(cType, negativeEta, cEta, iPhi) <<
" "
291 <<
getFB(cType, negativeEta, cEta, iPhi) <<
" " << showbase <<
internal << setfill(
'0') << setw(10)
293 <<
getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi
300 for (uint32_t cEta = 30; cEta <= 40; cEta++) {
301 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
302 if (iPhi == 1 && cEta == 40)
304 if (
getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
getET(cType, negativeEta, cEta, iPhi) != 0) {
306 edm::LogError(
"UCTCTP7RawData") <<
"HF-ET Feature LinkStatus" << endl;
309 <<
dec << setfill(
' ') << setw(6) <<
getET(cType, negativeEta, cEta, iPhi) <<
" " <<
dec
310 << setfill(
' ') << setw(2) <<
getHFFeatureBits(negativeEta, cEta, iPhi) <<
" " << showbase <<
internal
311 << setfill(
'0') << setw(10) << hex <<
getLinkStatus(cType, negativeEta, cEta, iPhi) <<
" (" <<
dec
312 <<
getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi
320 edm::LogError(
"UCTCTP7RawData") <<
"Region ET EGVeto TauVeto HitLocation" << endl;