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();
50 for(
int i = 0;
i<18;
i++){
57 rctLookupTables_(rctLookupTables),
60 barrel(18,std::vector<std::vector<unsigned short> >(7,std::vector<unsigned short>(64))),
61 hf(18,std::vector<unsigned short>(8))
68 for(
int i = 0;
i<18;
i++){
73 void L1RCT::input(
const std::vector<std::vector<std::vector<unsigned short> > >& barrelIn,
74 const std::vector<std::vector<unsigned short> >& hfIn)
76 for(
int i = 0;
i<18;
i++){
77 crates.at(
i).input(barrelIn.at(
i),hfIn.at(
i));
87 std::ifstream instream(filename);
89 for(
int i = 0;
i<18;
i++){
90 for(
int j = 0;
j<7;
j++){
91 for(
int k = 0;
k<64;
k++){
93 unsigned short bit = x/256;
94 unsigned short energy = x&255;
95 unsigned short input = energy*2 + bit;
102 for(
int j = 0;
j<8;
j++){
120 for (
int i = 0;
i < 18;
i++)
122 for (
int j = 0;
j < 7;
j++)
124 for (
int k = 0;
k < 64;
k++)
129 for (
int j = 0;
j < 8;
j++)
135 int nEcalDigi = ecalCollection.
size();
136 if (nEcalDigi>4032) {nEcalDigi=4032;}
137 for (
int i = 0;
i < nEcalDigi;
i++){
138 short ieta = (short) ecalCollection[
i].
id().ieta();
140 unsigned short absIeta = (
unsigned short)
abs(ieta);
141 unsigned short cal_iphi = (
unsigned short) ecalCollection[
i].
id().iphi();
142 unsigned short iphi = (72 + 18 - cal_iphi) % 72;
145 unsigned short crate = 999, card = 999, tower = 999;
150 unsigned short energy = ecalCollection[
i].compressedEt();
151 unsigned short fineGrain = (
unsigned short) ecalCollection[
i].fineGrain();
152 unsigned short ecalInput = energy*2 + fineGrain;
155 if ((crate<18) && (card<7) && (tower<32)) {
156 barrel.at(crate).at(card).at(tower) = ecalInput;
158 else {
std::cerr <<
"L1RCT: ecal out of range! tower = " << tower <<
" iphi is " << iphi <<
" absieta is " << absIeta << std::endl; }
163 int nHcalDigi = hcalCollection.
size();
166 for (
int i = 0;
i < nHcalDigi;
i++){
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;
189 unsigned short energy = hcalCollection[
i].SOI_compressedEt();
190 unsigned short fineGrain = (
unsigned short) hcalCollection[
i].SOI_fineGrain();
191 unsigned short hcalInput = energy*2 + fineGrain;
194 if ((crate<18) && (card<7) && (tower<32)) {
195 barrel.at(crate).at(card).at(tower + 32) = hcalInput;
197 else {
std::cout <<
"L1RCT: hcal out of range! tower = " << tower << std::endl; }
199 else if ((absIeta >= 29) && (absIeta <= 32)){
201 if ((crate<18) && (tower<8)) {
202 hf.at(crate).at(tower) = hcalInput;
204 else {
std::cout <<
"L1RCT: hf out of range! region = " << tower << std::endl; }
219 for(
int i = 0;
i<18;
i++){
220 for(
int j = 0;
j<7;
j++){
221 for(
int k = 0;
k<64;
k++){
225 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)).getReceiverCard(northIndices.at(1))->getRegion(northIndices.at(2));
264 if(southIndices.at(0) != -1)
265 south =
crates.at(southIndices.at(0)).getReceiverCard(southIndices.at(1))->getRegion(southIndices.at(2));
269 if(westIndices.at(0) != -1)
270 west =
crates.at(westIndices.at(0)).getReceiverCard(westIndices.at(1))->getRegion(westIndices.at(2));
274 if(eastIndices.at(0) != -1)
275 east =
crates.at(eastIndices.at(0)).getReceiverCard(eastIndices.at(1))->getRegion(eastIndices.at(2));
279 if(seIndices.at(0) != -1)
280 se =
crates.at(seIndices.at(0)).getReceiverCard(seIndices.at(1))->getRegion(seIndices.at(2));
284 if(swIndices.at(0) != -1)
285 sw=
crates.at(swIndices.at(0)).getReceiverCard(swIndices.at(1))->getRegion(swIndices.at(2));
289 if(neIndices.at(0) != -1)
290 ne=
crates.at(neIndices.at(0)).getReceiverCard(neIndices.at(1))->getRegion(neIndices.at(2));
294 if(nwIndices.at(0) != -1)
295 nw=
crates.at(nwIndices.at(0)).getReceiverCard(nwIndices.at(1))->getRegion(nwIndices.at(2));
324 for(
int i = 0;
i<18;
i++){
333 std::vector<unsigned short> isoEmObjects =
crates.at(crate).getIsolatedEGObjects();
335 for (uint16_t
i = 0;
i < 4;
i++){
336 unsigned rgn = ((isoEmObjects.at(
i)) & 1);
337 unsigned crd = (((isoEmObjects.at(
i))/2) & 7);
338 unsigned energy = ((isoEmObjects.at(
i))/16);
341 isoEmCands.push_back(isoCand);
350 std::vector<unsigned short> nonIsoEmObjects =
crates.at(crate).getNonisolatedEGObjects();
352 for (uint16_t
i = 0;
i < 4;
i++){
353 unsigned rgn = ((nonIsoEmObjects.at(
i)) & 1);
354 unsigned crd = (((nonIsoEmObjects.at(
i))/2) & 7);
355 unsigned energy = ((nonIsoEmObjects.at(
i))/16);
358 nonIsoEmCands.push_back(nonIsoCand);
360 return nonIsoEmCands;
365 std::bitset<14> taus( (
long)
crates.at(crate).getTauBits());
366 std::bitset<14> mips( (
long)
crates.at(crate).getMIPBits());
367 std::bitset<14> quiets( (
long)
crates.at(crate).getQuietBits());
368 std::bitset<14> overflows( (
long)
crates.at(crate).getOverFlowBits());
369 std::vector<unsigned short> barrelEnergies =
crates.at(crate).getBarrelRegions();
370 std::vector<L1CaloRegion> regionCollection;
371 for (
unsigned card = 0; card < 7; card++){
372 for (
unsigned rgn = 0; rgn < 2; rgn++){
373 bool tau = taus[card*2+rgn];
374 bool mip = mips[card*2+rgn];
375 bool quiet = quiets[card*2+rgn];
376 bool overflow = overflows[card*2+rgn];
377 unsigned barrelEnergy = barrelEnergies.at(card*2+rgn);
378 L1CaloRegion region(barrelEnergy, overflow, tau, mip, quiet, crate, card, rgn);
379 regionCollection.push_back(region);
384 std::vector<unsigned short> hfEnergies =
crates.at(crate).getHFRegions();
386 std::vector<unsigned short> hfFineGrainBits =
crates.at(crate).getHFFineGrainBits();
387 for (
unsigned hfRgn = 0; hfRgn<8; hfRgn++){
388 unsigned energy = hfEnergies.at(hfRgn);
389 bool fineGrain = hfFineGrainBits.at(hfRgn);
391 regionCollection.push_back(hfRegion);
393 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)
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