16 LogDebug(
"L1T") <<
"Block size = " <<
block.header().getSize();
21 auto ctp7_phi =
block.amc().getBoardID();
22 const uint32_t* ptr =
block.payload().data();
24 int N_BX = (
block.header().getFlags() >> 16) & 0xf;
29 makeECalTPGs(ctp7_phi, ctp7Data,
res->getEcalDigis());
30 makeHCalTPGs(ctp7_phi, ctp7Data,
res->getHcalDigis());
31 makeHFTPGs(ctp7_phi, ctp7Data,
res->getHcalDigis());
32 makeRegions(ctp7_phi, ctp7Data,
res->getRegions());
33 }
else if (
N_BX == 5) {
36 makeECalTPGs5BX(ctp7_phi, ctp7Data5BX,
res->getEcalDigis(), 2);
37 makeHCalTPGs5BX(ctp7_phi, ctp7Data5BX,
res->getHcalDigis(), 2);
38 makeHFTPGs5BX(ctp7_phi, ctp7Data5BX,
res->getHcalDigis(), 2);
39 makeRegions5BX(ctp7_phi, ctp7Data5BX,
res->getRegions(), 2);
40 for (
int i = 0;
i < 5;
i++) {
41 makeECalTPGs5BX(ctp7_phi, ctp7Data5BX,
res->getEcalDigisBx(
i),
i);
44 LogError(
"CaloLayer1Unpacker") <<
"Number of BXs to unpack is not 1 or 5, stop here !!! " <<
N_BX << std::endl;
51 void CaloLayer1Unpacker::makeECalTPGs(uint32_t lPhi,
55 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
56 int cPhi = -1 + lPhi * 4 + iPhi;
62 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeECalTPGs" << std::endl;
65 for (
int cEta = -28; cEta <= 28; cEta++) {
67 bool negativeEta =
false;
78 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
79 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
104 void CaloLayer1Unpacker::makeHCalTPGs(uint32_t lPhi,
108 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
109 int cPhi = -1 + lPhi * 4 + iPhi;
114 else if (cPhi < -1) {
115 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeHCalTPGs" << std::endl;
118 for (
int cEta = -28; cEta <= 28; cEta++) {
120 bool negativeEta =
false;
131 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
132 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
133 towerDatum |= 0x0100;
135 towerDatum |= 0x0200;
137 towerDatum |= 0x0400;
139 towerDatum |= 0x0800;
141 towerDatum |= 0x2000;
143 towerDatum |= 0x4000;
147 towerDatum |= 0x8000;
161 for (uint32_t side = 0; side <= 1; side++) {
162 bool negativeEta =
false;
166 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
167 if (iPhi == 1 &&
iEta == 40)
169 int cPhi = 1 + lPhi * 4 + iPhi * 2;
172 cPhi = (cPhi + 69) % 72 + 1;
184 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
185 towerDatum |= ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) << 8;
187 towerDatum |= 0x0400;
189 towerDatum |= 0x0800;
191 towerDatum |= 0x1000;
193 towerDatum |= 0x2000;
195 towerDatum |= 0x4000;
199 towerDatum |= 0x8000;
213 for (uint32_t side = 0; side <= 1; side++) {
214 bool negativeEta =
false;
219 uint32_t lEta = 10 -
region;
222 regions->push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)lEta, (
unsigned)lPhi, (int16_t)0));
232 void CaloLayer1Unpacker::makeECalTPGs5BX(uint32_t lPhi,
237 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
238 int cPhi = -1 + lPhi * 4 + iPhi;
243 else if (cPhi < -1) {
244 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeECalTPGs5BX" << std::endl;
247 for (
int cEta = -28; cEta <= 28; cEta++) {
249 bool negativeEta =
false;
260 uint32_t towerDatum = ctp7Data5BX.
getET(cType, negativeEta,
iEta, iPhi, BX_n);
261 if (ctp7Data5BX.
getFB(cType, negativeEta,
iEta, iPhi, BX_n) != 0)
262 towerDatum |= 0x0100;
264 towerDatum |= 0x2000;
266 towerDatum |= 0x4000;
270 towerDatum |= 0x8000;
272 int zSide = cEta / ((
int)
iEta);
286 void CaloLayer1Unpacker::makeHCalTPGs5BX(uint32_t lPhi,
291 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
292 int cPhi = -1 + lPhi * 4 + iPhi;
297 else if (cPhi < -1) {
298 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeHCalTPGs5BX" << std::endl;
301 for (
int cEta = -28; cEta <= 28; cEta++) {
303 bool negativeEta =
false;
314 uint32_t towerDatum = ctp7Data5BX.
getET(cType, negativeEta,
iEta, iPhi, BX_n);
315 if (ctp7Data5BX.
getFB(cType, negativeEta,
iEta, iPhi, BX_n) != 0)
316 towerDatum |= 0x0100;
318 towerDatum |= 0x0200;
320 towerDatum |= 0x0400;
322 towerDatum |= 0x0800;
324 towerDatum |= 0x2000;
326 towerDatum |= 0x4000;
330 towerDatum |= 0x8000;
342 void CaloLayer1Unpacker::makeHFTPGs5BX(uint32_t lPhi,
347 for (uint32_t side = 0; side <= 1; side++) {
348 bool negativeEta =
false;
352 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
353 if (iPhi == 1 &&
iEta == 40)
355 int cPhi = 1 + lPhi * 4 + iPhi * 2;
358 cPhi = (cPhi + 69) % 72 + 1;
370 uint32_t towerDatum = ctp7Data5BX.
getET(cType, negativeEta,
iEta, iPhi, BX_n);
371 towerDatum |= ctp7Data5BX.
getFB(cType, negativeEta,
iEta, iPhi, BX_n) << 8;
373 towerDatum |= 0x0400;
375 towerDatum |= 0x0800;
377 towerDatum |= 0x1000;
379 towerDatum |= 0x2000;
381 towerDatum |= 0x4000;
385 towerDatum |= 0x8000;
398 void CaloLayer1Unpacker::makeRegions5BX(uint32_t lPhi,
402 for (uint32_t side = 0; side <= 1; side++) {
403 bool negativeEta =
false;
408 uint32_t lEta = 10 -
region;
411 regions->push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)lEta, (
unsigned)lPhi, (int16_t)0));
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
void push_back(T const &t)
Log< level::Error, false > LogError
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
uint32_t getRegionSummary(bool negativeEta, uint32_t region, uint32_t BX_n)
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
Abs< T >::type abs(const T &t)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
#define DEFINE_L1T_UNPACKER(type)
A calorimeter trigger region (sum of 4x4 trigger towers)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
std::vector< L1CaloRegion > L1CaloRegionCollection
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
uint32_t getRegionSummary(bool negativeEta, uint32_t region)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t BX_n)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)