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 if (hcalCollection[
i].
id().
version() != 0) {
170 short ieta = (short) hcalCollection[
i].
id().ieta();
171 unsigned short absIeta = (
unsigned short)
abs(ieta);
172 unsigned short cal_iphi = (
unsigned short) hcalCollection[
i].
id().iphi();
175 unsigned short iphi = (72 + 18 - cal_iphi) % 72;
184 unsigned short crate = 999, card = 999, tower = 999;
192 unsigned short energy = hcalCollection[
i].SOI_compressedEt();
193 unsigned short fineGrain = (
unsigned short) hcalCollection[
i].SOI_fineGrain();
194 unsigned short hcalInput = energy*2 + fineGrain;
197 if ((crate<18) && (card<7) && (tower<32)) {
198 barrel.at(crate).at(card).at(tower + 32) = hcalInput;
200 else {
std::cout <<
"L1RCT: hcal out of range! tower = " << tower << std::endl; }
202 else if ((absIeta >= 29) && (absIeta <= 32)){
204 if ((crate<18) && (tower<8)) {
205 hf.at(crate).at(tower) = hcalInput;
207 else {
std::cout <<
"L1RCT: hf out of range! region = " << tower << std::endl; }
222 for(
int i = 0;
i<18;
i++){
223 for(
int j = 0;
j<7;
j++){
224 for(
int k = 0;
k<64;
k++){
228 for(
int j = 0;
j<8;
j++){
255 for(
int i = 0;
i < 18;
i++){
256 for(
int j = 0;
j < 7;
j++){
257 for(
int k = 0;
k < 2;
k++){
259 primary =
crates.at(
i).getReceiverCard(
j)->getRegion(
k);
262 if(northIndices.at(0) != -1)
263 north =
crates.at(northIndices.at(0)).getReceiverCard(northIndices.at(1))->getRegion(northIndices.at(2));
267 if(southIndices.at(0) != -1)
268 south =
crates.at(southIndices.at(0)).getReceiverCard(southIndices.at(1))->getRegion(southIndices.at(2));
272 if(westIndices.at(0) != -1)
273 west =
crates.at(westIndices.at(0)).getReceiverCard(westIndices.at(1))->getRegion(westIndices.at(2));
277 if(eastIndices.at(0) != -1)
278 east =
crates.at(eastIndices.at(0)).getReceiverCard(eastIndices.at(1))->getRegion(eastIndices.at(2));
282 if(seIndices.at(0) != -1)
283 se =
crates.at(seIndices.at(0)).getReceiverCard(seIndices.at(1))->getRegion(seIndices.at(2));
287 if(swIndices.at(0) != -1)
288 sw=
crates.at(swIndices.at(0)).getReceiverCard(swIndices.at(1))->getRegion(swIndices.at(2));
292 if(neIndices.at(0) != -1)
293 ne=
crates.at(neIndices.at(0)).getReceiverCard(neIndices.at(1))->getRegion(neIndices.at(2));
297 if(nwIndices.at(0) != -1)
298 nw=
crates.at(nwIndices.at(0)).getReceiverCard(nwIndices.at(1))->getRegion(nwIndices.at(2));
327 for(
int i = 0;
i<18;
i++){
336 std::vector<unsigned short> isoEmObjects =
crates.at(crate).getIsolatedEGObjects();
338 for (uint16_t
i = 0;
i < 4;
i++){
339 unsigned rgn = ((isoEmObjects.at(
i)) & 1);
340 unsigned crd = (((isoEmObjects.at(
i))/2) & 7);
341 unsigned energy = ((isoEmObjects.at(
i))/16);
344 isoEmCands.push_back(isoCand);
353 std::vector<unsigned short> nonIsoEmObjects =
crates.at(crate).getNonisolatedEGObjects();
355 for (uint16_t
i = 0;
i < 4;
i++){
356 unsigned rgn = ((nonIsoEmObjects.at(
i)) & 1);
357 unsigned crd = (((nonIsoEmObjects.at(
i))/2) & 7);
358 unsigned energy = ((nonIsoEmObjects.at(
i))/16);
361 nonIsoEmCands.push_back(nonIsoCand);
363 return nonIsoEmCands;
368 std::bitset<14> taus( (
long)
crates.at(crate).getTauBits());
369 std::bitset<14> mips( (
long)
crates.at(crate).getMIPBits());
370 std::bitset<14> quiets( (
long)
crates.at(crate).getQuietBits());
371 std::bitset<14> overflows( (
long)
crates.at(crate).getOverFlowBits());
372 std::vector<unsigned short> barrelEnergies =
crates.at(crate).getBarrelRegions();
373 std::vector<L1CaloRegion> regionCollection;
374 for (
unsigned card = 0; card < 7; card++){
375 for (
unsigned rgn = 0; rgn < 2; rgn++){
376 bool tau = taus[card*2+rgn];
377 bool mip = mips[card*2+rgn];
378 bool quiet = quiets[card*2+rgn];
379 bool overflow = overflows[card*2+rgn];
380 unsigned barrelEnergy = barrelEnergies.at(card*2+rgn);
382 regionCollection.push_back(region);
387 std::vector<unsigned short> hfEnergies =
crates.at(crate).getHFRegions();
389 std::vector<unsigned short> hfFineGrainBits =
crates.at(crate).getHFFineGrainBits();
390 for (
unsigned hfRgn = 0; hfRgn<8; hfRgn++){
391 unsigned energy = hfEnergies.at(hfRgn);
392 bool fineGrain = hfFineGrainBits.at(hfRgn);
394 regionCollection.push_back(hfRegion);
396 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