#include <L1Trigger/RegionalCaloTrigger/interface/L1RCT.h>
Public Member Functions | |
void | digiInput (EcalTrigPrimDigiCollection ecalCollection, HcalTrigPrimDigiCollection hcalCollection) |
unsigned short | ecalCompressedET (int crate, int card, int tower) |
unsigned short | ecalFineGrainBit (int crate, int card, int tower) |
void | fileInput (const char *filename) |
L1CaloEmCollection | getIsolatedEGObjects (unsigned crate) |
std::vector< unsigned short > | getJetRegions (unsigned crate) |
L1CaloEmCollection | getNonisolatedEGObjects (unsigned crate) |
std::vector< L1CaloRegion > | getRegions (unsigned crate) |
unsigned short | hcalCompressedET (int crate, int card, int tower) |
unsigned short | hcalFineGrainBit (int crate, int card, int tower) |
unsigned short | hfCompressedET (int crate, int tower) |
unsigned short | hfFineGrainBit (int crate, int tower) |
void | input (std::vector< std::vector< std::vector< unsigned short > > > barrelIn, std::vector< std::vector< unsigned short > > hfIn) |
void | input () |
L1RCT (const L1RCTLookupTables *rctLookupTables) | |
void | print () |
void | printCrate (int i) |
void | printEIC (int i, int j) |
void | printEICEdges (int i, int j) |
void | printJSC () |
void | printJSC (int i) |
void | printRC (int i, int j) |
void | processEvent () |
void | randomInput () |
Private Member Functions | |
void | configureCards () |
L1RCT () | |
void | makeCrates () |
void | shareNeighbors () |
Private Attributes | |
std::vector< std::vector < std::vector< unsigned short > > > | barrel |
std::vector< L1RCTCrate > | crates |
L1RCTRegion | empty |
std::vector< std::vector < unsigned short > > | hf |
L1RCTNeighborMap | neighborMap |
const L1RCTLookupTables * | rctLookupTables_ |
Definition at line 20 of file L1RCT.h.
L1RCT::L1RCT | ( | const L1RCTLookupTables * | rctLookupTables | ) |
Definition at line 56 of file L1RCT.cc.
References makeCrates().
00056 : 00057 rctLookupTables_(rctLookupTables), 00058 empty(), 00059 neighborMap(), 00060 barrel(18,vector<vector<unsigned short> >(7,vector<unsigned short>(64))), 00061 hf(18,vector<unsigned short>(8)) 00062 { 00063 makeCrates(); 00064 }
L1RCT::L1RCT | ( | ) | [private] |
void L1RCT::configureCards | ( | ) | [private] |
void L1RCT::digiInput | ( | EcalTrigPrimDigiCollection | ecalCollection, | |
HcalTrigPrimDigiCollection | hcalCollection | |||
) |
Definition at line 116 of file L1RCT.cc.
References funct::abs(), barrel, L1RCTParameters::calcCard(), L1RCTParameters::calcCrate(), L1RCTParameters::calcTower(), TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), relval_parameters_module::energy, hf, i, input(), j, k, rctLookupTables_, L1RCTLookupTables::rctParameters(), and edm::SortedCollection< T, SORT >::size().
Referenced by L1RCTSaveInput::analyze(), L1RCTInputProducer::produce(), and L1RCTProducer::produce().
00118 { 00119 // fills input vectors with 0's in case ecal or hcal collection not used 00120 for (int i = 0; i < 18; i++) 00121 { 00122 for (int j = 0; j < 7; j++) 00123 { 00124 for (int k = 0; k < 64; k++) 00125 { 00126 barrel.at(i).at(j).at(k) = 0; 00127 } 00128 } 00129 for (int j = 0; j < 8; j++) 00130 { 00131 hf.at(i).at(j) = 0; 00132 } 00133 } 00134 00135 int nEcalDigi = ecalCollection.size(); 00136 if (nEcalDigi>4032) {nEcalDigi=4032;} 00137 for (int i = 0; i < nEcalDigi; i++){ 00138 short ieta = (short) ecalCollection[i].id().ieta(); 00139 // Note absIeta counts from 1-28 (not 0-27) 00140 unsigned short absIeta = (unsigned short) abs(ieta); 00141 unsigned short cal_iphi = (unsigned short) ecalCollection[i].id().iphi(); 00142 unsigned short iphi = (72 + 18 - cal_iphi) % 72; // transform TOWERS (not regions) into local rct (intuitive) phi bins 00143 00144 //map digis to crates, cards, and towers 00145 unsigned short crate = 999, card = 999, tower = 999; 00146 crate = rctLookupTables_->rctParameters()->calcCrate(iphi, ieta); 00147 card = rctLookupTables_->rctParameters()->calcCard(iphi, absIeta); 00148 tower = rctLookupTables_->rctParameters()->calcTower(iphi, absIeta); 00149 00150 unsigned short energy = ecalCollection[i].compressedEt(); 00151 unsigned short fineGrain = (unsigned short) ecalCollection[i].fineGrain(); // 0 or 1 00152 unsigned short ecalInput = energy*2 + fineGrain; 00153 00154 // put input into correct crate/card/tower of barrel 00155 if ((crate<18) && (card<7) && (tower<32)) { // changed 64 to 32 Sept. 19 J. Leonard, rm -1 7Nov07 00156 barrel.at(crate).at(card).at(tower) = ecalInput; // rm -1 00157 } 00158 else { std::cerr << "L1RCT: ecal out of range! tower = " << tower << " iphi is " << iphi << " absieta is " << absIeta << std::endl; } 00159 } 00160 00161 //same for hcal, once we get the hcal digis, just need to add 32 to towers: 00162 // just copied and pasted and changed names where necessary 00163 int nHcalDigi = hcalCollection.size(); 00164 //if (nHcalDigi != 4176){ std::cout << "L1RCT: Warning: There are " << nHcalDigi << "hcal digis instead of 4176!" << std::endl;} 00165 // incl HF 4032 + 144 = 4176 00166 for (int i = 0; i < nHcalDigi; i++){ 00167 short ieta = (short) hcalCollection[i].id().ieta(); 00168 unsigned short absIeta = (unsigned short) abs(ieta); 00169 unsigned short cal_iphi = (unsigned short) hcalCollection[i].id().iphi(); 00170 // All Hcal primitives (including HF) are reported 00171 // with phi bin numbering in the range 0-72. 00172 unsigned short iphi = (72 + 18 - cal_iphi) % 72; 00173 // transform Hcal TOWERS (1-72)into local rct (intuitive) phi bins (72 bins) 0-71 00174 // Use local iphi to work out the region and crate (for HB/HE and HF) 00175 // HF regions need to have local iphi 0-17 00176 if (absIeta >= 29) { 00177 iphi = iphi/4; 00178 } 00179 00180 //map digis to crates, cards, and towers 00181 unsigned short crate = 999, card = 999, tower = 999; 00182 crate = rctLookupTables_->rctParameters()->calcCrate(iphi, ieta); 00183 if (absIeta < 29){ 00184 card = rctLookupTables_->rctParameters()->calcCard(iphi, absIeta); 00185 } 00186 tower = rctLookupTables_->rctParameters()->calcTower(iphi, absIeta); 00187 00188 unsigned short energy = hcalCollection[i].SOI_compressedEt(); // access only sample of interest 00189 unsigned short fineGrain = (unsigned short) hcalCollection[i].SOI_fineGrain(); 00190 unsigned short hcalInput = energy*2 + fineGrain; 00191 if (absIeta <= 28){ 00192 // put input into correct crate/card/tower of barrel 00193 if ((crate<18) && (card<7) && (tower<32)) { // changed 64 to 32 Sept. 19 J. Leonard, rm -1 7Nov07 00194 barrel.at(crate).at(card).at(tower + 32) = hcalInput; // hcal towers are ecal + 32 see RC.cc; rm -1 7Nov07 00195 } 00196 else { std::cout << "L1RCT: hcal out of range! tower = " << tower << std::endl; } 00197 } 00198 else if ((absIeta >= 29) && (absIeta <= 32)){ 00199 // put input into correct crate/region of HF 00200 if ((crate<18) && (tower<8)) { 00201 hf.at(crate).at(tower) = hcalInput; 00202 } 00203 else { std::cout << "L1RCT: hf out of range! region = " << tower << std::endl; } 00204 } 00205 } 00206 00207 input(); 00208 00209 return; 00210 00211 }
Definition at line 78 of file L1RCT.h.
References barrel.
Referenced by L1RCTSaveInput::analyze(), and L1RCTInputProducer::produce().
00079 {return barrel.at(crate).at(card).at(tower) / 2;}
Definition at line 80 of file L1RCT.h.
References barrel.
Referenced by L1RCTSaveInput::analyze(), and L1RCTInputProducer::produce().
00081 {return barrel.at(crate).at(card).at(tower) & 1;}
void L1RCT::fileInput | ( | const char * | filename | ) |
Definition at line 85 of file L1RCT.cc.
References barrel, relval_parameters_module::energy, hf, i, input(), j, k, and x.
00085 { // added "const" also in .h 00086 unsigned short x; 00087 std::ifstream instream(filename); 00088 if(instream){ 00089 for(int i = 0; i<18;i++){ 00090 for(int j = 0; j<7; j++){ 00091 for(int k = 0; k<64; k++){ 00092 if(instream >> x){ 00093 unsigned short bit = x/256; // added J.Leonard Aug. 16 06 00094 unsigned short energy = x&255; // 00095 unsigned short input = energy*2 + bit; // 00096 barrel.at(i).at(j).at(k) = input; 00097 } 00098 else 00099 break; 00100 } 00101 } 00102 for(int j = 0; j<8; j++){ 00103 if(instream >> x){ 00104 hf.at(i).at(j) = x; 00105 } 00106 else 00107 break; 00108 } 00109 } 00110 } 00111 input(); 00112 }
L1CaloEmCollection L1RCT::getIsolatedEGObjects | ( | unsigned | crate | ) |
Definition at line 321 of file L1RCT.cc.
References crates, L1RCTLookupTables::emRank(), relval_parameters_module::energy, i, rctLookupTables_, and rgn.
Referenced by L1RCTProducer::produce().
00321 { 00322 vector<unsigned short> isoEmObjects = crates.at(crate).getIsolatedEGObjects(); 00323 L1CaloEmCollection isoEmCands; 00324 for (uint16_t i = 0; i < 4; i++){ 00325 unsigned rgn = ((isoEmObjects.at(i)) & 1); 00326 unsigned crd = (((isoEmObjects.at(i))/2) & 7); 00327 unsigned energy = ((isoEmObjects.at(i))/16); 00328 unsigned rank = rctLookupTables_->emRank(energy); 00329 L1CaloEmCand isoCand(rank, rgn, crd, crate, 1, i, 0); // includes emcand index 00330 isoEmCands.push_back(isoCand); 00331 } 00332 return isoEmCands; 00333 }
std::vector<unsigned short> L1RCT::getJetRegions | ( | unsigned | crate | ) | [inline] |
L1CaloEmCollection L1RCT::getNonisolatedEGObjects | ( | unsigned | crate | ) |
Definition at line 338 of file L1RCT.cc.
References crates, L1RCTLookupTables::emRank(), relval_parameters_module::energy, i, rctLookupTables_, and rgn.
Referenced by L1RCTProducer::produce().
00338 { 00339 vector<unsigned short> nonIsoEmObjects = crates.at(crate).getNonisolatedEGObjects(); 00340 L1CaloEmCollection nonIsoEmCands; 00341 for (uint16_t i = 0; i < 4; i++){ 00342 unsigned rgn = ((nonIsoEmObjects.at(i)) & 1); 00343 unsigned crd = (((nonIsoEmObjects.at(i))/2) & 7); 00344 unsigned energy = ((nonIsoEmObjects.at(i))/16); 00345 unsigned rank = rctLookupTables_->emRank(energy); 00346 L1CaloEmCand nonIsoCand(rank, rgn, crd, crate, 0, i, 0); // includes emcand index 00347 nonIsoEmCands.push_back(nonIsoCand); 00348 } 00349 return nonIsoEmCands; 00350 }
vector< L1CaloRegion > L1RCT::getRegions | ( | unsigned | crate | ) |
Definition at line 352 of file L1RCT.cc.
References crates, relval_parameters_module::energy, rgn, and metsig::tau.
Referenced by L1RCTProducer::produce().
00352 { 00353 // barrel regions 00354 std::bitset<14> taus( (long) crates.at(crate).getTauBits()); 00355 std::bitset<14> mips( (long) crates.at(crate).getMIPBits()); 00356 std::bitset<14> quiets( (long) crates.at(crate).getQuietBits()); 00357 std::bitset<14> overflows( (long) crates.at(crate).getOverFlowBits()); 00358 vector<unsigned short> barrelEnergies = crates.at(crate).getBarrelRegions(); 00359 vector<L1CaloRegion> regionCollection; 00360 for (unsigned card = 0; card < 7; card++){ 00361 for (unsigned rgn = 0; rgn < 2; rgn++){ 00362 bool tau = taus[card*2+rgn]; 00363 bool mip = mips[card*2+rgn]; 00364 bool quiet = quiets[card*2+rgn]; 00365 bool overflow = overflows[card*2+rgn]; 00366 unsigned barrelEnergy = barrelEnergies.at(card*2+rgn); 00367 L1CaloRegion region(barrelEnergy, overflow, tau, mip, quiet, crate, card, rgn); 00368 regionCollection.push_back(region); 00369 } 00370 } 00371 00372 // hf regions 00373 vector<unsigned short> hfEnergies = crates.at(crate).getHFRegions(); 00374 // fine grain bits -- still have to work out digi input 00375 vector<unsigned short> hfFineGrainBits = crates.at(crate).getHFFineGrainBits(); 00376 for (unsigned hfRgn = 0; hfRgn<8; hfRgn++){ // region number, see diagram on paper. make sure know how hf regions come in. 00377 unsigned energy = hfEnergies.at(hfRgn); 00378 bool fineGrain = hfFineGrainBits.at(hfRgn); 00379 L1CaloRegion hfRegion(energy, fineGrain, crate, hfRgn); 00380 regionCollection.push_back(hfRegion); 00381 } 00382 return regionCollection; 00383 }
Definition at line 82 of file L1RCT.h.
References barrel.
Referenced by L1RCTSaveInput::analyze(), and L1RCTInputProducer::produce().
00083 {return barrel.at(crate).at(card).at(tower+32) / 2;}
Definition at line 84 of file L1RCT.h.
References barrel.
Referenced by L1RCTSaveInput::analyze().
00085 {return barrel.at(crate).at(card).at(tower+32) & 1;}
Definition at line 86 of file L1RCT.h.
References hf.
Referenced by L1RCTInputProducer::produce().
00087 {return hf.at(crate).at(tower) / 2;}
void L1RCT::input | ( | std::vector< std::vector< std::vector< unsigned short > > > | barrelIn, | |
std::vector< std::vector< unsigned short > > | hfIn | |||
) |
void L1RCT::makeCrates | ( | ) | [private] |
void L1RCT::printJSC | ( | ) | [inline] |
void L1RCT::processEvent | ( | ) |
Definition at line 36 of file L1RCT.cc.
References crates, i, and shareNeighbors().
Referenced by L1RCTProducer::produce().
00036 { 00037 for(int i=0; i<18;i++) 00038 crates.at(i).processReceiverCards(); 00039 shareNeighbors(); 00040 for(int i=0; i<18;i++){ 00041 crates.at(i).fillElectronIsolationCards(); 00042 crates.at(i).processElectronIsolationCards(); 00043 crates.at(i).fillJetSummaryCard(); 00044 crates.at(i).processJetSummaryCard(); 00045 } 00046 }
void L1RCT::randomInput | ( | ) |
Definition at line 215 of file L1RCT.cc.
References barrel, hf, i, input(), j, and k.
00216 { 00217 for(int i = 0; i<18;i++){ 00218 for(int j = 0; j<7;j++){ 00219 for(int k = 0; k<64; k++){ 00220 barrel.at(i).at(j).at(k) = rand()%511; 00221 } 00222 } 00223 for(int j = 0; j<8;j++){ 00224 hf.at(i).at(j) = rand()%255; // changed from 1023 (10 bits) 00225 } 00226 } 00227 input(); 00228 return; 00229 }
void L1RCT::shareNeighbors | ( | ) | [private] |
Definition at line 238 of file L1RCT.cc.
References asciidump::at, crates, L1RCTNeighborMap::east(), empty, L1RCTRegion::giveEastEt(), L1RCTRegion::giveEastHE_FG(), L1RCTRegion::giveNEEt(), L1RCTRegion::giveNEHE_FG(), L1RCTRegion::giveNorthEt(), L1RCTRegion::giveNorthHE_FG(), L1RCTRegion::giveNWEt(), L1RCTRegion::giveNWHE_FG(), L1RCTRegion::giveSEEt(), L1RCTRegion::giveSEHE_FG(), L1RCTRegion::giveSouthEt(), L1RCTRegion::giveSouthHE_FG(), L1RCTRegion::giveSWEt(), L1RCTRegion::giveSWHE_FG(), L1RCTRegion::giveWestEt(), L1RCTRegion::giveWestHE_FG(), i, j, k, L1RCTNeighborMap::ne(), neighborMap, L1RCTNeighborMap::north(), L1RCTNeighborMap::nw(), L1RCTNeighborMap::se(), L1RCTRegion::setNorthEt(), L1RCTNeighborMap::south(), L1RCTNeighborMap::sw(), and L1RCTNeighborMap::west().
Referenced by processEvent().
00238 { 00239 L1RCTRegion* north; 00240 L1RCTRegion* south; 00241 L1RCTRegion* west; 00242 L1RCTRegion* east; 00243 L1RCTRegion* se; 00244 L1RCTRegion* sw; 00245 L1RCTRegion* nw; 00246 L1RCTRegion* ne; 00247 vector<vector<vector<L1RCTRegion*> > > regions(18,7); 00248 vector<L1RCTRegion*> rpair(2); 00249 for(int i = 0; i < 18; i++){ 00250 for(int j = 0; j < 7; j++){ 00251 for(int k = 0; k < 2; k++) 00252 rpair.at(k) = crates.at(i).getReceiverCard(j)->getRegion(k); 00253 regions.at(i).at(j) = rpair; 00254 } 00255 } 00256 for(int i = 0; i < 18; i++){ 00257 for(int j = 0; j < 7; j++){ 00258 for(int k = 0; k < 2; k++){ 00259 vector<int> northIndices = neighborMap.north(i,j,k); 00260 if(northIndices.at(0) != -1) 00261 north = regions.at(northIndices.at(0)).at(northIndices.at(1)).at(northIndices.at(2)); 00262 else north = ∅ 00263 vector<int> southIndices = neighborMap.south(i,j,k); 00264 if(southIndices.at(0) != -1) 00265 south = regions.at(southIndices.at(0)).at(southIndices.at(1)).at(southIndices.at(2)); 00266 else south = ∅ 00267 vector<int> westIndices = neighborMap.west(i,j,k); 00268 if(westIndices.at(0) != -1) 00269 west = regions.at(westIndices.at(0)).at(westIndices.at(1)).at(westIndices.at(2)); 00270 else west = ∅ 00271 vector<int> eastIndices = neighborMap.east(i,j,k); 00272 if(eastIndices.at(0) != -1) 00273 east = regions.at(eastIndices.at(0)).at(eastIndices.at(1)).at(eastIndices.at(2)); 00274 else east = ∅ 00275 vector<int> seIndices = neighborMap.se(i,j,k); 00276 if(seIndices.at(0) != -1) 00277 se = regions.at(seIndices.at(0)).at(seIndices.at(1)).at(seIndices.at(2)); 00278 else se = ∅ 00279 vector<int> swIndices = neighborMap.sw(i,j,k); 00280 if(swIndices.at(0) != -1) 00281 sw = regions.at(swIndices.at(0)).at(swIndices.at(1)).at(swIndices.at(2)); 00282 else sw = ∅ 00283 vector<int> neIndices = neighborMap.ne(i,j,k); 00284 if(neIndices.at(0) != -1) 00285 ne = regions.at(neIndices.at(0)).at(neIndices.at(1)).at(neIndices.at(2)); 00286 else ne = ∅ 00287 vector<int> nwIndices = neighborMap.nw(i,j,k); 00288 if(nwIndices.at(0) != -1) 00289 nw = regions.at(nwIndices.at(0)).at(nwIndices.at(1)).at(nwIndices.at(2)); 00290 else nw = ∅ 00291 regions.at(i).at(j).at(k)->setNorthEt(north->giveNorthEt()); 00292 regions.at(i).at(j).at(k)->setNorthHE_FG(north->giveNorthHE_FG()); 00293 regions.at(i).at(j).at(k)->setSouthEt(south->giveSouthEt()); 00294 regions.at(i).at(j).at(k)->setSouthHE_FG(south->giveSouthHE_FG()); 00295 regions.at(i).at(j).at(k)->setEastEt(east->giveEastEt()); 00296 regions.at(i).at(j).at(k)->setEastHE_FG(east->giveEastHE_FG()); 00297 regions.at(i).at(j).at(k)->setWestEt(west->giveWestEt()); 00298 regions.at(i).at(j).at(k)->setWestHE_FG(west->giveWestHE_FG()); 00299 regions.at(i).at(j).at(k)->setSEEt(se->giveSEEt()); 00300 regions.at(i).at(j).at(k)->setSEHE_FG(se->giveSEHE_FG()); 00301 regions.at(i).at(j).at(k)->setSWEt(sw->giveSWEt()); 00302 regions.at(i).at(j).at(k)->setSWHE_FG(sw->giveSWHE_FG()); 00303 regions.at(i).at(j).at(k)->setNWEt(nw->giveNWEt()); 00304 regions.at(i).at(j).at(k)->setNWHE_FG(nw->giveNWHE_FG()); 00305 regions.at(i).at(j).at(k)->setNEEt(ne->giveNEEt()); 00306 regions.at(i).at(j).at(k)->setNEHE_FG(ne->giveNEHE_FG()); 00307 } 00308 } 00309 } 00310 }
std::vector<std::vector<std::vector<unsigned short> > > L1RCT::barrel [private] |
Definition at line 128 of file L1RCT.h.
Referenced by digiInput(), ecalCompressedET(), ecalFineGrainBit(), fileInput(), hcalCompressedET(), hcalFineGrainBit(), input(), and randomInput().
std::vector<L1RCTCrate> L1RCT::crates [private] |
Definition at line 119 of file L1RCT.h.
Referenced by getIsolatedEGObjects(), getJetRegions(), getNonisolatedEGObjects(), getRegions(), input(), makeCrates(), print(), printCrate(), printEIC(), printEICEdges(), printJSC(), printRC(), processEvent(), and shareNeighbors().
L1RCTRegion L1RCT::empty [private] |
std::vector<std::vector<unsigned short> > L1RCT::hf [private] |
Definition at line 129 of file L1RCT.h.
Referenced by digiInput(), fileInput(), hfCompressedET(), hfFineGrainBit(), input(), and randomInput().
L1RCTNeighborMap L1RCT::neighborMap [private] |
const L1RCTLookupTables* L1RCT::rctLookupTables_ [private] |
Definition at line 95 of file L1RCT.h.
Referenced by digiInput(), getIsolatedEGObjects(), getNonisolatedEGObjects(), and makeCrates().