CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/L1Trigger/GlobalCaloTrigger/src/L1GctEmLeafCard.cc

Go to the documentation of this file.
00001 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctEmLeafCard.h"
00002 #include <vector>
00003 
00004 using std::vector;
00005 using std::ostream;
00006 using std::endl;
00007 
00008 const unsigned L1GctEmLeafCard::N_SORTERS = 4;
00009 
00010 L1GctEmLeafCard::L1GctEmLeafCard(int id) :
00011   m_id(id),
00012   m_sorters(4)
00013 {
00014   
00015   // sorters 0 and 1 are in FPGA U1 and deal with RCT crates 4-8 (13-17)
00016   m_sorters.at(0) = new L1GctElectronSorter(5,true);
00017   m_sorters.at(1) = new L1GctElectronSorter(5,false);
00018 
00019   // sorters 2 and 3 are in FPGA U2 and deal with RCT crates 0-3 (9-12)
00020   m_sorters.at(2) = new L1GctElectronSorter(4,true);
00021   m_sorters.at(3) = new L1GctElectronSorter(4,false);
00022 }
00023 
00024 
00025 L1GctEmLeafCard::~L1GctEmLeafCard() 
00026 {
00027   delete m_sorters.at(0);
00028   delete m_sorters.at(1);
00029   delete m_sorters.at(2);
00030   delete m_sorters.at(3);
00031 }
00032 
00033 
00035 void L1GctEmLeafCard::reset() {
00036   L1GctProcessor::reset();
00037   for (unsigned i=0; i<N_SORTERS; i++) {
00038     m_sorters.at(i)->reset();
00039   }
00040 }
00041 
00043 void L1GctEmLeafCard::setBxRange(const int firstBx, const int numberOfBx) {
00044   L1GctProcessor::setBxRange(firstBx, numberOfBx);
00045   for (unsigned i=0; i<N_SORTERS; i++) {
00046     m_sorters.at(i)->setBxRange(firstBx, numberOfBx);
00047   }
00048 }
00049 
00051 void L1GctEmLeafCard::setNextBx(const int bx) {
00052   L1GctProcessor::setNextBx(bx);
00053   for (unsigned i=0; i<N_SORTERS; i++) {
00054     m_sorters.at(i)->setNextBx(bx);
00055   }
00056 }
00057 
00059 void L1GctEmLeafCard::fetchInput() {
00060   for (unsigned i=0; i<N_SORTERS; i++) {
00061     m_sorters.at(i)->fetchInput();
00062   }
00063 }
00064 
00066 void L1GctEmLeafCard::process() {
00067   for (unsigned i=0; i<N_SORTERS; i++) {
00068     m_sorters.at(i)->process();
00069   }
00070 }
00071 
00073 vector<L1GctEmCand> L1GctEmLeafCard::getOutputIsoEmCands(int fpga) {
00074   if (fpga<2) {
00075     return m_sorters.at(2*fpga)->getOutputCands();
00076   }
00077   else {
00078     return vector<L1GctEmCand>(0);
00079   }
00080 }
00081 
00083 vector<L1GctEmCand> L1GctEmLeafCard::getOutputNonIsoEmCands(int fpga) {
00084   if (fpga<2) {
00085     return m_sorters.at(2*fpga+1)->getOutputCands();
00086   }
00087   else {
00088     return vector<L1GctEmCand>(0);
00089   }
00090 }
00091 
00092 ostream& operator<<(ostream& s, const L1GctEmLeafCard& card) {
00093   s << "===L1GctEmLeafCard===" <<endl;
00094   s << "ID = "<<card.m_id<<endl;
00095   s << "No of Electron Sorters = " << card.m_sorters.size() << endl;
00096   for (unsigned i=0; i<card.m_sorters.size(); i++) {
00097     s << std::endl;
00098     s << "===ElectronSorter===" << std::endl;
00099     s << "ElectronSorter no: " << i << endl << (*card.m_sorters.at(i));
00100   }
00101   s << endl;
00102   return s;
00103 }