1 #ifndef UCTCTP7RawData_hh 2 #define UCTCTP7RawData_hh 14 if(myDataPtr !=
nullptr) {
15 if(sof() != 0xA110CA7E) {
16 LogError(
"UCTCTP7RawData") <<
"Failed to see 0xA110CA7E at start - but continuing" << std::endl;
25 const uint32_t *
dataPtr()
const {
return myDataPtr;}
27 uint32_t
sof() {
return myDataPtr[0];}
31 uint32_t
nBXPerL1A() {
return ((myDataPtr[1] & 0x000F0000) >> 16);}
34 uint32_t
index = 0xDEADBEEF;
35 if(cType == EBEE || cType == HBHE) {
37 LogError(
"UCTCTP7RawData") <<
"Incorrect iPhi; iPhi = " << iPhi <<
"; should be in [0,3]" << std::endl;
40 if(cEta < 1 || cEta > 28) {
41 LogError(
"UCTCTP7RawData") <<
"Incorrect caloEta; cEta = " << cEta <<
"; should be in [1-28]" << std::endl;
48 index = 2 + ( ((cEta - 1) / 2) * (3 + 3) + ((cEta - 1) % 2) );
55 index += (6 * (3 + 3));
63 index += ((14 * (3 + 3) + (2 * 4)));
67 if(cType == HBHE) index += 3;
69 else if(cType == HF) {
71 LogError(
"UCTCTP7RawData") <<
"HF iPhi should be 0 or 1 (for a , b) - invalid iPhi = " << iPhi << std::endl;
74 if(cEta < 30 || cEta > 41) {
75 LogError(
"UCTCTP7RawData") <<
"HF cEta should be between 30 and 41 - invalid cEta = " << cEta << std::endl;
83 index = 2 + 20 * (3 + 3) + ((cEta - 30) / 4);
87 index = 2 + 20 * (3 + 3) + 1 * 4 + ((cEta - 30) / 4);
93 index = 2 + 2 * 14 * (3 + 3) + 2 * 4 + ((cEta - 30) / 4);
97 index = 2 + 2 * 14 * (3 + 3) + 3 * 4 + ((cEta - 30) / 4);
102 LogError(
"UCTCTP7RawData") <<
"Unknown CaloType " << cType << std::endl;
110 uint32_t
index = getIndex(cType, negativeEta, cEta, iPhi);
111 if(cType == EBEE || cType == HBHE) {
114 if(((cEta - 1) % 2) == 0) {
125 else if(cType == HF) {
135 index += (3 - ((cEta - 30) / 4));
143 uint32_t
getET(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi) {
144 uint32_t
index = getIndex(cType, negativeEta, cEta, iPhi);
146 uint32_t
et = 0xDEADBEEF;
150 if(cEta == 41) et = ((data >> 16) & 0xFF);
151 else et = ((data >> ((cEta - 30) % 4) * 8) & 0xFF);
155 et = ((data >> (iPhi * 8)) & 0xFF);
160 uint32_t
getFB(
CaloType cType,
bool negativeEta, uint32_t cEta, uint32_t iPhi) {
161 uint32_t
index = getFeatureIndex(cType, negativeEta, cEta, iPhi);
165 fb = getHFFeatureBits(negativeEta, cEta, iPhi);
169 uint32_t tower = iPhi;
170 if(((cEta - 1) % 2) == 1) {
173 fb = ((data & (0x1 << tower)) != 0) ? 1 : 0;
179 uint32_t
index = getFeatureIndex(HF, negativeEta, cEta, iPhi);
181 const uint32_t
data = ((myDataPtr[
index] & 0x3FFF) << 8) + (myDataPtr[index - 1] >> 24);
182 uint32_t
shift = (cEta - 30) * 2;
183 if(cEta == 41) shift = 20;
184 return ((data >> shift) & 0x3);
188 uint32_t
index = getFeatureIndex(cType, negativeEta, cEta, iPhi);
194 uint32_t
index = 2 + 2 * 14 * (3 + 3) + 4 * 4 + (region / 2);
195 if(negativeEta) index += 4;
200 uint32_t
index = getSummaryIndex(negativeEta, region);
202 return ((data >> (16 * (region % 2))) & 0xFFFF);
206 return (getRegionSummary(negativeEta, region) & 0x3FF);
210 return (getRegionSummary(negativeEta, region) & 0x0400);
214 return (getRegionSummary(negativeEta, region) & 0x0800);
218 return ((getRegionSummary(negativeEta, region) & 0xF000) >> 12);
222 uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
223 uint32_t tower = iPhi;
224 if(((cEta - 1) % 2) == 1) tower += 4;
227 if(cEta == 41) tower = 10;
229 return ((linkStatus & (0
x1 << tower)) != 0);
233 uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
234 if ( cType == EBEE && (cEta==17||cEta==21) ) {
235 return ((linkStatus & 0x00000100) != 0);
237 return ((linkStatus & 0x00001000) != 0);
241 uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
242 if ( cType == EBEE && (cEta==17||cEta==21) ) {
243 return ((linkStatus & 0x00000200) != 0);
245 return ((linkStatus & 0x00002000) != 0);
249 uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
250 if ( cType == EBEE && (cEta==17||cEta==21) ) {
251 return ((linkStatus & 0x00000400) != 0);
253 return ((linkStatus & 0x00004000) != 0);
257 uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
258 if ( cType == EBEE && (cEta==17||cEta==21) ) {
259 return ((linkStatus & 0x00000800) != 0);
261 return ((linkStatus & 0x00008000) != 0);
266 LogError(
"UCTCTP7RawData") <<
"CTP7 Payload Header:" << endl;
267 LogError(
"UCTCTP7RawData") <<
"No BX per L1A = " <<
dec << nBXPerL1A() << endl;
268 LogError(
"UCTCTP7RawData") <<
"Calo BX ID = " <<
dec << caloLinkBXID() << endl;
270 bool negativeEta =
false;
272 for(uint32_t
i = 0;
i < 2;
i++) {
273 if(
i != 0) negativeEta =
true;
276 for(uint32_t cEta = 1; cEta <= 28; cEta++) {
277 for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
278 if(getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
279 getET(cType, negativeEta, cEta, iPhi) != 0) {
280 if(first)
LogError(
"UCTCTP7RawData") <<
"EcalET FG LinkStatus" << endl;
282 LogError(
"UCTCTP7RawData") <<
dec << setfill(
' ') << setw(6) << getET(cType, negativeEta, cEta, iPhi) <<
" " 283 << getFB(cType, negativeEta, cEta, iPhi) <<
" " 284 << showbase <<
internal << setfill(
'0') << setw(10) << hex << getLinkStatus(cType, negativeEta, cEta, iPhi)
285 <<
" (" <<
dec << getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi <<
")" 292 for(uint32_t cEta = 1; cEta <= 28; cEta++) {
293 for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
294 if(getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
295 getET(cType, negativeEta, cEta, iPhi) != 0) {
296 if(first)
LogError(
"UCTCTP7RawData") <<
"HcalET Feature LinkStatus" << endl;
298 LogError(
"UCTCTP7RawData") <<
dec << setfill(
' ') << setw(6) << getET(cType, negativeEta, cEta, iPhi) <<
" " 299 << getFB(cType, negativeEta, cEta, iPhi) <<
" " 300 << showbase <<
internal << setfill(
'0') << setw(10) << hex << getLinkStatus(cType, negativeEta, cEta, iPhi)
301 <<
" (" <<
dec << getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi <<
")" 308 for(uint32_t cEta = 30; cEta <= 40; cEta++) {
309 for(uint32_t iPhi = 0; iPhi < 2; iPhi++) {
310 if(iPhi == 1 && cEta == 40) cEta = 41;
311 if(getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
312 getET(cType, negativeEta, cEta, iPhi) != 0) {
313 if(first)
LogError(
"UCTCTP7RawData") <<
"HF-ET Feature LinkStatus" << endl;
315 LogError(
"UCTCTP7RawData") <<
dec << setfill(
' ') << setw(6) << getET(cType, negativeEta, cEta, iPhi) <<
" " 316 <<
dec << setfill(
' ') << setw(2) << getHFFeatureBits(negativeEta, cEta, iPhi) <<
" " 317 << showbase <<
internal << setfill(
'0') << setw(10) << hex << getLinkStatus(cType, negativeEta, cEta, iPhi)
318 <<
" (" <<
dec << getIndex(cType, negativeEta, cEta, iPhi) <<
", " << negativeEta <<
", " << cEta <<
", " << iPhi <<
")" 324 for(uint32_t region = 0; region < 7; region++) {
325 if(first)
LogError(
"UCTCTP7RawData") <<
"Region ET EGVeto TauVeto HitLocation" << endl;
327 LogError(
"UCTCTP7RawData") <<
dec << setfill(
' ') << setw(6) << region
328 <<
" " << hex << showbase <<
internal << setfill(
'0') << setw(6) << getRegionET(negativeEta, region) <<
dec 329 <<
" " << getRegionEGVeto(negativeEta, region)
330 <<
" " << getRegionTauVeto(negativeEta, region)
331 <<
" " << showbase <<
internal << setfill(
'0') << setw(3) << hex << getRegionHitLocation(negativeEta, region)
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)
const uint32_t * myDataPtr
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)
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)
et
define resolution functions of each parameter
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]
const uint32_t * dataPtr() const
static unsigned int const shift
virtual ~UCTCTP7RawData()
T first(std::pair< T, U > const &p)
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)