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;
36 makeECalTPGs(ctp7_phi, ctp7Data,
res->getEcalDigis());
37 makeHCalTPGs(ctp7_phi, ctp7Data,
res->getHcalDigis());
38 makeHFTPGs(ctp7_phi, ctp7Data,
res->getHcalDigis());
39 makeRegions(ctp7_phi, ctp7Data,
res->getRegions());
40 for (
int i = 0;
i < 5;
i++) {
42 makeECalTPGs(ctp7_phi, ctp7Data,
res->getEcalDigisBx(
i));
46 LogError(
"CaloLayer1Unpacker") <<
"Number of BXs to unpack is not 1 or 5, stop here !!! " <<
N_BX << std::endl;
53 void CaloLayer1Unpacker::makeECalTPGs(uint32_t lPhi,
57 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
58 int cPhi = -1 + lPhi * 4 + iPhi;
64 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeECalTPGs" << std::endl;
67 for (
int cEta = -28; cEta <= 28; cEta++) {
69 bool negativeEta =
false;
80 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
81 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
106 void CaloLayer1Unpacker::makeHCalTPGs(uint32_t lPhi,
110 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
111 int cPhi = -1 + lPhi * 4 + iPhi;
116 else if (cPhi < -1) {
117 LogError(
"CaloLayer1Unpacker") <<
"Major error in makeHCalTPGs" << std::endl;
120 for (
int cEta = -28; cEta <= 28; cEta++) {
122 bool negativeEta =
false;
133 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
134 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
135 towerDatum |= 0x0100;
137 towerDatum |= 0x0200;
139 towerDatum |= 0x0400;
141 towerDatum |= 0x0800;
143 towerDatum |= 0x2000;
145 towerDatum |= 0x4000;
149 towerDatum |= 0x8000;
163 for (uint32_t side = 0; side <= 1; side++) {
164 bool negativeEta =
false;
168 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
169 if (iPhi == 1 &&
iEta == 40)
171 int cPhi = 1 + lPhi * 4 + iPhi * 2;
174 cPhi = (cPhi + 69) % 72 + 1;
186 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
187 towerDatum |= ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) << 8;
189 towerDatum |= 0x0400;
191 towerDatum |= 0x0800;
193 towerDatum |= 0x1000;
195 towerDatum |= 0x2000;
197 towerDatum |= 0x4000;
201 towerDatum |= 0x8000;
215 for (uint32_t side = 0; side <= 1; side++) {
216 bool negativeEta =
false;
221 uint32_t lEta = 10 -
region;
224 regions->push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)lEta, (
unsigned)lPhi, (int16_t)0));