10 : crtNo(crateNumber), cardNo(cardNumber), rctLookupTables_(rctLookupTables),
11 isoElectrons(2), nonIsoElectrons(2),
regions(2) {
19 std::vector<unsigned short> region0Electrons =
21 std::vector<unsigned short> region1Electrons =
35 std::vector<unsigned short>
39 unsigned short nonIsoElectron = 0;
40 unsigned short isoElectron = 0;
43 for (
int i = 0;
i < 4;
i++) {
44 for (
int j = 0; j < 4; j++) {
58 unsigned short northHE_FG = region.
getHE_FGBit(
i - 1, j);
59 unsigned short southHE_FG = region.
getHE_FGBit(
i + 1, j);
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 ||
75 (nCard == 6 && nRegion == 0)) {
79 else if (nCard == 1 || nCard == 3 || nCard == 5 ||
80 (nCard == 6 && nRegion == 1)) {
91 unsigned short primaryTowerEt = primaryEt;
92 unsigned short northTowerEt = northEt;
93 unsigned short southTowerEt = southEt;
94 unsigned short eastTowerEt = eastEt;
95 unsigned short westTowerEt = westEt;
106 if (top && nCrate >= 9)
108 if (westTowerEt == eastTowerEt)
110 if (southTowerEt == northTowerEt)
112 if (southTowerEt == eastTowerEt)
114 if (westTowerEt == northTowerEt)
119 if (eastTowerEt == westTowerEt)
121 if (northTowerEt == southTowerEt)
123 if (northTowerEt == westTowerEt)
125 if (eastTowerEt == southTowerEt)
132 if (nRegion == 0 && nCrate >= 9) {
133 if (westTowerEt == eastTowerEt)
135 if (southTowerEt == northTowerEt)
137 if (southTowerEt == eastTowerEt)
139 if (westTowerEt == northTowerEt)
149 bool candidate =
false;
152 if (primaryEt > northEt && primaryEt > southEt && primaryEt > eastEt &&
153 primaryEt > westEt && !primaryHE_FG) {
159 else if (primaryEt < northEt || primaryEt < southEt ||
160 primaryEt < eastEt || primaryEt < westEt || primaryHE_FG) {
174 if (westTowerEt == primaryTowerEt)
176 else if (northTowerEt == primaryTowerEt)
178 else if (southTowerEt == primaryTowerEt)
180 else if (eastTowerEt == primaryTowerEt)
187 if (eastTowerEt == primaryTowerEt)
189 else if (southTowerEt == primaryTowerEt)
191 else if (northTowerEt == primaryTowerEt)
193 else if (westTowerEt == primaryTowerEt)
198 if (westTowerEt == primaryTowerEt)
200 else if (southTowerEt == primaryTowerEt)
202 else if (northTowerEt == primaryTowerEt)
204 else if (eastTowerEt == primaryTowerEt)
213 if (westTowerEt == primaryTowerEt)
215 else if (northTowerEt == primaryTowerEt)
217 else if (southTowerEt == primaryTowerEt)
219 else if (eastTowerEt == primaryTowerEt)
224 if (westTowerEt == primaryTowerEt)
226 else if (northTowerEt == primaryTowerEt)
228 else if (southTowerEt == primaryTowerEt)
230 else if (eastTowerEt == primaryTowerEt)
236 if (eastTowerEt == primaryTowerEt)
238 else if (southTowerEt == primaryTowerEt)
240 else if (northTowerEt == primaryTowerEt)
242 else if (westTowerEt == primaryTowerEt)
248 if (eastTowerEt == primaryTowerEt)
250 else if (southTowerEt == primaryTowerEt)
252 else if (northTowerEt == primaryTowerEt)
254 else if (westTowerEt == primaryTowerEt)
269 unsigned short candidateEt =
270 calcMaxSum(primaryEt, northEt, southEt, eastEt, westEt);
273 bool neighborVeto = (nwHE_FG || northHE_FG || neHE_FG || westHE_FG ||
274 eastHE_FG || swHE_FG || southHE_FG || seHE_FG);
280 unsigned quietThreshold =
293 if (nwEt >= quietThreshold)
295 if (neEt >= quietThreshold)
297 if (swEt >= quietThreshold)
299 if (seEt >= quietThreshold)
301 if (northEt >= quietThreshold)
303 if (southEt >= quietThreshold)
305 if (westEt >= quietThreshold)
307 if (eastEt >= quietThreshold)
312 bool nwC = (sw || w || nw || n ||
ne);
313 bool neC = (nw || n || ne || e || se);
314 bool seC = (ne || e || se || s || sw);
315 bool swC = (se || s || sw || w || nw);
319 bool quietVeto = (nwC && neC && seC && swC);
323 if (!(quietVeto || neighborVeto)) {
324 if (candidateEt > isoElectron)
325 isoElectron = candidateEt;
328 else if (candidateEt > nonIsoElectron)
329 nonIsoElectron = candidateEt;
335 unsigned short fullIsoElectron =
339 candidates.push_back(fullIsoElectron);
340 unsigned short fullNonIsoElectron =
341 nonIsoElectron * 16 +
343 candidates.push_back(fullNonIsoElectron);
349 unsigned short northEt,
350 unsigned short southEt,
351 unsigned short eastEt,
352 unsigned short westEt) {
353 unsigned short cardinals[4] = {northEt, southEt, eastEt, westEt};
354 unsigned short max = 0;
355 for (
int i = 0;
i < 4;
i++) {
356 unsigned short test = primaryEt + cardinals[
i];
365 std::cout <<
"Region 0 Information" << std::endl;
372 std::cout <<
"Region 1 Information" << std::endl;
unsigned short getEtIn7Bits(int i, int j) const
unsigned eicIsolationThreshold() const
L1RCTElectronIsolationCard()=delete
std::vector< L1RCTRegion > regions
unsigned short getHE_FGBit(int i, int j) const
const L1RCTLookupTables * rctLookupTables_
std::vector< unsigned short > nonIsoElectrons
~L1RCTElectronIsolationCard()
std::vector< unsigned short > isoElectrons
std::vector< unsigned short > calcElectronCandidates(const L1RCTRegion ®ion, int regionNum)
void fillElectronCandidates()
const L1RCTParameters * rctParameters() const
unsigned short calcMaxSum(unsigned short primaryEt, unsigned short northEt, unsigned short southEt, unsigned short eastEt, unsigned short westEt)