13 rctLookupTables_(rctLookupTables),
40 unsigned short nonIsoElectron = 0;
41 unsigned short isoElectron = 0;
44 for (
int i = 0;
i < 4;
i++) {
45 for (
int j = 0;
j < 4;
j++) {
46 unsigned short primaryEt =
region.getEtIn7Bits(
i,
j);
47 unsigned short primaryHE_FG =
region.getHE_FGBit(
i,
j);
49 unsigned short northEt =
region.getEtIn7Bits(
i - 1,
j);
50 unsigned short southEt =
region.getEtIn7Bits(
i + 1,
j);
51 unsigned short westEt =
region.getEtIn7Bits(
i,
j - 1);
52 unsigned short eastEt =
region.getEtIn7Bits(
i,
j + 1);
53 unsigned short neEt =
region.getEtIn7Bits(
i - 1,
j + 1);
54 unsigned short nwEt =
region.getEtIn7Bits(
i - 1,
j - 1);
55 unsigned short seEt =
region.getEtIn7Bits(
i + 1,
j + 1);
56 unsigned short swEt =
region.getEtIn7Bits(
i + 1,
j - 1);
58 unsigned short northHE_FG =
region.getHE_FGBit(
i - 1,
j);
59 unsigned short southHE_FG =
region.getHE_FGBit(
i + 1,
j);
60 unsigned short westHE_FG =
region.getHE_FGBit(
i,
j - 1);
61 unsigned short eastHE_FG =
region.getHE_FGBit(
i,
j + 1);
62 unsigned short neHE_FG =
region.getHE_FGBit(
i - 1,
j + 1);
63 unsigned short nwHE_FG =
region.getHE_FGBit(
i - 1,
j - 1);
64 unsigned short seHE_FG =
region.getHE_FGBit(
i + 1,
j + 1);
65 unsigned short swHE_FG =
region.getHE_FGBit(
i + 1,
j - 1);
71 int nRegion = regionNum;
74 if (nCard == 0 || nCard == 2 || nCard == 4 || (nCard == 6 && nRegion == 0)) {
78 else if (nCard == 1 || nCard == 3 || nCard == 5 || (nCard == 6 && nRegion == 1)) {
81 std::cerr <<
"Error! EIC top assignment" << std::endl;
88 unsigned short primaryTowerEt = primaryEt;
89 unsigned short northTowerEt = northEt;
90 unsigned short southTowerEt = southEt;
91 unsigned short eastTowerEt = eastEt;
92 unsigned short westTowerEt = westEt;
103 if (top && nCrate >= 9)
105 if (westTowerEt == eastTowerEt)
107 if (southTowerEt == northTowerEt)
109 if (southTowerEt == eastTowerEt)
111 if (westTowerEt == northTowerEt)
113 }
else if ((!top) && nCrate < 9)
115 if (eastTowerEt == westTowerEt)
117 if (northTowerEt == southTowerEt)
119 if (northTowerEt == westTowerEt)
121 if (eastTowerEt == southTowerEt)
128 if (nRegion == 0 && nCrate >= 9) {
129 if (westTowerEt == eastTowerEt)
131 if (southTowerEt == northTowerEt)
133 if (southTowerEt == eastTowerEt)
135 if (westTowerEt == northTowerEt)
145 bool candidate =
false;
148 if (primaryEt > northEt && primaryEt > southEt && primaryEt > eastEt && primaryEt > westEt && !primaryHE_FG) {
154 else if (primaryEt < northEt || primaryEt < southEt || primaryEt < eastEt || primaryEt < westEt || primaryHE_FG) {
168 if (westTowerEt == primaryTowerEt)
170 else if (northTowerEt == primaryTowerEt)
172 else if (southTowerEt == primaryTowerEt)
174 else if (eastTowerEt == primaryTowerEt)
181 if (eastTowerEt == primaryTowerEt)
183 else if (southTowerEt == primaryTowerEt)
185 else if (northTowerEt == primaryTowerEt)
187 else if (westTowerEt == primaryTowerEt)
192 if (westTowerEt == primaryTowerEt)
194 else if (southTowerEt == primaryTowerEt)
196 else if (northTowerEt == primaryTowerEt)
198 else if (eastTowerEt == primaryTowerEt)
207 if (westTowerEt == primaryTowerEt)
209 else if (northTowerEt == primaryTowerEt)
211 else if (southTowerEt == primaryTowerEt)
213 else if (eastTowerEt == primaryTowerEt)
218 if (westTowerEt == primaryTowerEt)
220 else if (northTowerEt == primaryTowerEt)
222 else if (southTowerEt == primaryTowerEt)
224 else if (eastTowerEt == primaryTowerEt)
230 if (eastTowerEt == primaryTowerEt)
232 else if (southTowerEt == primaryTowerEt)
234 else if (northTowerEt == primaryTowerEt)
236 else if (westTowerEt == primaryTowerEt)
242 if (eastTowerEt == primaryTowerEt)
244 else if (southTowerEt == primaryTowerEt)
246 else if (northTowerEt == primaryTowerEt)
248 else if (westTowerEt == primaryTowerEt)
262 unsigned short candidateEt =
calcMaxSum(primaryEt, northEt, southEt, eastEt, westEt);
266 (nwHE_FG || northHE_FG || neHE_FG || westHE_FG || eastHE_FG || swHE_FG || southHE_FG || seHE_FG);
284 if (nwEt >= quietThreshold)
286 if (neEt >= quietThreshold)
288 if (swEt >= quietThreshold)
290 if (seEt >= quietThreshold)
292 if (northEt >= quietThreshold)
294 if (southEt >= quietThreshold)
296 if (westEt >= quietThreshold)
298 if (eastEt >= quietThreshold)
303 bool nwC = (sw ||
w || nw ||
n || ne);
304 bool neC = (nw ||
n || ne ||
e || se);
305 bool seC = (ne ||
e || se ||
s || sw);
306 bool swC = (se ||
s || sw ||
w || nw);
310 bool quietVeto = (nwC && neC && seC && swC);
314 if (!(quietVeto || neighborVeto)) {
315 if (candidateEt > isoElectron)
316 isoElectron = candidateEt;
319 else if (candidateEt > nonIsoElectron)
320 nonIsoElectron = candidateEt;
326 unsigned short fullIsoElectron =
327 isoElectron * 16 +
cardNo * 2;
329 unsigned short fullNonIsoElectron = nonIsoElectron * 16 +
cardNo * 2;
336 unsigned short northEt,
337 unsigned short southEt,
338 unsigned short eastEt,
339 unsigned short westEt) {
340 unsigned short cardinals[4] = {northEt, southEt, eastEt, westEt};
341 unsigned short max = 0;
342 for (
int i = 0;
i < 4;
i++) {
343 unsigned short test = primaryEt + cardinals[
i];
352 std::cout <<
"Region 0 Information" << std::endl;
358 std::cout <<
"Region 1 Information" << std::endl;