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++) {
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;
328 candidates.push_back(fullIsoElectron);
329 unsigned short fullNonIsoElectron = nonIsoElectron * 16 + cardNo * 2;
330 candidates.push_back(fullNonIsoElectron);
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;
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)