3 #include "DSMAlgo_EM201_2017.hh"
5 void DSMAlgo_EM201_2017::operator()(
DSM& dsm)
59 getHybridJetPatchSums(dsm,jpSum1,jpSum2);
65 for (
int ch = 0; ch < 6; ++ch)
66 htBitsBarrel |= (dsm.channels[ch] >> 12) & 0x7;
72 for (
int ch = 6; ch < 8; ++ch)
73 htBitsEndcap |= dsm.channels[ch] >> 14 & 0x3;
76 int httpBits[6] = {0, 0, 0, 0, 0, 0};
77 getHybridHTTP(dsm, httpBits);
81 getHTTP(httpBits, http_b2b, http_nonadj);
93 for (
int ch = 0; ch < 6; ++ch) {
94 int jpx = dsm.channels[ch] & 0x3;
95 int jpy = dsm.channels[ch] >> 2 & 0x3;
96 int jpz = dsm.channels[ch] >> 4 & 0x3;
98 if (jpx > jpBitsBarrel) jpBitsBarrel = jpx;
99 if (jpy > jpBitsBarrel) jpBitsBarrel = jpy;
100 if (jpz > jpBitsBarrel) jpBitsBarrel = jpz;
103 int bjp1 = jpBitsBarrel > 1;
104 int bjp2 = jpBitsBarrel > 2;
106 int jpBitsEndcap = 0;
108 for (
int ch = 6; ch < 8; ++ch) {
109 int jp = dsm.channels[ch] & 0x3;
110 if (jp > jpBitsEndcap) jpBitsEndcap = jp;
113 int ejp1 = jpBitsEndcap > 1;
114 int ejp2 = jpBitsEndcap > 2;
121 for (
int reg = 0; reg < 3; ++reg)
122 if (jpSum1 > dsm.registers[reg] || jpSum2 > dsm.registers[reg]) ++jpBits;
124 if (jpBitsBarrel > jpBits) jpBits = jpBitsBarrel;
125 if (jpBitsEndcap > jpBits) jpBits = jpBitsEndcap;
127 int jp0 = jpBits > 0;
128 int jp1 = jpBits > 1;
129 int jp2 = jpBits > 2;
149 out |= htBitsEndcap << 4;
160 dsm.info[0] = jpSum1;
161 dsm.info[1] = jpSum2;
163 void DSMAlgo_EM201_2017::getHybridJetPatchSums(
const DSM& dsm,
int& jpSum1,
int& jpSum2)
165 jpSum1 = dsm.channels[6] >> 6 & 0x3f;
166 jpSum2 = dsm.channels[7] >> 6 & 0x3f;
168 int jpId1 = dsm.channels[6] >> 12 & 0x3;
169 int jpId2 = dsm.channels[7] >> 12 & 0x3;
172 case 1: jpSum1 += dsm.channels[3] >> 6 & 0x3f;
break;
173 case 2: jpSum1 += dsm.channels[4] >> 6 & 0x3f;
break;
174 case 3: jpSum1 += dsm.channels[5] >> 6 & 0x3f;
break;
178 case 1: jpSum2 += dsm.channels[0] >> 6 & 0x3f;
break;
179 case 2: jpSum2 += dsm.channels[1] >> 6 & 0x3f;
break;
180 case 3: jpSum2 += dsm.channels[2] >> 6 & 0x3f;
break;
183 void DSMAlgo_EM201_2017::getHTTP(
int httpBits[],
int &b2b,
int &nonadj)
186 for(
int ichn = 0, jchn = 3; ichn < 6 && ichn < jchn; ichn++, jchn = (ichn+3)%6){
187 int ihttp = httpBits[ichn];
189 int jhttp = httpBits[jchn];
191 b2b |= ihttp && jhttp;
197 for(
int ichn = 0; ichn < 6; ichn++){
198 int ihttp = httpBits[ichn];
199 for(
int jchn = ichn + 2; jchn < ichn + 5 && jchn < 6; jchn++){
200 int jhttp = httpBits[jchn];
201 nonadj |= (ihttp && jhttp);
206 void DSMAlgo_EM201_2017::getHybridHTTP(
const DSM& dsm,
int httpBits[])
209 for(
int i = 0; i < 3; i++){
212 httpBits[i] = btest(dsm.channels[j], 15) | btest(dsm.channels[6], k);
215 for(
int i = 3; i < 6; i++){
218 httpBits[i] = btest(dsm.channels[j], 15) | btest(dsm.channels[7], k);