37 for (
int i = 0;
i < 18;
i++)
38 crates.at(
i).processReceiverCards();
40 for (
int i = 0;
i < 18;
i++) {
41 crates.at(
i).fillElectronIsolationCards();
42 crates.at(
i).processElectronIsolationCards();
43 crates.at(
i).fillJetSummaryCard();
44 crates.at(
i).processJetSummaryCard();
49 for (
int i = 0;
i < 18;
i++) {
56 : rctLookupTables_(rctLookupTables),
59 barrel(18,
std::vector<
std::vector<unsigned short>>(7,
std::vector<unsigned short>(64))),
60 hf(18,
std::vector<unsigned short>(8)) {
65 for (
int i = 0;
i < 18;
i++) {
70 void L1RCT::input(
const std::vector<std::vector<std::vector<unsigned short>>> &barrelIn,
71 const std::vector<std::vector<unsigned short>> &hfIn) {
72 for (
int i = 0;
i < 18;
i++) {
73 crates.at(
i).input(barrelIn.at(
i), hfIn.at(
i));
85 for (
int i = 0;
i < 18;
i++) {
86 for (
int j = 0;
j < 7;
j++) {
87 for (
int k = 0;
k < 64;
k++) {
89 unsigned short bit =
x / 256;
90 unsigned short energy =
x & 255;
97 for (
int j = 0;
j < 8;
j++) {
112 for (
int i = 0;
i < 18;
i++) {
113 for (
int j = 0;
j < 7;
j++) {
114 for (
int k = 0;
k < 64;
k++) {
118 for (
int j = 0;
j < 8;
j++) {
123 int nEcalDigi = ecalCollection.
size();
124 if (nEcalDigi > 4032) {
127 for (
int i = 0;
i < nEcalDigi;
i++) {
128 short ieta = (short)ecalCollection[
i].
id().ieta();
130 unsigned short absIeta = (
unsigned short)
abs(
ieta);
131 unsigned short cal_iphi = (
unsigned short)ecalCollection[
i].
id().iphi();
132 unsigned short iphi = (72 + 18 - cal_iphi) % 72;
136 unsigned short crate = 999, card = 999,
tower = 999;
141 unsigned short energy = ecalCollection[
i].compressedEt();
142 unsigned short fineGrain = (
unsigned short)ecalCollection[
i].fineGrain();
143 unsigned short ecalInput =
energy * 2 + fineGrain;
146 if ((crate < 18) && (card < 7) && (
tower < 32)) {
149 std::cerr <<
"L1RCT: ecal out of range! tower = " <<
tower <<
" iphi is " <<
iphi <<
" absieta is " << absIeta
156 int nHcalDigi = hcalCollection.
size();
160 for (
int i = 0;
i < nHcalDigi;
i++) {
161 if (hcalCollection[
i].
id().
version() != 0) {
164 short ieta = (short)hcalCollection[
i].
id().ieta();
165 unsigned short absIeta = (
unsigned short)
abs(
ieta);
166 unsigned short cal_iphi = (
unsigned short)hcalCollection[
i].
id().iphi();
169 unsigned short iphi = (72 + 18 - cal_iphi) % 72;
178 unsigned short crate = 999, card = 999,
tower = 999;
185 unsigned short energy = hcalCollection[
i].SOI_compressedEt();
186 unsigned short fineGrain = (
unsigned short)hcalCollection[
i].SOI_fineGrain();
187 unsigned short hcalInput =
energy * 2 + fineGrain;
190 if ((crate < 18) && (card < 7) && (
tower < 32)) {
191 barrel.at(crate).at(card).at(
tower + 32) = hcalInput;
193 std::cout <<
"L1RCT: hcal out of range! tower = " <<
tower << std::endl;
195 }
else if ((absIeta >= 29) && (absIeta <= 32)) {
197 if ((crate < 18) && (
tower < 8)) {
198 hf.at(crate).at(
tower) = hcalInput;
200 std::cout <<
"L1RCT: hf out of range! region = " <<
tower << std::endl;
213 for (
int i = 0;
i < 18;
i++) {
214 for (
int j = 0;
j < 7;
j++) {
215 for (
int k = 0;
k < 64;
k++) {
219 for (
int j = 0;
j < 8;
j++) {
244 for (
int i = 0;
i < 18;
i++) {
245 for (
int j = 0;
j < 7;
j++) {
246 for (
int k = 0;
k < 2;
k++) {
247 primary =
crates.at(
i).getReceiverCard(
j)->getRegion(
k);
250 if (northIndices.at(0) != -1)
251 north =
crates.at(northIndices.at(0)).getReceiverCard(northIndices.at(1))->getRegion(northIndices.at(2));
256 if (southIndices.at(0) != -1)
257 south =
crates.at(southIndices.at(0)).getReceiverCard(southIndices.at(1))->getRegion(southIndices.at(2));
262 if (westIndices.at(0) != -1)
263 west =
crates.at(westIndices.at(0)).getReceiverCard(westIndices.at(1))->getRegion(westIndices.at(2));
268 if (eastIndices.at(0) != -1)
269 east =
crates.at(eastIndices.at(0)).getReceiverCard(eastIndices.at(1))->getRegion(eastIndices.at(2));
274 if (seIndices.at(0) != -1)
275 se =
crates.at(seIndices.at(0)).getReceiverCard(seIndices.at(1))->getRegion(seIndices.at(2));
280 if (swIndices.at(0) != -1)
281 sw =
crates.at(swIndices.at(0)).getReceiverCard(swIndices.at(1))->getRegion(swIndices.at(2));
286 if (neIndices.at(0) != -1)
287 ne =
crates.at(neIndices.at(0)).getReceiverCard(neIndices.at(1))->getRegion(neIndices.at(2));
292 if (nwIndices.at(0) != -1)
293 nw =
crates.at(nwIndices.at(0)).getReceiverCard(nwIndices.at(1))->getRegion(nwIndices.at(2));
319 for (
int i = 0;
i < 18;
i++) {
328 std::vector<unsigned short> isoEmObjects =
crates.at(crate).getIsolatedEGObjects();
330 for (uint16_t
i = 0;
i < 4;
i++) {
331 unsigned rgn = ((isoEmObjects.at(
i)) & 1);
332 unsigned crd = (((isoEmObjects.at(
i)) / 2) & 7);
333 unsigned energy = ((isoEmObjects.at(
i)) / 16);
337 isoEmCands.push_back(isoCand);
345 std::vector<unsigned short> nonIsoEmObjects =
crates.at(crate).getNonisolatedEGObjects();
347 for (uint16_t
i = 0;
i < 4;
i++) {
348 unsigned rgn = ((nonIsoEmObjects.at(
i)) & 1);
349 unsigned crd = (((nonIsoEmObjects.at(
i)) / 2) & 7);
350 unsigned energy = ((nonIsoEmObjects.at(
i)) / 16);
354 nonIsoEmCands.push_back(nonIsoCand);
356 return nonIsoEmCands;
361 std::bitset<14>
taus((
long)
crates.at(crate).getTauBits());
362 std::bitset<14> mips((
long)
crates.at(crate).getMIPBits());
363 std::bitset<14> quiets((
long)
crates.at(crate).getQuietBits());
364 std::bitset<14> overflows((
long)
crates.at(crate).getOverFlowBits());
365 std::vector<unsigned short> barrelEnergies =
crates.at(crate).getBarrelRegions();
366 std::vector<L1CaloRegion> regionCollection;
367 for (
unsigned card = 0; card < 7; card++) {
368 for (
unsigned rgn = 0; rgn < 2; rgn++) {
369 bool tau =
taus[card * 2 + rgn];
370 bool mip = mips[card * 2 + rgn];
371 bool quiet = quiets[card * 2 + rgn];
372 bool overflow = overflows[card * 2 + rgn];
373 unsigned barrelEnergy = barrelEnergies.at(card * 2 + rgn);
375 regionCollection.push_back(
region);
380 std::vector<unsigned short> hfEnergies =
crates.at(crate).getHFRegions();
382 std::vector<unsigned short> hfFineGrainBits =
crates.at(crate).getHFFineGrainBits();
383 for (
unsigned hfRgn = 0; hfRgn < 8; hfRgn++) {
385 unsigned energy = hfEnergies.at(hfRgn);
386 bool fineGrain = hfFineGrainBits.at(hfRgn);
388 regionCollection.push_back(hfRegion);
390 return regionCollection;