CMS 3D CMS Logo

L1GctEmLeafCard.cc
Go to the documentation of this file.
2 #include <vector>
3 
4 using std::vector;
5 using std::ostream;
6 using std::endl;
7 
8 const unsigned L1GctEmLeafCard::N_SORTERS = 4;
9 
11  m_id(id),
12  m_sorters(4)
13 {
14 
15  // sorters 0 and 1 are in FPGA U1 and deal with RCT crates 4-8 (13-17)
16  m_sorters.at(0) = new L1GctElectronSorter(5,true);
17  m_sorters.at(1) = new L1GctElectronSorter(5,false);
18 
19  // sorters 2 and 3 are in FPGA U2 and deal with RCT crates 0-3 (9-12)
20  m_sorters.at(2) = new L1GctElectronSorter(4,true);
21  m_sorters.at(3) = new L1GctElectronSorter(4,false);
22 }
23 
24 
26 {
27  delete m_sorters.at(0);
28  delete m_sorters.at(1);
29  delete m_sorters.at(2);
30  delete m_sorters.at(3);
31 }
32 
33 
37  for (unsigned i=0; i<N_SORTERS; i++) {
38  m_sorters.at(i)->reset();
39  }
40 }
41 
43 void L1GctEmLeafCard::setBxRange(const int firstBx, const int numberOfBx) {
44  L1GctProcessor::setBxRange(firstBx, numberOfBx);
45  for (unsigned i=0; i<N_SORTERS; i++) {
46  m_sorters.at(i)->setBxRange(firstBx, numberOfBx);
47  }
48 }
49 
51 void L1GctEmLeafCard::setNextBx(const int bx) {
53  for (unsigned i=0; i<N_SORTERS; i++) {
54  m_sorters.at(i)->setNextBx(bx);
55  }
56 }
57 
60  for (unsigned i=0; i<N_SORTERS; i++) {
61  m_sorters.at(i)->fetchInput();
62  }
63 }
64 
67  for (unsigned i=0; i<N_SORTERS; i++) {
68  m_sorters.at(i)->process();
69  }
70 }
71 
73 vector<L1GctEmCand> L1GctEmLeafCard::getOutputIsoEmCands(int fpga) {
74  if (fpga<2) {
75  return m_sorters.at(2*fpga)->getOutputCands();
76  }
77  else {
78  return vector<L1GctEmCand>(0);
79  }
80 }
81 
83 vector<L1GctEmCand> L1GctEmLeafCard::getOutputNonIsoEmCands(int fpga) {
84  if (fpga<2) {
85  return m_sorters.at(2*fpga+1)->getOutputCands();
86  }
87  else {
88  return vector<L1GctEmCand>(0);
89  }
90 }
91 
92 ostream& operator<<(ostream& s, const L1GctEmLeafCard& card) {
93  s << "===L1GctEmLeafCard===" <<endl;
94  s << "ID = "<<card.m_id<<endl;
95  s << "No of Electron Sorters = " << card.m_sorters.size() << endl;
96  for (unsigned i=0; i<card.m_sorters.size(); i++) {
97  s << std::endl;
98  s << "===ElectronSorter===" << std::endl;
99  s << "ElectronSorter no: " << i << endl << (*card.m_sorters.at(i));
100  }
101  s << endl;
102  return s;
103 }
void reset()
complete reset of processor
std::vector< L1GctEmCand > getOutputNonIsoEmCands(int fpga)
get the output candidates
friend std::ostream & operator<<(std::ostream &s, const L1GctEmLeafCard &card)
overload of cout operator
void setNextBx(const int bxnum)
clear input data buffers and process a new bunch crossing
std::vector< L1GctEmCand > getOutputIsoEmCands(int fpga)
get the output candidates
static const unsigned N_SORTERS
int m_id
card ID (0 or 1)
Class that sorts electron candidates.
~L1GctEmLeafCard()
destruct
virtual void fetchInput()
fetch input data
std::vector< L1GctElectronSorter * > m_sorters
virtual void process()
process the event
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
void reset()
clear internal trigger data buffers
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
void setNextBx(const int bxnum)
clear input data buffers and process a new bunch crossing
Emulates a leaf card programmed for electron sorting.
L1GctEmLeafCard(int id)
construct with ID