CMS 3D CMS Logo

L1GctElectronFinalSort.cc
Go to the documentation of this file.
3 
5 
6 #include <algorithm>
7 
9  L1GctEmLeafCard* negEtaCard):
11  m_emCandsType(iso),
12  m_thePosEtaLeafCard(nullptr), m_theNegEtaLeafCard(nullptr),
13  m_inputCands(16),
14  m_outputCands(4),
15  m_setupOk(true)
16 {
17  if(posEtaCard!=nullptr){
18  m_thePosEtaLeafCard = posEtaCard;
19  }else{
20  m_setupOk = false;
21  if (m_verbose) {
22  edm::LogWarning("L1GctSetupError")
23  <<"L1GctElectronFinalSort::Constructor() : 1st EmLeafCard passed is zero";
24  }
25  }
26  if(negEtaCard!=nullptr){
27  m_theNegEtaLeafCard = negEtaCard;
28  }else{
29  m_setupOk = false;
30  if (m_verbose) {
31  edm::LogWarning("L1GctSetupError")
32  <<"L1GctElectronFinalSort::Constructor() : 2nd EmLeafCard passed is zero";
33  }
34  }
35  if (!m_setupOk && m_verbose) {
36  edm::LogError("L1GctSetupError") << "L1GctElectronFinalSort has been incorrectly constructed";
37  }
38 }
39 
41  m_inputCands.clear();
42  m_outputCands.contents.clear();
43 }
44 
46  m_inputCands.clear();
47  m_inputCands.resize(16);
48 }
49 
51  m_outputCands.reset(numOfBx());
52 }
53 
55  if (m_setupOk) {
56  for (int k=0; k<4; k++) {
57  if (m_emCandsType) {
62  }
63  else {
68  }
69  }
70  }
71 }
72 
74 
75  if (m_setupOk) {
76  std::vector<prioritisedEmCand> data(m_inputCands.size());
77  // Assign a "priority" for sorting - this assumes the candidates
78  // have already been filled in "priority order"
79  for (unsigned i=0; i<m_inputCands.size(); i++) {
81  data.at(i) = c;
82  }
83 
84  //Then sort it
86 
87  //Copy data to output buffer
88  std::vector<L1GctEmCand> temp(4);
89  for(int i = 0; i<4; i++){
90  temp.at(i) = data.at(i).emCand;
91  }
92  m_outputCands.store(temp, bxRel());
93  }
94 }
95 
97  if ((i<m_inputCands.size())
98  && (cand.bx()==bxAbs())) {
99  m_inputCands.at(i) = cand;
100  }
101 }
102 
103 std::ostream& operator<<(std::ostream& s, const L1GctElectronFinalSort& cand) {
104  s << "===ElectronFinalSort===" << std::endl;
105  s << "Card type = " << ( cand.m_emCandsType ? "isolated" : "non-isolated" ) <<std::endl;
106  s << "Pointers to the Electron Leaf cards are: "<<std::endl;
107  s << " Pos. eta: " << cand.m_thePosEtaLeafCard;
108  s << " Neg. eta: " << cand.m_theNegEtaLeafCard;
109  s << std::endl;
110  s << "No of Electron Input Candidates " << cand.m_inputCands.size() << std::endl;
111  s << "No of Electron Output Candidates " << cand.m_outputCands.contents.size() << std::endl;
112 
113  return s;
114 }
115 
116 
static bool rankByGt(const prioritisedEmCand &x, const prioritisedEmCand &y)
friend std::ostream & operator<<(std::ostream &s, const L1GctElectronFinalSort &cand)
overload of cout operator
L1GctElectronSorter * getNonIsoElectronSorterU1()
L1GctEmLeafCard * m_theNegEtaLeafCard
L1GctElectronFinalSort(bool iso, L1GctEmLeafCard *posEtaCard, L1GctEmLeafCard *negEtaCard)
std::vector< L1GctEmCand > getOutputCands()
get output candidates
bool m_verbose
Flag to control output messages.
L1GctElectronSorter * getNonIsoElectronSorterU2()
#define nullptr
void process() override
process the data, fill output buffers
int bxRel() const
int numOfBx() const
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
ABC for a GCT trigger data processing unit.
L1GctEmLeafCard * m_thePosEtaLeafCard
the 1st stage electron sorters
~L1GctElectronFinalSort() override
destructor
void fetchInput() override
get input data from sources
L1GctElectronSorter * getIsoElectronSorterU1()
void resetProcessor() override
Separate reset methods for the processor itself and any data stored in pipelines. ...
bool m_setupOk
Check the setup.
Pipeline< L1GctEmCand > m_outputCands
output data
int k[5][pyjets_maxn]
std::vector< L1GctEmCand > m_inputCands
input data
void setInputEmCand(unsigned i, const L1GctEmCand &cand)
set input data
bool m_emCandsType
type of electron candidate (iso(0) or non-iso(1))
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int16_t bx() const
get bunch-crossing index
Definition: L1GctEmCand.h:82
int bxAbs() const
L1GctElectronSorter * getIsoElectronSorterU2()
Emulates a leaf card programmed for electron sorting.