CMS 3D CMS Logo

L1GctWheelJetFpga.cc
Go to the documentation of this file.
2 
4 
8 
9 //DEFINE STATICS
11 const unsigned int L1GctWheelJetFpga::MAX_LEAF_CARDS = 3;
12 const unsigned int L1GctWheelJetFpga::MAX_JETS_PER_LEAF =
15 
16 L1GctWheelJetFpga::L1GctWheelJetFpga(int id, const std::vector<L1GctJetLeafCard*>& inputLeafCards)
17  : L1GctProcessor(),
18  m_id(id),
19  m_inputLeafCards(inputLeafCards),
20  m_centralJetSorter(new L1GctJetSorter()),
21  m_forwardJetSorter(new L1GctJetSorter()),
22  m_tauJetSorter(new L1GctJetSorter()),
23  m_inputJets(MAX_JETS_IN),
24  m_rawCentralJets(MAX_JETS_IN),
25  m_rawForwardJets(MAX_JETS_IN),
26  m_rawTauJets(MAX_JETS_IN),
27  m_inputHx(MAX_LEAF_CARDS),
28  m_inputHy(MAX_LEAF_CARDS),
29  m_inputHfSums(MAX_LEAF_CARDS),
30  m_centralJets(MAX_JETS_OUT),
31  m_forwardJets(MAX_JETS_OUT),
32  m_tauJets(MAX_JETS_OUT),
33  m_outputHx(0),
34  m_outputHy(0),
35  m_outputHfSums(),
36  m_outputHxPipe(),
37  m_outputHyPipe() {
38  if (checkSetup()) {
39  setupJetsVectors(0); //Initialises all the jet vectors with jets of the correct type.
40 
41  } else {
42  if (m_verbose) {
43  edm::LogError("L1GctSetupError") << "L1GctWheelJetFpga has been incorrectly constructed";
44  }
45  }
46 }
47 
49  bool result = true;
50 
51  //Check object construction is ok
52  if (m_id < 0 || m_id > 1) {
53  result = false;
54  if (m_verbose) {
55  edm::LogWarning("L1GctSetupError") << "L1GctWheelJetFpga::L1GctWheelJetFpga() : Wheel Jet FPGA ID " << m_id
56  << " has been incorrectly constructed!\n"
57  << "ID number should be between the range of 0 to 1\n";
58  }
59  }
60 
61  if (m_inputLeafCards.size() != MAX_LEAF_CARDS) {
62  result = false;
63  if (m_verbose) {
64  edm::LogWarning("L1GctSetupError") << "L1GctWheelJetFpga::L1GctWheelJetFpga() : Wheel Jet FPGA ID " << m_id
65  << " has been incorrectly constructed!\n"
66  << "This class needs " << MAX_LEAF_CARDS
67  << " jet leaf card pointers, yet only " << m_inputLeafCards.size()
68  << " leaf card pointers are present.\n";
69  }
70  }
71 
72  for (unsigned int i = 0; i < MAX_LEAF_CARDS; ++i) {
73  if (m_inputLeafCards.at(i) == nullptr) {
74  result = false;
75  if (m_verbose) {
76  edm::LogWarning("L1GctSetupError") << "L1GctWheelJetFpga::L1GctWheelJetFpga() : Wheel Jet FPGA ID " << m_id
77  << " has been incorrectly constructed!\n"
78  << "Leaf card pointer " << i << " has not been set!\n";
79  }
80  }
81  }
82  return result;
83 }
84 
86  if (m_centralJetSorter != nullptr)
87  delete m_centralJetSorter;
88  if (m_forwardJetSorter != nullptr)
89  delete m_forwardJetSorter;
90  if (m_tauJetSorter != nullptr)
91  delete m_tauJetSorter;
92 }
93 
94 std::ostream& operator<<(std::ostream& os, const L1GctWheelJetFpga& fpga) {
95  using std::endl;
96  os << "===L1GctWheelJetFPGA===" << endl;
97  os << "ID = " << fpga.m_id << endl;
98  os << "No of Input Leaf Cards " << fpga.m_inputLeafCards.size() << endl;
99  for (unsigned i = 0; i < fpga.m_inputLeafCards.size(); i++) {
100  os << "InputLeafCard* " << i << " = " << fpga.m_inputLeafCards.at(i) << endl;
101  }
102  // os << "No. of Input Jets " << fpga.m_inputJets.size() << endl;
103  // for(unsigned i=0; i < fpga.m_inputJets.size(); i++)
104  // {
105  // os << fpga.m_inputJets.at(i);
106  // }
107  // os << "No. of raw central Jets " << fpga.m_rawCentralJets.size() << endl;
108  // for(unsigned i=0; i < fpga.m_rawCentralJets.size(); i++)
109  // {
110  // os << fpga.m_rawCentralJets.at(i);
111  // }
112  // os << "No. of raw forward Jets " << fpga.m_rawForwardJets.size() << endl;
113  // for(unsigned i=0; i < fpga.m_rawForwardJets.size(); i++)
114  // {
115  // os << fpga.m_rawForwardJets.at(i);
116  // }
117  // os << "No. of raw tau Jets " << fpga.m_rawTauJets.size() << endl;
118  // for(unsigned i=0; i < fpga.m_rawTauJets.size(); i++)
119  // {
120  // os << fpga.m_rawTauJets.at(i);
121  // }
122  // os << "No. of output central Jets " << fpga.m_centralJets.size() << endl;
123  // for(unsigned i=0; i < fpga.m_centralJets.size(); i++)
124  // {
125  // os << fpga.m_centralJets.at(i);
126  // }
127  // os << "No. of output forward Jets " << fpga.m_forwardJets.size() << endl;
128  // for(unsigned i=0; i < fpga.m_forwardJets.size(); i++)
129  // {
130  // os << fpga.m_forwardJets.at(i);
131  // }
132  // os << "No. of output tau Jets " << fpga.m_tauJets.size() << endl;
133  // for(unsigned i=0; i < fpga.m_tauJets.size(); i++)
134  // {
135  // os << fpga.m_tauJets.at(i);
136  // }
137  os << endl;
138  return os;
139 }
140 
142  for (unsigned int i = 0; i < MAX_LEAF_CARDS; ++i) {
143  m_inputHx.at(i).reset();
144  m_inputHy.at(i).reset();
145  m_inputHfSums.at(i).reset();
146  }
147  m_outputHx.reset();
148  m_outputHy.reset();
150 }
151 
152 void L1GctWheelJetFpga::setupObjects() { setupJetsVectors(static_cast<int16_t>(bxAbs())); }
153 
155  m_outputHxPipe.reset(numOfBx());
156  m_outputHyPipe.reset(numOfBx());
157 }
158 
160  if (checkSetup()) {
161  //Get Jets
162  for (unsigned short iLeaf = 0; iLeaf < MAX_LEAF_CARDS; ++iLeaf) {
163  if (m_inputLeafCards.at(iLeaf) != nullptr) { //check that the pointers have been set up!
164 
165  storeJets(m_inputLeafCards.at(iLeaf)->getOutputJetsA(), iLeaf, 0);
166  storeJets(m_inputLeafCards.at(iLeaf)->getOutputJetsB(), iLeaf, L1GctJetFinderBase::MAX_JETS_OUT);
167  storeJets(m_inputLeafCards.at(iLeaf)->getOutputJetsC(), iLeaf, 2 * L1GctJetFinderBase::MAX_JETS_OUT);
168 
169  // Deal with the Ht inputs
170  m_inputHx.at(iLeaf) = m_inputLeafCards.at(iLeaf)->getOutputHx();
171  m_inputHy.at(iLeaf) = m_inputLeafCards.at(iLeaf)->getOutputHy();
172 
173  // Deal with the Hf tower sum inputs
174  m_inputHfSums.at(iLeaf) = m_inputLeafCards.at(iLeaf)->getOutputHfSums();
175  }
176  }
177  }
178 }
179 
181  if (checkSetup()) {
182  classifyJets();
183 
187 
191 
192  for (unsigned short iJet = 0; iJet < MAX_JETS_OUT; ++iJet) {
193  m_centralJets.at(iJet) = m_rawCentralJets.at(iJet);
194  m_forwardJets.at(iJet) = m_rawForwardJets.at(iJet);
195  m_tauJets.at(iJet) = m_rawTauJets.at(iJet);
196  }
197 
198  //Ht processing
199  m_outputHx = m_inputHx.at(0) + m_inputHx.at(1) + m_inputHx.at(2);
200  m_outputHy = m_inputHy.at(0) + m_inputHy.at(1) + m_inputHy.at(2);
201 
202  //Hf tower sums processing
204 
205  m_outputHxPipe.store(m_outputHx, bxRel());
206  m_outputHyPipe.store(m_outputHy, bxRel());
207  }
208 }
209 
211  if (i >= 0 && i < MAX_JETS_IN) {
212  m_inputJets.at(i) = jet;
213  } else {
214  if (m_verbose) {
215  edm::LogError("L1GctInputError") << "L1GctWheelJetFpga::setInputJet() : In WheelJetFpga ID " << m_id
216  << ", inputted jet candidate " << i << " is outside input index range of 0 to "
217  << (MAX_JETS_IN - 1) << "\n";
218  }
219  }
220 }
221 
223 std::vector<L1GctInternHtMiss> L1GctWheelJetFpga::getInternalHtMiss() const {
224  std::vector<L1GctInternHtMiss> result;
225  for (int bx = 0; bx < numOfBx(); bx++) {
226  result.push_back(L1GctInternHtMiss::emulatorMissHtx(m_outputHxPipe.contents.at(bx).value(),
227  m_outputHxPipe.contents.at(bx).overFlow(),
228  static_cast<int16_t>(bx - bxMin())));
229  result.push_back(L1GctInternHtMiss::emulatorMissHty(m_outputHyPipe.contents.at(bx).value(),
230  m_outputHyPipe.contents.at(bx).overFlow(),
231  static_cast<int16_t>(bx - bxMin())));
232  }
233  return result;
234 }
235 
236 void L1GctWheelJetFpga::storeJets(const JetVector& jets, unsigned short iLeaf, unsigned short offset) {
237  for (unsigned short iJet = 0; iJet < L1GctJetFinderBase::MAX_JETS_OUT; ++iJet) {
238  m_inputJets.at(iLeaf * MAX_JETS_PER_LEAF + offset + iJet) = jets.at(iJet);
239  }
240 }
241 
243  JetVector::iterator currentJet;
244 
245  unsigned short pos = 0;
246  // In the case of two jets of equal rank, the sort will take the lower priority.
247  // This corresponds to the lower position in the array. In order to mimic the hardware
248  // behaviour, the order of jets from the input leaf cards is maintained here.
249  for (currentJet = m_inputJets.begin(); currentJet != m_inputJets.end(); ++currentJet, ++pos) {
250  if (!currentJet->empty()) {
251  if (currentJet->isForward()) //forward jet
252  {
253  m_rawForwardJets.at(pos) = *currentJet;
254  } else {
255  if (currentJet->isCentral()) //central non-tau jet.
256  {
257  m_rawCentralJets.at(pos) = *currentJet;
258  } else //must be central tau-jet
259  {
260  if (currentJet->isTau()) {
261  m_rawTauJets.at(pos) = *currentJet;
262  } else { //shouldn't get here!
263  if (m_verbose) {
264  edm::LogWarning("L1GctProcessingError")
265  << "Unclassified jet found by WheelJetFpga id " << m_id << ". Jet details follow." << std::endl
266  << *currentJet << std::endl;
267  }
268  }
269  }
270  }
271  }
272  }
273 }
274 
276  // Create empty jet candidates with the three different combinations
277  // of flags, corresponding to central, forward and tau jets
278  L1GctJetCand tempCen(0, 0, 0, false, false, (uint16_t)0, (uint16_t)0, bx);
279  L1GctJetCand tempTau(0, 0, 0, true, false, (uint16_t)0, (uint16_t)0, bx);
280  L1GctJetCand tempFwd(0, 0, 0, false, true, (uint16_t)0, (uint16_t)0, bx);
281 
282  // Initialize the jet vectors with copies of the appropriate empty jet type
283  m_rawCentralJets.assign(MAX_JETS_IN, tempCen);
284  m_rawTauJets.assign(MAX_JETS_IN, tempTau);
285  m_rawForwardJets.assign(MAX_JETS_IN, tempFwd);
286 
287  m_centralJets.assign(MAX_JETS_OUT, tempCen);
288  m_tauJets.assign(MAX_JETS_OUT, tempTau);
289  m_forwardJets.assign(MAX_JETS_OUT, tempFwd);
290 }
L1GctWheelJetFpga::m_rawTauJets
JetVector m_rawTauJets
Definition: L1GctWheelJetFpga.h:122
L1GctWheelJetFpga::m_outputHfSums
hfTowerSumsType m_outputHfSums
Definition: L1GctWheelJetFpga.h:139
L1GctWheelJetFpga::m_forwardJetSorter
L1GctJetSorter * m_forwardJetSorter
Definition: L1GctWheelJetFpga.h:113
mps_fire.i
i
Definition: mps_fire.py:355
L1GctJetCand
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
L1GctWheelJetFpga::m_tauJets
JetVector m_tauJets
Definition: L1GctWheelJetFpga.h:134
MessageLogger.h
L1GctWheelJetFpga::m_outputHxPipe
Pipeline< htComponentType > m_outputHxPipe
Definition: L1GctWheelJetFpga.h:141
L1GctJetSorter::getSortedJets
JetVector getSortedJets() const
Definition: L1GctJetSorter.cc:12
L1GctJetFinderBase::MAX_JETS_OUT
static const unsigned int MAX_JETS_OUT
Max of 6 jets found per jetfinder in a 2*11 search area.
Definition: L1GctJetFinderBase.h:111
L1GctWheelJetFpga::m_inputHy
std::vector< htComponentType > m_inputHy
Definition: L1GctWheelJetFpga.h:126
L1GctWheelJetFpga::classifyJets
void classifyJets()
Classifies jets into central, forward or tau.
Definition: L1GctWheelJetFpga.cc:242
L1GctWheelJetFpga::process
void process() override
process the data, fill output buffers
Definition: L1GctWheelJetFpga.cc:180
pos
Definition: PixelAliasList.h:18
L1GctWheelJetFpga::resetPipelines
void resetPipelines() override
Definition: L1GctWheelJetFpga.cc:154
L1GctProcessor::numOfBx
int numOfBx() const
Definition: L1GctProcessor.h:79
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1GctProcessor::bxRel
int bxRel() const
Definition: L1GctProcessor.h:81
L1GctJetSorter.h
L1GctWheelJetFpga::m_forwardJets
JetVector m_forwardJets
Definition: L1GctWheelJetFpga.h:133
L1GctWheelJetFpga::m_outputHy
htComponentType m_outputHy
Definition: L1GctWheelJetFpga.h:138
L1GctWheelJetFpga::setupObjects
void setupObjects() override
Initialise inputs with null objects for the correct bunch crossing if required.
Definition: L1GctWheelJetFpga.cc:152
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
L1GctInternHtMiss::emulatorMissHty
static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht y component object from emulator.
Definition: L1GctInternHtMiss.cc:73
L1GctWheelJetFpga::getInternalHtMiss
std::vector< L1GctInternHtMiss > getInternalHtMiss() const
get the Et sums in internal component format
Definition: L1GctWheelJetFpga.cc:223
L1GctWheelJetFpga::MAX_LEAF_CARDS
static const unsigned int MAX_LEAF_CARDS
Max number of leaf card pointers.
Definition: L1GctWheelJetFpga.h:39
L1GctWheelJetFpga::resetProcessor
void resetProcessor() override
Separate reset methods for the processor itself and any data stored in pipelines.
Definition: L1GctWheelJetFpga.cc:141
L1GctWheelJetFpga::m_centralJetSorter
L1GctJetSorter * m_centralJetSorter
Jet sorters.
Definition: L1GctWheelJetFpga.h:112
L1GctProcessor::bxAbs
int bxAbs() const
Definition: L1GctProcessor.h:80
L1GctWheelJetFpga::m_inputHx
std::vector< htComponentType > m_inputHx
Definition: L1GctWheelJetFpga.h:125
L1GctJetFinderBase.h
L1GctWheelJetFpga::m_inputJets
JetVector m_inputJets
input data. Jets 0-5 from leaf card 0, jetfinderA. Jets 6-11 from leaf card 0, jetfinder B....
Definition: L1GctWheelJetFpga.h:117
L1GctWheelJetFpga::storeJets
void storeJets(const JetVector &jets, unsigned short iLeaf, unsigned short offset)
Puts the output from a jetfinder into the correct index range of the m_inputJets array.
Definition: L1GctWheelJetFpga.cc:236
L1GctWheelJetFpga::fetchInput
void fetchInput() override
get input data from sources
Definition: L1GctWheelJetFpga.cc:159
L1GctWheelJetFpga::m_inputHfSums
std::vector< hfTowerSumsType > m_inputHfSums
Definition: L1GctWheelJetFpga.h:129
L1GctWheelJetFpga::JetVector
std::vector< L1GctJetCand > JetVector
Definition: L1GctWheelJetFpga.h:31
L1GctWheelJetFpga::checkSetup
bool checkSetup() const
Check the setup, independently of how we have been constructed.
Definition: L1GctWheelJetFpga.cc:48
L1GctWheelJetFpga::m_outputHyPipe
Pipeline< htComponentType > m_outputHyPipe
Definition: L1GctWheelJetFpga.h:142
L1GctWheelJetFpga::m_id
int m_id
algo ID
Definition: L1GctWheelJetFpga.h:106
edm::LogWarning
Definition: MessageLogger.h:141
L1GctWheelJetFpga.h
edm::LogError
Definition: MessageLogger.h:183
operator<<
std::ostream & operator<<(std::ostream &os, const L1GctWheelJetFpga &fpga)
Definition: L1GctWheelJetFpga.cc:94
L1GctProcessor::m_verbose
bool m_verbose
Flag to control output messages.
Definition: L1GctProcessor.h:109
L1GctWheelJetFpga::MAX_JETS_IN
static const int MAX_JETS_IN
Maximum number of jets we can have as input.
Definition: L1GctWheelJetFpga.h:103
L1GctJetSorter
Definition: L1GctJetSorter.h:8
L1GctProcessor::bxMin
int bxMin() const
Support for multiple beam crossing operation.
Definition: L1GctProcessor.h:77
L1GctJetLeafCard::MAX_JET_FINDERS
static const int MAX_JET_FINDERS
Number of jetfinders per jet leaf card.
Definition: L1GctJetLeafCard.h:34
L1GctWheelJetFpga::MAX_JETS_OUT
static const int MAX_JETS_OUT
Max number of jets of each type we output.
Definition: L1GctWheelJetFpga.h:36
L1GctWheelJetFpga::m_rawForwardJets
JetVector m_rawForwardJets
Definition: L1GctWheelJetFpga.h:121
L1GctWheelJetFpga
Represents a GCT Wheel Jet FPGA.
Definition: L1GctWheelJetFpga.h:29
L1GctWheelJetFpga::setInputJet
void setInputJet(int i, const L1GctJetCand &jet)
set input data
Definition: L1GctWheelJetFpga.cc:210
L1GctWheelJetFpga::m_outputHx
htComponentType m_outputHx
Definition: L1GctWheelJetFpga.h:137
L1GctJetFinderBase::hfTowerSumsType::reset
void reset()
Definition: L1GctJetFinderBase.h:91
L1GctWheelJetFpga::m_inputLeafCards
std::vector< L1GctJetLeafCard * > m_inputLeafCards
the jet leaf cards
Definition: L1GctWheelJetFpga.h:109
L1GctInternHtMiss::emulatorMissHtx
static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x component object from emulator.
Definition: L1GctInternHtMiss.cc:64
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
metsig::jet
Definition: SignAlgoResolutions.h:47
L1GctJetSorter::setJets
void setJets(JetVector &inputJets)
Definition: L1GctJetSorter.cc:10
L1GctWheelJetFpga::m_rawCentralJets
JetVector m_rawCentralJets
Definition: L1GctWheelJetFpga.h:120
L1GctJetLeafCard.h
L1GctWheelJetFpga::~L1GctWheelJetFpga
~L1GctWheelJetFpga() override
destructor
Definition: L1GctWheelJetFpga.cc:85
mps_fire.result
result
Definition: mps_fire.py:303
L1GctWheelJetFpga::L1GctWheelJetFpga
L1GctWheelJetFpga(int id, const std::vector< L1GctJetLeafCard * > &inputLeafCards)
id must be 0 / 1 for -ve/+ve eta halves of CMS
Definition: L1GctWheelJetFpga.cc:16
L1GctWheelJetFpga::m_centralJets
JetVector m_centralJets
Definition: L1GctWheelJetFpga.h:132
L1GctWheelJetFpga::m_tauJetSorter
L1GctJetSorter * m_tauJetSorter
Definition: L1GctWheelJetFpga.h:114
L1GctProcessor
ABC for a GCT trigger data processing unit.
Definition: L1GctProcessor.h:22
L1GctWheelJetFpga::setupJetsVectors
void setupJetsVectors(const int16_t bx)
Initialises all the jet vectors with jets of the correct type.
Definition: L1GctWheelJetFpga.cc:275
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78
L1GctWheelJetFpga::MAX_JETS_PER_LEAF
static const unsigned int MAX_JETS_PER_LEAF
Max number of jets input from each leaf card.
Definition: L1GctWheelJetFpga.h:42
L1GctTwosComplement::reset
void reset()
reset value and overflow to zero
Definition: L1GctTwosComplement.h:132