11 crtNo(crateNumber),cardNo(cardNumber),
12 rctLookupTables_(rctLookupTables),
13 isoElectrons(2),nonIsoElectrons(2),
regions(2)
43 std::vector<unsigned short>
46 unsigned short nonIsoElectron = 0;
47 unsigned short isoElectron = 0;
50 for(
int i = 0;
i<4;
i++){
51 for(
int j = 0; j<4; j++){
78 int nRegion = regionNum;
81 if (nCard == 0 || nCard == 2 || nCard == 4 || (nCard == 6 && nRegion == 0))
86 else if (nCard == 1 || nCard == 3 || nCard == 5 || (nCard == 6 && nRegion == 1))
90 std::cerr <<
"Error! EIC top assignment" << std::endl;
97 unsigned short primaryTowerEt = primaryEt;
98 unsigned short northTowerEt = northEt;
99 unsigned short southTowerEt = southEt;
100 unsigned short eastTowerEt = eastEt;
101 unsigned short westTowerEt = westEt;
112 if(top && nCrate >= 9)
114 if(westTowerEt == eastTowerEt) westTowerEt=0;
115 if(southTowerEt == northTowerEt) southTowerEt=0;
116 if(southTowerEt == eastTowerEt) southTowerEt=0;
117 if(westTowerEt == northTowerEt) westTowerEt=0;
119 else if((!top) && nCrate < 9)
121 if(eastTowerEt == westTowerEt) eastTowerEt=0;
122 if(northTowerEt == southTowerEt) northTowerEt=0;
123 if(northTowerEt == westTowerEt) northTowerEt=0;
124 if(eastTowerEt == southTowerEt) eastTowerEt=0;
131 if(nRegion == 0 && nCrate >=9)
133 if(westTowerEt == eastTowerEt) westTowerEt=0;
134 if(southTowerEt == northTowerEt) southTowerEt=0;
135 if(southTowerEt == eastTowerEt) southTowerEt=0;
136 if(westTowerEt == northTowerEt) westTowerEt=0;
145 bool candidate =
false;
148 if (primaryEt > northEt && primaryEt > southEt && primaryEt > eastEt
149 && primaryEt > westEt && !primaryHE_FG)
155 else if (primaryEt < northEt || primaryEt < southEt || primaryEt < eastEt
156 || primaryEt < westEt || primaryHE_FG)
171 if (westTowerEt == primaryTowerEt)
173 else if (northTowerEt == primaryTowerEt)
175 else if (southTowerEt == primaryTowerEt)
177 else if (eastTowerEt == primaryTowerEt)
184 if (eastTowerEt == primaryTowerEt)
186 else if (southTowerEt == primaryTowerEt)
188 else if (northTowerEt == primaryTowerEt)
190 else if (westTowerEt == primaryTowerEt)
195 if (westTowerEt == primaryTowerEt)
197 else if (southTowerEt == primaryTowerEt)
199 else if (northTowerEt == primaryTowerEt)
201 else if (eastTowerEt == primaryTowerEt)
211 if (westTowerEt == primaryTowerEt)
213 else if (northTowerEt == primaryTowerEt)
215 else if (southTowerEt == primaryTowerEt)
217 else if (eastTowerEt == primaryTowerEt)
222 if (westTowerEt == primaryTowerEt)
224 else if (northTowerEt == primaryTowerEt)
226 else if (southTowerEt == primaryTowerEt)
228 else if (eastTowerEt == primaryTowerEt)
235 if (eastTowerEt == primaryTowerEt)
237 else if (southTowerEt == primaryTowerEt)
239 else if (northTowerEt == primaryTowerEt)
241 else if (westTowerEt == primaryTowerEt)
247 if (eastTowerEt == primaryTowerEt)
249 else if (southTowerEt == primaryTowerEt)
251 else if (northTowerEt == primaryTowerEt)
253 else if (westTowerEt == primaryTowerEt)
268 unsigned short candidateEt =
calcMaxSum(primaryEt,northEt,southEt,
272 bool neighborVeto = (nwHE_FG || northHE_FG || neHE_FG || westHE_FG ||
273 eastHE_FG || swHE_FG || southHE_FG || seHE_FG);
291 if (nwEt >= quietThreshold) nw =
true;
292 if (neEt >= quietThreshold) ne =
true;
293 if (swEt >= quietThreshold) sw =
true;
294 if (seEt >= quietThreshold) se =
true;
295 if (northEt >= quietThreshold) n =
true;
296 if (southEt >= quietThreshold) s =
true;
297 if (westEt >= quietThreshold) w =
true;
298 if (eastEt >= quietThreshold) e =
true;
301 bool nwC = (sw || w || nw || n ||
ne);
302 bool neC = (nw || n || ne || e || se);
303 bool seC = (ne || e || se || s || sw);
304 bool swC = (se || s || sw || w || nw);
308 bool quietVeto = (nwC && neC && seC && swC);
312 if(!(quietVeto || neighborVeto)){
313 if(candidateEt > isoElectron)
314 isoElectron = candidateEt;
317 else if(candidateEt > nonIsoElectron)
318 nonIsoElectron = candidateEt;
326 unsigned short fullIsoElectron = isoElectron*16 +
cardNo*2;
327 candidates.push_back(fullIsoElectron);
328 unsigned short fullNonIsoElectron = nonIsoElectron*16 + cardNo*2;
329 candidates.push_back(fullNonIsoElectron);
336 unsigned short southEt,
unsigned short eastEt,
337 unsigned short westEt){
338 unsigned short cardinals[4] = {northEt,southEt,eastEt,westEt};
339 unsigned short max = 0;
340 for(
int i = 0;
i<4;
i++){
341 unsigned short test = primaryEt+cardinals[
i];
350 std::cout <<
"Region 0 Information" << std::endl;
356 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)