2 #include "DSMAlgo_EM201_2013.hh"
4 int DSMAlgo_EM201_2013::ajpBarrel(
DSM& dsm,
int offset)
const
10 for (
int ch = 0; ch < 6; ++ch)
12 jpBits[ch] = dsm.channels[ch] >> offset & 0x3;
15 const int R3 = dsm.registers[3];
18 return (((jpBits[0] > R3) && (jpBits[1] > R3)) ||
19 ((jpBits[1] > R3) && (jpBits[2] > R3)) ||
20 ((jpBits[2] > R3) && (jpBits[3] > R3)) ||
21 ((jpBits[3] > R3) && (jpBits[4] > R3)) ||
22 ((jpBits[4] > R3) && (jpBits[5] > R3)) ||
23 ((jpBits[5] > R3) && (jpBits[0] > R3)));
51 void DSMAlgo_EM201_2013::operator()(
DSM& dsm)
101 int jpSum1 = dsm.channels[6] >> 6 & 0x3f;
102 int jpSum2 = dsm.channels[7] >> 6 & 0x3f;
104 int jpId1 = dsm.channels[6] >> 12 & 0x3;
105 int jpId2 = dsm.channels[7] >> 12 & 0x3;
108 case 1: jpSum1 += dsm.channels[3] >> 6 & 0x3f;
break;
109 case 2: jpSum1 += dsm.channels[4] >> 6 & 0x3f;
break;
110 case 3: jpSum1 += dsm.channels[5] >> 6 & 0x3f;
break;
114 case 1: jpSum2 += dsm.channels[0] >> 6 & 0x3f;
break;
115 case 2: jpSum2 += dsm.channels[1] >> 6 & 0x3f;
break;
116 case 3: jpSum2 += dsm.channels[2] >> 6 & 0x3f;
break;
121 int htBitsBarrel = 0;
123 for (
int ch = 0; ch < 6; ++ch){
124 int packedHT = dsm.channels[ch] >> 12 & 0x3;
125 int unpackedHT = dsm.channels[ch] >> 14 & 0x1;
126 htBitsBarrel |= ((1 << packedHT) - 1) | (unpackedHT << 3);
131 int htBitsEndcap = 0;
133 for (
int ch = 6; ch < 8; ++ch)
134 htBitsEndcap |= dsm.channels[ch] >> 14 & 0x3;
138 int jpBitsBarrel = 0;
140 for (
int ch = 0; ch < 6; ++ch) {
141 int jpx = dsm.channels[ch] & 0x3;
142 int jpy = dsm.channels[ch] >> 2 & 0x3;
143 int jpz = dsm.channels[ch] >> 4 & 0x3;
145 if (jpx > jpBitsBarrel) jpBitsBarrel = jpx;
146 if (jpy > jpBitsBarrel) jpBitsBarrel = jpy;
147 if (jpz > jpBitsBarrel) jpBitsBarrel = jpz;
150 int bjp1 = jpBitsBarrel > 1;
153 int jpBitsEndcap = 0;
155 for (
int ch = 6; ch < 8; ++ch) {
156 int jpabc = dsm.channels[ch] & 0x3;
160 if (jpabc > jpBitsEndcap) jpBitsEndcap = jpabc;
166 int ejp1 = jpBitsEndcap > 1;
174 for (
int reg = 0; reg < 3; ++reg)
175 if (jpSum1 > dsm.registers[reg] || jpSum2 > dsm.registers[reg]) ++jpBits;
177 if (jpBitsBarrel > jpBits) jpBits = jpBitsBarrel;
178 if (jpBitsEndcap > jpBits) jpBits = jpBitsEndcap;
180 int jp0 = jpBits > 0;
181 int jp1 = jpBits > 1;
182 int jp2 = jpBits > 2;
187 int ajpx = ajpBarrel(dsm, 0);
188 int ajpy = ajpBarrel(dsm, 2);
189 int ajpz = ajpBarrel(dsm, 4);
190 int bajp = ajpx || ajpy || ajpz;
192 int dijet0 = Dijet(dsm, 0);
196 int dijet1 = Dijet(dsm, 1);
200 int edijet = EndDijet(dsm, 0);
226 out |= htBitsEndcap << 4;
242 dsm.info[0] = jpSum1;
243 dsm.info[1] = jpSum2;
247 int DSMAlgo_EM201_2013::Dijet(
DSM &dsm,
int jpTH = 0)
const
251 int eemcDijetBits[6];
253 eemcDijetBits[0] = dsm.channels[7] >> 2 & 1;
254 eemcDijetBits[1] = dsm.channels[7] >> 3 & 1;
255 eemcDijetBits[2] = dsm.channels[7] >> 4 & 1;
256 eemcDijetBits[3] = dsm.channels[6] >> 2 & 1;
257 eemcDijetBits[4] = dsm.channels[6] >> 3 & 1;
258 eemcDijetBits[5] = dsm.channels[6] >> 4 & 1;
263 for (
int ch = 0; ch < 6; ++ch) {
264 int jpx = dsm.channels[ch] >> 0 & 0x3;
265 int jpy = dsm.channels[ch] >> 2 & 0x3;
266 int jpz = dsm.channels[ch] >> 4 & 0x3;
268 int bemcDijet2 = dsm.channels[(ch+2)%6] >> 15 & 1;
269 int bemcDijet3 = dsm.channels[(ch+3)%6] >> 15 & 1;
270 int bemcDijet4 = dsm.channels[(ch+4)%6] >> 15 & 1;
272 int eemcDijet2 = eemcDijetBits[(ch+2)%6];
273 int eemcDijet3 = eemcDijetBits[(ch+3)%6];
274 int eemcDijet4 = eemcDijetBits[(ch+4)%6];
276 int bjp = jpx > jpTH || jpy > jpTH || jpz > jpTH;
279 int bemcDijet = bemcDijet2 || bemcDijet3 || bemcDijet4;
280 int eemcDijet = eemcDijet2 || eemcDijet3 || eemcDijet4;
282 dijet |= bjp && (bemcDijet || eemcDijet);
287 int DSMAlgo_EM201_2013::EndDijet(
DSM &dsm,
int jpTH = 0)
const
290 int eemcDijetBits[6];
292 eemcDijetBits[0] = dsm.channels[7] >> 2 & 1;
293 eemcDijetBits[1] = dsm.channels[7] >> 3 & 1;
294 eemcDijetBits[2] = dsm.channels[7] >> 4 & 1;
295 eemcDijetBits[3] = dsm.channels[6] >> 2 & 1;
296 eemcDijetBits[4] = dsm.channels[6] >> 3 & 1;
297 eemcDijetBits[5] = dsm.channels[6] >> 4 & 1;
299 int ee101_jp0 = dsm.channels[6] & 3;
300 int ee102_jp0 = dsm.channels[7] & 3;
302 int ee101_dijet = ee101_jp0 && (eemcDijetBits[0] || eemcDijetBits[1] || eemcDijetBits[2]);
303 int ee102_dijet = ee102_jp0 && (eemcDijetBits[3] || eemcDijetBits[4] || eemcDijetBits[5]);
305 int eemc_dijet = ee101_dijet || ee102_dijet;