CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctElectronFinalSort.cc
Go to the documentation of this file.
2 
4 
6 
7 #include <algorithm>
8 
10  L1GctEmLeafCard* negEtaCard):
12  m_emCandsType(iso),
13  m_thePosEtaLeafCard(0), m_theNegEtaLeafCard(0),
14  m_inputCands(16),
15  m_outputCands(4),
16  m_setupOk(true)
17 {
18  if(posEtaCard!=0){
19  m_thePosEtaLeafCard = posEtaCard;
20  }else{
21  m_setupOk = false;
22  if (m_verbose) {
23  edm::LogWarning("L1GctSetupError")
24  <<"L1GctElectronFinalSort::Constructor() : 1st EmLeafCard passed is zero";
25  }
26  }
27  if(negEtaCard!=0){
28  m_theNegEtaLeafCard = negEtaCard;
29  }else{
30  m_setupOk = false;
31  if (m_verbose) {
32  edm::LogWarning("L1GctSetupError")
33  <<"L1GctElectronFinalSort::Constructor() : 2nd EmLeafCard passed is zero";
34  }
35  }
36  if (!m_setupOk && m_verbose) {
37  edm::LogError("L1GctSetupError") << "L1GctElectronFinalSort has been incorrectly constructed";
38  }
39 }
40 
42  m_inputCands.clear();
43  m_outputCands.contents.clear();
44 }
45 
47  m_inputCands.clear();
48  m_inputCands.resize(16);
49 }
50 
52  m_outputCands.reset(numOfBx());
53 }
54 
56  if (m_setupOk) {
57  for (int k=0; k<4; k++) {
58  if (m_emCandsType) {
63  }
64  else {
69  }
70  }
71  }
72 }
73 
75 
76  if (m_setupOk) {
77  std::vector<prioritisedEmCand> data(m_inputCands.size());
78  // Assign a "priority" for sorting - this assumes the candidates
79  // have already been filled in "priority order"
80  for (unsigned i=0; i<m_inputCands.size(); i++) {
82  data.at(i) = c;
83  }
84 
85  //Then sort it
86  sort(data.begin(),data.end(),rank_gt());
87 
88  //Copy data to output buffer
89  std::vector<L1GctEmCand> temp(4);
90  for(int i = 0; i<4; i++){
91  temp.at(i) = data.at(i).emCand;
92  }
93  m_outputCands.store(temp, bxRel());
94  }
95 }
96 
98  if ((i<m_inputCands.size())
99  && (cand.bx()==bxAbs())) {
100  m_inputCands.at(i) = cand;
101  }
102 }
103 
104 std::ostream& operator<<(std::ostream& s, const L1GctElectronFinalSort& cand) {
105  s << "===ElectronFinalSort===" << std::endl;
106  s << "Card type = " << ( cand.m_emCandsType ? "isolated" : "non-isolated" ) <<std::endl;
107  s << "Pointers to the Electron Leaf cards are: "<<std::endl;
108  s << " Pos. eta: " << cand.m_thePosEtaLeafCard;
109  s << " Neg. eta: " << cand.m_theNegEtaLeafCard;
110  s << std::endl;
111  s << "No of Electron Input Candidates " << cand.m_inputCands.size() << std::endl;
112  s << "No of Electron Output Candidates " << cand.m_outputCands.contents.size() << std::endl;
113 
114  return s;
115 }
116 
117 
L1GctElectronSorter::rank_gt rank_gt
int i
Definition: DBlmapReader.cc:9
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()
int bxRel() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
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
L1GctElectronSorter * getIsoElectronSorterU1()
bool m_setupOk
Check the setup.
virtual void resetProcessor()
Separate reset methods for the processor itself and any data stored in pipelines. ...
Pipeline< L1GctEmCand > m_outputCands
output data
int k[5][pyjets_maxn]
virtual void process()
process the data, fill output buffers
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()
virtual void fetchInput()
get input data from sources
Emulates a leaf card programmed for electron sorting.