CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctJetFinalStage.cc
Go to the documentation of this file.
4 
6 
7 using std::ostream;
8 using std::endl;
9 
10 //DEFINE STATICS
11 const unsigned int L1GctJetFinalStage::MAX_WHEEL_FPGAS = 2;
14 
15 
16 L1GctJetFinalStage::L1GctJetFinalStage(const std::vector<L1GctWheelJetFpga*>& wheelFpgas):
18  m_wheelFpgas(wheelFpgas),
19  m_centralJetSorter(new L1GctJetSorter()),
20  m_forwardJetSorter(new L1GctJetSorter()),
21  m_tauJetSorter(new L1GctJetSorter()),
22  m_inputCentralJets(MAX_JETS_IN),
23  m_inputForwardJets(MAX_JETS_IN),
24  m_inputTauJets(MAX_JETS_IN),
25  m_centralJets(MAX_JETS_OUT),
26  m_forwardJets(MAX_JETS_OUT),
27  m_tauJets(MAX_JETS_OUT),
28  m_setupOk(true)
29 {
30  if(m_wheelFpgas.size() != MAX_WHEEL_FPGAS)
31  {
32  m_setupOk = false;
33  if (m_verbose) {
34  edm::LogWarning("L1GctSetupError")
35  << "L1GctJetFinalStage::L1GctJetFinalStage() : Jet Final Stage instance has been incorrectly constructed!\n"
36  << "This class needs " << MAX_WHEEL_FPGAS << " wheel jet FPGA pointers, yet only " << m_wheelFpgas.size()
37  << " wheel jet FPGA pointers are present.\n";
38  }
39  }
40 
41  for(unsigned int i=0; i < MAX_WHEEL_FPGAS; ++i)
42  {
43  if(m_wheelFpgas.at(i) == 0)
44  {
45  m_setupOk = false;
46  if (m_verbose) {
47  edm::LogWarning("L1GctSetupError")
48  << "L1GctJetFinalStage::L1GctJetFinalStage() : Jet Final Stage instance has been incorrectly constructed!\n"
49  << "Wheel jet FPGA pointer " << i << " has not been set!\n";
50  }
51  }
52  }
53  if (!m_setupOk && m_verbose) {
54  edm::LogError("L1GctSetupError") << "L1GctJetFinalStage has been incorrectly constructed";
55  }
56 }
57 
59 {
60  if (m_centralJetSorter != 0) delete m_centralJetSorter;
61  if (m_forwardJetSorter != 0) delete m_forwardJetSorter;
62  if (m_tauJetSorter != 0) delete m_tauJetSorter;
63 }
64 
65 std::ostream& operator << (std::ostream& os, const L1GctJetFinalStage& fpga)
66 {
67  os << "===L1GctJetFinalStage===" << endl;
68  os << "No. of Wheel Jet FPGAs " << fpga.m_wheelFpgas.size() << std::endl;
69  for(unsigned i=0; i < fpga.m_wheelFpgas.size(); i++)
70  {
71  os << "WheelJetFpga* " << i << " = " << fpga.m_wheelFpgas.at(i) << endl;
72  }
73  os << "No. of input central Jets " << fpga.m_inputCentralJets.size() << std::endl;
74  for(unsigned i=0; i < fpga.m_inputCentralJets.size(); i++)
75  {
76  os << fpga.m_inputCentralJets.at(i);
77  }
78  os << "No. of input forward Jets " << fpga.m_inputForwardJets.size() << std::endl;
79  for(unsigned i=0; i < fpga.m_inputForwardJets.size(); i++)
80  {
81  os << fpga.m_inputForwardJets.at(i);
82  }
83  os << "No. of raw tau Jets " << fpga.m_inputTauJets.size() << std::endl;
84  for(unsigned i=0; i < fpga.m_inputTauJets.size(); i++)
85  {
86  os << fpga.m_inputTauJets.at(i);
87  }
88  os << "No. of output central Jets " << fpga.m_centralJets.contents.size() << std::endl;
89  for(unsigned i=0; i < fpga.m_centralJets.contents.size(); i++)
90  {
91  os << fpga.m_centralJets.contents.at(i);
92  }
93  os << "No. of output forward Jets " << fpga.m_forwardJets.contents.size() << std::endl;
94  for(unsigned i=0; i < fpga.m_forwardJets.contents.size(); i++)
95  {
96  os << fpga.m_forwardJets.contents.at(i);
97  }
98  os << "No. of output tau Jets " << fpga.m_tauJets.contents.size() << std::endl;
99  for(unsigned i=0; i < fpga.m_tauJets.contents.size(); i++)
100  {
101  os << fpga.m_tauJets.contents.at(i);
102  }
103  os << endl;
104  return os;
105 }
106 
108  //Clear all jet data
109  m_inputCentralJets.clear();
110  m_inputForwardJets.clear();
111  m_inputTauJets.clear();
112  //Resize the vectors
115  m_inputTauJets.resize(MAX_JETS_IN);
116 }
117 
121  m_tauJets.reset (numOfBx());
122 }
123 
125 {
126  if (m_setupOk) {
127  // We fetch and store the negative eta jets first. This ensures they have
128  // higher priority when sorting equal rank jets.
129  for(unsigned short iWheel=0; iWheel < MAX_WHEEL_FPGAS; ++iWheel)
130  {
131  storeJets(m_inputCentralJets, m_wheelFpgas.at(iWheel)->getCentralJets(), iWheel);
132  storeJets(m_inputForwardJets, m_wheelFpgas.at(iWheel)->getForwardJets(), iWheel);
133  storeJets(m_inputTauJets, m_wheelFpgas.at(iWheel)->getTauJets(), iWheel);
134  }
135  }
136 }
137 
139 {
140  if (m_setupOk) {
141  //Process jets
145 
149  }
150 }
151 
153 {
154  if( ((jet.isCentral() && jet.bx() == bxAbs()) || jet.empty())
155  && (i >= 0 && i < MAX_JETS_IN))
156  {
157  m_inputCentralJets.at(i) = jet;
158  }
159 }
160 
162 {
163  if( ((jet.isForward() && jet.bx() == bxAbs()) || jet.empty())
164  && (i >= 0 && i < MAX_JETS_IN))
165  {
166  m_inputForwardJets.at(i) = jet;
167  }
168 }
169 
171 {
172  if( ((jet.isTau() && jet.bx() == bxAbs()) || jet.empty())
173  && (i >= 0 && i < MAX_JETS_IN))
174  {
175  m_inputTauJets.at(i) = jet;
176  }
177 }
178 
179 void L1GctJetFinalStage::storeJets(JetVector& storageVector, const JetVector& jets, unsigned short iWheel)
180 {
181  for(unsigned short iJet = 0; iJet < L1GctWheelJetFpga::MAX_JETS_OUT; ++iJet)
182  {
183  if (jets.at(iJet).bx() == bxAbs()) {
184  storageVector.at((iWheel*L1GctWheelJetFpga::MAX_JETS_OUT) + iJet) = jets.at(iJet);
185  }
186  }
187 }
int i
Definition: DBlmapReader.cc:9
void setInputTauJet(int i, const L1GctJetCand &jet)
set the tau jets input data
bool isTau() const
check if this is a tau
Definition: L1GctJetCand.h:68
int16_t bx() const
get bunch-crossing index
Definition: L1GctJetCand.h:80
void setInputCentralJet(int i, const L1GctJetCand &jet)
set the central jets input data
L1GctJetFinalStage(const std::vector< L1GctWheelJetFpga * > &m_wheelFpgas)
Takes a vector of 2 wheel jet FPGA pointers, with which to get input data from.
void store(const T &thisBx, const int bxNum)
bool m_verbose
Flag to control output messages.
virtual void resetPipelines()
void storeJets(JetVector &storageVector, const JetVector &jets, unsigned short iWheel)
Enters jets into the specified storageVector, according to which wheel card we are taking them from...
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
virtual void process()
process the data, fill output buffers
int bxRel() const
std::vector< L1GctJetCand > JetVector
static const int MAX_JETS_OUT
Max number of jets of each type going out.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int numOfBx() const
bool isForward() const
check if this is a forward jet
Definition: L1GctJetCand.h:71
JetVector getSortedJets() const
static const int MAX_JETS_IN
Max number of jets of each type coming in.
ABC for a GCT trigger data processing unit.
Represents the final stage of L1 jet processing.
void setInputForwardJet(int i, const L1GctJetCand &jet)
set the forward jets input data
L1GctJetSorter * m_forwardJetSorter
L1GctJetSorter * m_tauJetSorter
L1GctJetSorter * m_centralJetSorter
Jet sorters.
vector< PseudoJet > jets
std::vector< L1GctWheelJetFpga * > m_wheelFpgas
wheel jet FPGAs
bool empty() const
was an object really found?
Definition: L1GctJetCand.h:47
void reset(const unsigned nBx)
virtual void resetProcessor()
Separate reset methods for the processor itself and any data stored in pipelines. ...
static const unsigned int MAX_WHEEL_FPGAS
Max number of wheel FPGA pointers.
static const int MAX_JETS_OUT
Max number of jets of each type we output.
int bxAbs() const
bool isCentral() const
check if this is a central jet
Definition: L1GctJetCand.h:65
void setJets(JetVector &inputJets)
std::vector< T > contents
virtual void fetchInput()
get input data from sources