18 event.getByToken(static_cast<const CaloLayer1Tokens*>(toks)->getEcalDigiToken(), ecalDigis);
20 event.getByToken(static_cast<const CaloLayer1Tokens*>(toks)->getHcalDigiToken(), hcalDigis);
22 event.getByToken(static_cast<const CaloLayer1Tokens*>(toks)->getCaloRegionToken(), caloRegions);
24 std::vector<uint32_t>
load;
27 auto ctp7_phi =
board();
28 uint32_t * ptr = &*load.begin();
35 unsigned bx_per_l1a = 1;
38 unsigned calo_bxid = (
event.bunchCrossing()+1) % 3564;
42 unsigned blockSize = 192;
44 unsigned blockFlags = ((bx_per_l1a&0xf)<<16) | (calo_bxid&0xfff);
46 Block block(hdr, &*load.begin(), &*load.end());
55 for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
56 int cPhi = - 1 + lPhi * 4 + iPhi;
57 if(cPhi == 0) cPhi = 72;
58 else if(cPhi == -1) cPhi = 71;
60 edm::LogError(
"CaloLayer1Packer") <<
"Major error in makeECalTPGs" << std::endl;
63 for(
int cEta = -28; cEta <= 28; cEta++) {
65 bool negativeEta =
false;
66 if(cEta < 0) negativeEta =
true;
67 uint32_t iEta =
abs(cEta);
69 int zSide = cEta / ((
int) iEta);
72 const auto& tp = ecalTPGs->
find(
id);
73 if ( tp != ecalTPGs->
end() ) {
74 ctp7Data.
setET(cType, negativeEta, iEta, iPhi, tp->compressedEt());
75 ctp7Data.
setFB(cType, negativeEta, iEta, iPhi, tp->fineGrain());
85 for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
86 int cPhi = - 1 + lPhi * 4 + iPhi;
87 if(cPhi == 0) cPhi = 72;
88 else if(cPhi == -1) cPhi = 71;
90 edm::LogError(
"CaloLayer1Packer") <<
"Major error in makeHCalTPGs" << std::endl;
93 for(
int cEta = -28; cEta <= 28; cEta++) {
95 bool negativeEta =
false;
96 if(cEta < 0) negativeEta =
true;
97 uint32_t iEta =
abs(cEta);
100 const auto tp = hcalTPGs->
find(
id);
101 if ( tp != hcalTPGs->
end() ) {
102 ctp7Data.
setET(cType, negativeEta, iEta, iPhi, tp->SOI_compressedEt());
103 ctp7Data.
setFB(cType, negativeEta, iEta, iPhi, tp->SOI_fineGrain());
113 for(uint32_t side = 0; side <= 1; side++) {
114 bool negativeEta =
false;
115 if(side == 0) negativeEta =
true;
116 for(uint32_t iEta = 30; iEta <= 40; iEta++) {
117 for(uint32_t iPhi = 0; iPhi < 2; iPhi++) {
118 if(iPhi == 1 && iEta == 40) iEta = 41;
119 int cPhi = 1 + lPhi * 4 + iPhi * 2;
120 if(iEta == 41) cPhi -= 2;
121 cPhi = (cPhi+69)%72 + 1;
123 if(negativeEta) cEta = -iEta;
127 const auto tp = hcalTPGs->
find(
id);
128 if ( tp != hcalTPGs->
end() ) {
129 ctp7Data.
setET(cType, negativeEta, iEta, iPhi, tp->SOI_compressedEt());
130 ctp7Data.
setFB(cType, negativeEta, iEta, iPhi, ((tp->SOI_fineGrain(1)<<1) | tp->SOI_fineGrain(0)));
139 for(uint32_t side = 0; side <= 1; side++) {
140 bool negativeEta =
false;
141 if(side == 0) negativeEta =
true;
142 for(uint32_t region = 0; region <= 6; region++) {
143 uint32_t lEta = 10 - region;
144 if(!negativeEta) lEta = region + 11;
149 for (
const auto& rtp : *regions) {
150 if ( rtp.id() ==
id ) {
void setET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t et)
void makeHCalTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, const HcalTrigPrimDigiCollection *hcalTPGs)
void setRegionSummary(bool negativeEta, uint32_t region, uint32_t regionData)
void makeECalTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, const EcalTrigPrimDigiCollection *ecalTPGs)
std::vector< Block > Blocks
Abs< T >::type abs(const T &t)
void setFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi, uint32_t fb)
Blocks pack(const edm::Event &, const PackerTokens *) override
const_iterator end() const
#define DEFINE_L1T_PACKER(type)
T const * product() const
void makeHFTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, const HcalTrigPrimDigiCollection *hcalTPGs)
void makeRegions(uint32_t lPhi, UCTCTP7RawData &ctp7Data, const L1CaloRegionCollection *regions)
iterator find(key_type k)
std::vector< L1CaloRegion > L1CaloRegionCollection