2 #include "DSMAlgo_EM201_2013_a.hh"
4 int DSMAlgo_EM201_2013_a::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_a::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;
151 int bjp2 = jpBitsBarrel > 2;
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;
179 if (jpBitsBarrel > jpBits) jpBits = jpBitsBarrel;
180 if (jpBitsEndcap > jpBits) jpBits = jpBitsEndcap;
182 int jp0 = jpBits > 0;
183 int jp1 = jpBits > 1;
184 int jp2 = jpBits > 2;
189 int ajpx = ajpBarrel(dsm, 0);
190 int ajpy = ajpBarrel(dsm, 2);
191 int ajpz = ajpBarrel(dsm, 4);
192 int bajp = ajpx || ajpy || ajpz;
194 int dijet0 = Dijet(dsm, 0);
198 int dijet1 = Dijet(dsm, 1);
228 out |= htBitsEndcap << 4;
244 dsm.info[0] = jpSum1;
245 dsm.info[1] = jpSum2;
249 int DSMAlgo_EM201_2013_a::Dijet(
DSM &dsm,
int jpTH = 0)
const
253 int eemcDijetBits[6];
255 eemcDijetBits[0] = dsm.channels[7] >> 2 & 1;
256 eemcDijetBits[1] = dsm.channels[7] >> 3 & 1;
257 eemcDijetBits[2] = dsm.channels[7] >> 4 & 1;
258 eemcDijetBits[3] = dsm.channels[6] >> 2 & 1;
259 eemcDijetBits[4] = dsm.channels[6] >> 3 & 1;
260 eemcDijetBits[5] = dsm.channels[6] >> 4 & 1;
265 for (
int ch = 0; ch < 6; ++ch) {
266 int jpx = dsm.channels[ch] >> 0 & 0x3;
267 int jpy = dsm.channels[ch] >> 2 & 0x3;
268 int jpz = dsm.channels[ch] >> 4 & 0x3;
270 int bemcDijet2 = dsm.channels[(ch+2)%6] >> 15 & 1;
271 int bemcDijet3 = dsm.channels[(ch+3)%6] >> 15 & 1;
272 int bemcDijet4 = dsm.channels[(ch+4)%6] >> 15 & 1;
274 int eemcDijet2 = eemcDijetBits[(ch+2)%6];
275 int eemcDijet3 = eemcDijetBits[(ch+3)%6];
276 int eemcDijet4 = eemcDijetBits[(ch+4)%6];
278 int bjp = jpx > jpTH || jpy > jpTH || jpz > jpTH;
281 int bemcDijet = bemcDijet2 || bemcDijet3 || bemcDijet4;
282 int eemcDijet = eemcDijet2 || eemcDijet3 || eemcDijet4;
284 dijet |= bjp && (bemcDijet || eemcDijet);