2 #include "DSMAlgo_EM201_2015.hh"
4 void DSMAlgo_EM201_2015::operator()(
DSM& dsm)
58 getHybridJetPatchSums(dsm,jpSum1,jpSum2);
64 for (
int ch = 0; ch < 6; ++ch)
65 htBitsBarrel |= dsm.channels[ch] >> 12 & 0x7;
71 for (
int ch = 6; ch < 8; ++ch)
72 htBitsEndcap |= dsm.channels[ch] >> 14 & 0x3;
78 for (
int ch = 0; ch < 6; ++ch) {
79 int jpx = dsm.channels[ch] & 0x3;
80 int jpy = dsm.channels[ch] >> 2 & 0x3;
81 int jpz = dsm.channels[ch] >> 4 & 0x3;
83 if (jpx > jpBitsBarrel) jpBitsBarrel = jpx;
84 if (jpy > jpBitsBarrel) jpBitsBarrel = jpy;
85 if (jpz > jpBitsBarrel) jpBitsBarrel = jpz;
88 int bjp1 = jpBitsBarrel > 1;
89 int bjp2 = jpBitsBarrel > 2;
93 for (
int ch = 6; ch < 8; ++ch) {
94 int jpa = dsm.channels[ch] & 0x3;
95 int jpb = dsm.channels[ch] >> 2 & 0x3;
96 int jpc = dsm.channels[ch] >> 4 & 0x3;
98 if (jpa > jpBitsEndcap) jpBitsEndcap = jpa;
99 if (jpb > jpBitsEndcap) jpBitsEndcap = jpb;
100 if (jpc > jpBitsEndcap) jpBitsEndcap = jpc;
103 int ejp1 = jpBitsEndcap > 1;
104 int ejp2 = jpBitsEndcap > 2;
111 for (
int reg = 0; reg < 3; ++reg)
112 if (jpSum1 > dsm.registers[reg] || jpSum2 > dsm.registers[reg]) ++jpBits;
114 if (jpBitsBarrel > jpBits) jpBits = jpBitsBarrel;
115 if (jpBitsEndcap > jpBits) jpBits = jpBitsEndcap;
117 int jp0 = jpBits > 0;
118 int jp1 = jpBits > 1;
119 int jp2 = jpBits > 2;
123 int ajpx = ajpBarrel(dsm, 0);
124 int ajpy = ajpBarrel(dsm, 2);
125 int ajpz = ajpBarrel(dsm, 4);
126 int bajp = ajpx || ajpy || ajpz;
127 int eajp = ajpEndcap(dsm);
128 int ajp = bajp || eajp;
157 getHTTP(dsm, http_b2b, http_nonadj);
179 int eb2b = getEB2B(dsm);
186 out |= htBitsEndcap << 4;
202 dsm.info[0] = jpSum1;
203 dsm.info[1] = jpSum2;
205 int DSMAlgo_EM201_2015::ajpBarrel(
const DSM& dsm,
int offset)
211 for (
int ch = 0; ch < 6; ++ch)
212 jpBits[ch] = dsm.channels[ch] >> offset & 0x3;
214 const int R3 = dsm.registers[3];
216 return ((jpBits[0] > R3 && jpBits[1] > R3) ||
217 (jpBits[1] > R3 && jpBits[2] > R3) ||
218 (jpBits[2] > R3 && jpBits[3] > R3) ||
219 (jpBits[3] > R3 && jpBits[4] > R3) ||
220 (jpBits[4] > R3 && jpBits[5] > R3) ||
221 (jpBits[5] > R3 && jpBits[0] > R3));
223 int DSMAlgo_EM201_2015::ajpEndcap(
const DSM& dsm)
229 jpBits[0] = dsm.channels[6] & 0x3;
230 jpBits[1] = dsm.channels[6] >> 2 & 0x3;
231 jpBits[2] = dsm.channels[6] >> 4 & 0x3;
235 jpBits[3] = dsm.channels[7] & 0x3;
236 jpBits[4] = dsm.channels[7] >> 2 & 0x3;
237 jpBits[5] = dsm.channels[7] >> 4 & 0x3;
239 const int R3 = dsm.registers[3];
241 return ((jpBits[0] > R3 && jpBits[1] > R3) ||
242 (jpBits[1] > R3 && jpBits[2] > R3) ||
243 (jpBits[2] > R3 && jpBits[3] > R3) ||
244 (jpBits[3] > R3 && jpBits[4] > R3) ||
245 (jpBits[4] > R3 && jpBits[5] > R3) ||
246 (jpBits[5] > R3 && jpBits[0] > R3));
248 void DSMAlgo_EM201_2015::getHybridJetPatchSums(
const DSM& dsm,
int& jpSum1,
int& jpSum2)
250 jpSum1 = dsm.channels[6] >> 6 & 0x3f;
251 jpSum2 = dsm.channels[7] >> 6 & 0x3f;
253 int jpId1 = dsm.channels[6] >> 12 & 0x3;
254 int jpId2 = dsm.channels[7] >> 12 & 0x3;
257 case 1: jpSum1 += dsm.channels[3] >> 6 & 0x3f;
break;
258 case 2: jpSum1 += dsm.channels[4] >> 6 & 0x3f;
break;
259 case 3: jpSum1 += dsm.channels[5] >> 6 & 0x3f;
break;
263 case 1: jpSum2 += dsm.channels[0] >> 6 & 0x3f;
break;
264 case 2: jpSum2 += dsm.channels[1] >> 6 & 0x3f;
break;
265 case 3: jpSum2 += dsm.channels[2] >> 6 & 0x3f;
break;
269 void DSMAlgo_EM201_2015::getHTTP(
const DSM &dsm,
int &b2b,
int &nonadj)
272 for(
int ichn = 0, jchn = 3; ichn < 6 && ichn < jchn; ichn++, jchn = (ichn+3)%6){
273 int ihttp = (dsm.channels[ichn] >> 15) & 0x1;
275 int jhttp = (dsm.channels[jchn] >> 15) & 0x1;
277 b2b |= ihttp && jhttp;
283 for(
int ichn = 0; ichn < 6; ichn++){
284 int ihttp = (dsm.channels[ichn] >> 15) & 0x1;
285 for(
int jchn = ichn + 2; jchn < ichn + 5 && jchn < 6; jchn++){
286 int jhttp = (dsm.channels[jchn] >> 15) & 0x1;
287 nonadj |= (ihttp && jhttp);
293 int DSMAlgo_EM201_2015::getEB2B(
const DSM& dsm)
299 jpBits[0] = dsm.channels[6] & 0x3;
300 jpBits[1] = dsm.channels[6] >> 2 & 0x3;
301 jpBits[2] = dsm.channels[6] >> 4 & 0x3;
305 jpBits[3] = dsm.channels[7] & 0x3;
306 jpBits[4] = dsm.channels[7] >> 2 & 0x3;
307 jpBits[5] = dsm.channels[7] >> 4 & 0x3;
312 for(
int ichn = 0, jchn = 3; ichn < 6 && ichn < jchn; ichn++){
313 int iJP = jpBits[ichn];
315 int jJP = jpBits[jchn];
317 b2b |= (iJP > JP) && (jJP > JP);