CMS 3D CMS Logo

L1GctEmLeafCard.cc
Go to the documentation of this file.
2 #include <vector>
3 
4 using std::endl;
5 using std::ostream;
6 using std::vector;
7 
8 const unsigned L1GctEmLeafCard::N_SORTERS = 4;
9 
10 L1GctEmLeafCard::L1GctEmLeafCard(int id) : m_id(id), m_sorters(4) {
11  // sorters 0 and 1 are in FPGA U1 and deal with RCT crates 4-8 (13-17)
12  m_sorters.at(0) = new L1GctElectronSorter(5, true);
13  m_sorters.at(1) = new L1GctElectronSorter(5, false);
14 
15  // sorters 2 and 3 are in FPGA U2 and deal with RCT crates 0-3 (9-12)
16  m_sorters.at(2) = new L1GctElectronSorter(4, true);
17  m_sorters.at(3) = new L1GctElectronSorter(4, false);
18 }
19 
21  delete m_sorters.at(0);
22  delete m_sorters.at(1);
23  delete m_sorters.at(2);
24  delete m_sorters.at(3);
25 }
26 
30  for (unsigned i = 0; i < N_SORTERS; i++) {
31  m_sorters.at(i)->reset();
32  }
33 }
34 
36 void L1GctEmLeafCard::setBxRange(const int firstBx, const int numberOfBx) {
37  L1GctProcessor::setBxRange(firstBx, numberOfBx);
38  for (unsigned i = 0; i < N_SORTERS; i++) {
39  m_sorters.at(i)->setBxRange(firstBx, numberOfBx);
40  }
41 }
42 
44 void L1GctEmLeafCard::setNextBx(const int bx) {
46  for (unsigned i = 0; i < N_SORTERS; i++) {
47  m_sorters.at(i)->setNextBx(bx);
48  }
49 }
50 
53  for (unsigned i = 0; i < N_SORTERS; i++) {
54  m_sorters.at(i)->fetchInput();
55  }
56 }
57 
60  for (unsigned i = 0; i < N_SORTERS; i++) {
61  m_sorters.at(i)->process();
62  }
63 }
64 
66 vector<L1GctEmCand> L1GctEmLeafCard::getOutputIsoEmCands(int fpga) {
67  if (fpga < 2) {
68  return m_sorters.at(2 * fpga)->getOutputCands();
69  } else {
70  return vector<L1GctEmCand>(0);
71  }
72 }
73 
75 vector<L1GctEmCand> L1GctEmLeafCard::getOutputNonIsoEmCands(int fpga) {
76  if (fpga < 2) {
77  return m_sorters.at(2 * fpga + 1)->getOutputCands();
78  } else {
79  return vector<L1GctEmCand>(0);
80  }
81 }
82 
83 ostream& operator<<(ostream& s, const L1GctEmLeafCard& card) {
84  s << "===L1GctEmLeafCard===" << endl;
85  s << "ID = " << card.m_id << endl;
86  s << "No of Electron Sorters = " << card.m_sorters.size() << endl;
87  for (unsigned i = 0; i < card.m_sorters.size(); i++) {
88  s << std::endl;
89  s << "===ElectronSorter===" << std::endl;
90  s << "ElectronSorter no: " << i << endl << (*card.m_sorters.at(i));
91  }
92  s << endl;
93  return s;
94 }
void reset()
complete reset of processor
std::vector< L1GctEmCand > getOutputNonIsoEmCands(int fpga)
get the output candidates
void fetchInput() override
fetch input data
ostream & operator<<(ostream &s, const L1GctEmLeafCard &card)
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.
std::vector< L1GctElectronSorter * > m_sorters
processing - 0,2 are iso sorters, 1,3 are non-iso
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
~L1GctEmLeafCard() override
destruct
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
void process() override
process the event