16 LogDebug(
"L1T") <<
"Block size = " <<
block.header().getSize();
19 auto res = static_cast<CaloLayer1Collections*>(coll);
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) {
34 const uint32_t* ptr5 = ptr;
37 makeECalTPGs(ctp7_phi, ctp7Data,
res->getEcalDigis());
38 makeHCalTPGs(ctp7_phi, ctp7Data,
res->getHcalDigis());
39 makeHFTPGs(ctp7_phi, ctp7Data,
res->getHcalDigis());
40 makeRegions(ctp7_phi, ctp7Data,
res->getRegions());
41 for (
int i = 0;
i < 5;
i++) {
43 makeECalTPGs(ctp7_phi, ctp7Data,
res->getEcalDigisBx(
i));
47 LogError(
"CaloLayer1Unpacker") <<
"Number of BXs to unpack is not 1 or 5, stop here !!! " <<
N_BX << std::endl;
54 void CaloLayer1Unpacker::makeECalTPGs(uint32_t lPhi,
58 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
59 int cPhi = -1 + lPhi * 4 + iPhi;
65 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeECalTPGs" << std::endl;
68 for (
int cEta = -28; cEta <= 28; cEta++) {
70 bool negativeEta =
false;
81 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
82 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
107 void CaloLayer1Unpacker::makeHCalTPGs(uint32_t lPhi,
111 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
112 int cPhi = -1 + lPhi * 4 + iPhi;
117 else if (cPhi < -1) {
118 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeHCalTPGs" << std::endl;
121 for (
int cEta = -28; cEta <= 28; cEta++) {
123 bool negativeEta =
false;
134 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
135 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
136 towerDatum |= 0x0100;
138 towerDatum |= 0x0200;
140 towerDatum |= 0x0400;
142 towerDatum |= 0x0800;
144 towerDatum |= 0x2000;
146 towerDatum |= 0x4000;
150 towerDatum |= 0x8000;
164 for (uint32_t side = 0; side <= 1; side++) {
165 bool negativeEta =
false;
169 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
170 if (iPhi == 1 &&
iEta == 40)
172 int cPhi = 1 + lPhi * 4 + iPhi * 2;
175 cPhi = (cPhi + 69) % 72 + 1;
187 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
188 towerDatum |= ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) << 8;
190 towerDatum |= 0x0400;
192 towerDatum |= 0x0800;
194 towerDatum |= 0x1000;
196 towerDatum |= 0x2000;
198 towerDatum |= 0x4000;
202 towerDatum |= 0x8000;
216 for (uint32_t side = 0; side <= 1; side++) {
217 bool negativeEta =
false;
222 uint32_t lEta = 10 -
region;
225 regions->push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)lEta, (
unsigned)lPhi, (int16_t)0));