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++) {
58 7,
std::vector<unsigned short>(64))),
59 hf(18,
std::vector<unsigned short>(8)) {
64 for (
int i = 0;
i < 18;
i++) {
70 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));
83 std::ifstream instream(filename);
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;
91 unsigned short input = energy * 2 + bit;
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 =
133 (72 + 18 - cal_iphi) % 72;
137 unsigned short crate = 999, card = 999, tower = 999;
142 unsigned short energy = ecalCollection[
i].compressedEt();
143 unsigned short fineGrain =
144 (
unsigned short)ecalCollection[
i].fineGrain();
145 unsigned short ecalInput = energy * 2 + fineGrain;
148 if ((crate < 18) && (card < 7) &&
150 barrel.at(crate).at(card).at(tower) = ecalInput;
152 std::cerr <<
"L1RCT: ecal out of range! tower = " << tower <<
" iphi is " 153 << iphi <<
" absieta is " << absIeta << std::endl;
159 int nHcalDigi = hcalCollection.
size();
163 for (
int i = 0;
i < nHcalDigi;
i++) {
164 if (hcalCollection[
i].
id().
version() != 0) {
167 short ieta = (short)hcalCollection[
i].
id().ieta();
168 unsigned short absIeta = (
unsigned short)
abs(ieta);
169 unsigned short cal_iphi = (
unsigned short)hcalCollection[
i].
id().iphi();
172 unsigned short iphi = (72 + 18 - cal_iphi) % 72;
181 unsigned short crate = 999, card = 999, tower = 999;
188 unsigned short energy =
189 hcalCollection[
i].SOI_compressedEt();
190 unsigned short fineGrain =
191 (
unsigned short)hcalCollection[
i].SOI_fineGrain();
192 unsigned short hcalInput = energy * 2 + fineGrain;
195 if ((crate < 18) && (card < 7) &&
197 barrel.at(crate).at(card).at(tower + 32) =
200 std::cout <<
"L1RCT: hcal out of range! tower = " << tower
203 }
else if ((absIeta >= 29) && (absIeta <= 32)) {
205 if ((crate < 18) && (tower < 8)) {
206 hf.at(crate).at(tower) = hcalInput;
208 std::cout <<
"L1RCT: hf out of range! region = " << tower << std::endl;
221 for (
int i = 0;
i < 18;
i++) {
222 for (
int j = 0; j < 7; j++) {
223 for (
int k = 0;
k < 64;
k++) {
227 for (
int j = 0; j < 8; j++) {
252 for (
int i = 0;
i < 18;
i++) {
253 for (
int j = 0; j < 7; j++) {
254 for (
int k = 0;
k < 2;
k++) {
256 primary =
crates.at(
i).getReceiverCard(j)->getRegion(
k);
259 if (northIndices.at(0) != -1)
260 north =
crates.at(northIndices.at(0))
261 .getReceiverCard(northIndices.at(1))
262 ->getRegion(northIndices.at(2));
267 if (southIndices.at(0) != -1)
268 south =
crates.at(southIndices.at(0))
269 .getReceiverCard(southIndices.at(1))
270 ->getRegion(southIndices.at(2));
275 if (westIndices.at(0) != -1)
276 west =
crates.at(westIndices.at(0))
277 .getReceiverCard(westIndices.at(1))
278 ->getRegion(westIndices.at(2));
283 if (eastIndices.at(0) != -1)
284 east =
crates.at(eastIndices.at(0))
285 .getReceiverCard(eastIndices.at(1))
286 ->getRegion(eastIndices.at(2));
291 if (seIndices.at(0) != -1)
292 se =
crates.at(seIndices.at(0))
293 .getReceiverCard(seIndices.at(1))
294 ->getRegion(seIndices.at(2));
299 if (swIndices.at(0) != -1)
300 sw =
crates.at(swIndices.at(0))
301 .getReceiverCard(swIndices.at(1))
302 ->getRegion(swIndices.at(2));
307 if (neIndices.at(0) != -1)
308 ne =
crates.at(neIndices.at(0))
309 .getReceiverCard(neIndices.at(1))
310 ->getRegion(neIndices.at(2));
315 if (nwIndices.at(0) != -1)
316 nw =
crates.at(nwIndices.at(0))
317 .getReceiverCard(nwIndices.at(1))
318 ->getRegion(nwIndices.at(2));
344 for (
int i = 0;
i < 18;
i++) {
353 std::vector<unsigned short> isoEmObjects =
354 crates.at(crate).getIsolatedEGObjects();
356 for (uint16_t
i = 0;
i < 4;
i++) {
357 unsigned rgn = ((isoEmObjects.at(
i)) & 1);
358 unsigned crd = (((isoEmObjects.at(
i)) / 2) & 7);
359 unsigned energy = ((isoEmObjects.at(
i)) / 16);
363 isoEmCands.push_back(isoCand);
371 std::vector<unsigned short> nonIsoEmObjects =
372 crates.at(crate).getNonisolatedEGObjects();
374 for (uint16_t
i = 0;
i < 4;
i++) {
375 unsigned rgn = ((nonIsoEmObjects.at(
i)) & 1);
376 unsigned crd = (((nonIsoEmObjects.at(
i)) / 2) & 7);
377 unsigned energy = ((nonIsoEmObjects.at(
i)) / 16);
381 nonIsoEmCands.push_back(nonIsoCand);
383 return nonIsoEmCands;
388 std::bitset<14>
taus((
long)
crates.at(crate).getTauBits());
389 std::bitset<14> mips((
long)
crates.at(crate).getMIPBits());
390 std::bitset<14> quiets((
long)
crates.at(crate).getQuietBits());
391 std::bitset<14> overflows((
long)
crates.at(crate).getOverFlowBits());
392 std::vector<unsigned short> barrelEnergies =
393 crates.at(crate).getBarrelRegions();
394 std::vector<L1CaloRegion> regionCollection;
395 for (
unsigned card = 0; card < 7; card++) {
396 for (
unsigned rgn = 0; rgn < 2; rgn++) {
397 bool tau =
taus[card * 2 + rgn];
398 bool mip = mips[card * 2 + rgn];
399 bool quiet = quiets[card * 2 + rgn];
400 bool overflow = overflows[card * 2 + rgn];
401 unsigned barrelEnergy = barrelEnergies.at(card * 2 + rgn);
402 L1CaloRegion region(barrelEnergy, overflow, tau, mip, quiet, crate, card,
404 regionCollection.push_back(region);
409 std::vector<unsigned short> hfEnergies =
crates.at(crate).getHFRegions();
411 std::vector<unsigned short> hfFineGrainBits =
412 crates.at(crate).getHFFineGrainBits();
413 for (
unsigned hfRgn = 0; hfRgn < 8;
416 unsigned energy = hfEnergies.at(hfRgn);
417 bool fineGrain = hfFineGrainBits.at(hfRgn);
419 regionCollection.push_back(hfRegion);
421 return regionCollection;
void setNEEt(unsigned short ne)
std::vector< unsigned short > giveSouthHE_FG() const
std::vector< std::vector< unsigned short > > hf
void setSWHE_FG(unsigned short sw)
std::vector< L1CaloEmCand > L1CaloEmCollection
std::vector< int > west(int crate, int card, int region)
std::vector< unsigned short > giveWestEt() const
void setNEHE_FG(unsigned short ne)
std::vector< int > north(int crate, int card, int region)
void setNorthHE_FG(const std::vector< unsigned short > &north)
std::vector< int > sw(int crate, int card, int region)
std::vector< int > south(int crate, int card, int region)
std::vector< L1CaloRegion > getRegions(unsigned crate)
std::vector< unsigned short > giveEastHE_FG() const
void setNWHE_FG(unsigned short nw)
Level-1 Region Calorimeter Trigger EM candidate.
std::vector< unsigned short > giveWestHE_FG() const
std::vector< L1RCTCrate > crates
L1CaloEmCollection getNonisolatedEGObjects(unsigned crate)
void setWestHE_FG(const std::vector< unsigned short > &west)
void setSEEt(unsigned short se)
unsigned short giveNEHE_FG() const
unsigned short calcTower(unsigned short rct_iphi, unsigned short absIeta) const
unsigned short giveSEHE_FG() const
L1CaloEmCollection getIsolatedEGObjects(unsigned crate)
Abs< T >::type abs(const T &t)
unsigned int emRank(unsigned short energy) const
unsigned short giveSWEt() const
unsigned short giveSEEt() const
void setSWEt(unsigned short sw)
unsigned short calcCard(unsigned short rct_iphi, unsigned short absIeta) const
std::vector< int > nw(int crate, int card, int region)
void setSouthHE_FG(const std::vector< unsigned short > &south)
void setNorthEt(const std::vector< unsigned short > &north)
std::vector< int > ne(int crate, int card, int region)
std::vector< unsigned short > giveNorthEt() const
void setSEHE_FG(unsigned short se)
L1RCTNeighborMap neighborMap
void setWestEt(const std::vector< unsigned short > &west)
const L1RCTParameters * rctParameters() const
void setEastHE_FG(const std::vector< unsigned short > &east)
void setEastEt(const std::vector< unsigned short > &east)
unsigned short giveNWHE_FG() const
void fileInput(const char *filename)
void setNWEt(unsigned short nw)
std::vector< int > east(int crate, int card, int region)
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
A calorimeter trigger region (sum of 4x4 trigger towers)
std::vector< unsigned short > giveEastEt() const
void setSouthEt(const std::vector< unsigned short > &south)
unsigned short giveSWHE_FG() const
std::vector< int > se(int crate, int card, int region)
unsigned short giveNEEt() const
const L1RCTLookupTables * rctLookupTables_
std::vector< unsigned short > giveNorthHE_FG() const
unsigned short giveNWEt() const
unsigned short calcCrate(unsigned short rct_iphi, short ieta) const
std::vector< unsigned short > giveSouthEt() const
std::vector< std::vector< std::vector< unsigned short > > > barrel