2 #include "DSMAlgo_EE101_2009.hh"
4 void DSMAlgo_EE101_2009::operator()(
DSM& dsm)
39 int lowEtaSumA = dsm.channels[0] & 0x3f;
40 int lowEtaSumB = dsm.channels[3] & 0x3f;
41 int lowEtaSumC = dsm.channels[4] & 0x3f;
43 int highEtaSumA = (dsm.channels[0] >> 6 & 0x3f) + (dsm.channels[1] & 0x3f);
44 int highEtaSumB = (dsm.channels[3] >> 6 & 0x3f) + (dsm.channels[2] & 0x3f);
45 int highEtaSumC = (dsm.channels[4] >> 6 & 0x3f) + (dsm.channels[5] & 0x3f);
47 int jpa = lowEtaSumA + highEtaSumA;
48 int jpb = lowEtaSumB + highEtaSumB;
49 int jpc = lowEtaSumC + highEtaSumC;
55 if ((jpa > dsm.registers[0]) && !(jpa > dsm.registers[1]) && !(jpa > dsm.registers[2])) jpaBits = 1;
56 if ((jpa > dsm.registers[0]) && (jpa > dsm.registers[1]) && !(jpa > dsm.registers[2])) jpaBits = 2;
57 if ((jpa > dsm.registers[0]) && (jpa > dsm.registers[1]) && (jpa > dsm.registers[2])) jpaBits = 3;
61 if ((jpb > dsm.registers[0]) && !(jpb > dsm.registers[1]) && !(jpb > dsm.registers[2])) jpbBits = 1;
62 if ((jpb > dsm.registers[0]) && (jpb > dsm.registers[1]) && !(jpb > dsm.registers[2])) jpbBits = 2;
63 if ((jpb > dsm.registers[0]) && (jpb > dsm.registers[1]) && (jpb > dsm.registers[2])) jpbBits = 3;
67 if ((jpc > dsm.registers[0]) && !(jpc > dsm.registers[1]) && !(jpc > dsm.registers[2])) jpcBits = 1;
68 if ((jpc > dsm.registers[0]) && (jpc > dsm.registers[1]) && !(jpc > dsm.registers[2])) jpcBits = 2;
69 if ((jpc > dsm.registers[0]) && (jpc > dsm.registers[1]) && (jpc > dsm.registers[2])) jpcBits = 3;
74 int highTowerBits = 0;
76 for (
int ch = 0; ch < 6; ++ch)
77 highTowerBits |= dsm.channels[ch] >> 12 & 0xf;
81 int maxA = (lowEtaSumA > lowEtaSumB) && !(lowEtaSumC > lowEtaSumA);
82 int maxB = (lowEtaSumB > lowEtaSumC) && !(lowEtaSumA > lowEtaSumB);
83 int maxC = (lowEtaSumC > lowEtaSumA) && !(lowEtaSumB > lowEtaSumC);
107 if (maxSum > 63) maxSum = 63;
118 dsm.output = jpaBits;
119 dsm.output |= jpbBits << 2;
120 dsm.output |= jpcBits << 4;
121 dsm.output |= maxSum << 6;
122 dsm.output |= maxId << 12;
123 dsm.output |= highTowerBits << 14;
136 dsm.info[3] = lowEtaSumA;
137 dsm.info[4] = lowEtaSumB;
138 dsm.info[5] = lowEtaSumC;