CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctGlobalHfSumAlgos.cc
Go to the documentation of this file.
2 
4 
8 
10 
11 L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos(const std::vector<L1GctWheelJetFpga*>& wheelJetFpga) :
13  m_plusWheelJetFpga(wheelJetFpga.at(1)),
14  m_minusWheelJetFpga(wheelJetFpga.at(0)),
15  m_bitCountLuts(), m_etSumLuts(),
16  m_hfInputSumsPlusWheel(),
17  m_hfInputSumsMinusWheel(),
18  m_hfOutputSumsPipe(),
19  m_setupOk(true)
20 {
21  if(wheelJetFpga.size() != 2)
22  {
23  m_setupOk = false;
24  if (m_verbose) {
25  edm::LogWarning("L1GctSetupError")
26  << "L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos() : Global HfSum Algos has been incorrectly constructed!\n"
27  << "This class needs two wheel jet fpga pointers. "
28  << "Number of wheel jet fpga pointers present is " << wheelJetFpga.size() << ".\n";
29  }
30  }
31 
32  if(m_plusWheelJetFpga == 0)
33  {
34  m_setupOk = false;
35  if (m_verbose) {
36  edm::LogWarning("L1GctSetupError")
37  << "L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos() has been incorrectly constructed!\n"
38  << "Plus Wheel Jet Fpga pointer has not been set!\n";
39  }
40  }
41  if(m_minusWheelJetFpga == 0)
42  {
43  m_setupOk = false;
44  if (m_verbose) {
45  edm::LogWarning("L1GctSetupError")
46  << "L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos() has been incorrectly constructed!\n"
47  << "Minus Wheel Jet Fpga pointer has not been set!\n";
48  }
49  }
50 
51  if (!m_setupOk && m_verbose) {
52  edm::LogError("L1GctSetupError") << "L1GctGlobalEnergyAlgos has been incorrectly constructed";
53  }
54 }
55 
57 {
58  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*>::const_iterator bclut = m_bitCountLuts.begin();
59  while (bclut != m_bitCountLuts.end()) {
60  delete bclut->second;
61  bclut++;
62  }
63  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*>::const_iterator eslut = m_etSumLuts.begin();
64  while (eslut != m_etSumLuts.end()) {
65  delete eslut->second;
66  eslut++;
67  }
68 }
69 
70 std::ostream& operator << (std::ostream& os, const L1GctGlobalHfSumAlgos& fpga)
71 {
72  os << "===L1GctGlobalHfSumAlgos===" << std::endl;
73  os << "WheelJetFpga* plus = " << fpga.m_plusWheelJetFpga << std::endl;
74  os << "Plus wheel inputs:" << std::endl;
75  os << "Bit counts ring 1: " << fpga.m_hfInputSumsPlusWheel.nOverThreshold0
76  << ", ring 2: " << fpga.m_hfInputSumsPlusWheel.nOverThreshold1 << std::endl;
77  os << "Et sums ring 1: " << fpga.m_hfInputSumsPlusWheel.etSum0
78  << ", ring 2: " << fpga.m_hfInputSumsPlusWheel.etSum1 << std::endl;
79  os << "WheelJetFpga* minus = " << fpga.m_minusWheelJetFpga << std::endl;
80  os << "Minus wheel inputs:" << std::endl;
81  os << "Bit counts ring 1: " << fpga.m_hfInputSumsMinusWheel.nOverThreshold0
82  << ", ring 2: " << fpga.m_hfInputSumsMinusWheel.nOverThreshold1 << std::endl;
83  os << "Et sums ring 1: " << fpga.m_hfInputSumsMinusWheel.etSum0
84  << ", ring 2: " << fpga.m_hfInputSumsMinusWheel.etSum1 << std::endl;
85 
86  int bxZero = -fpga.bxMin();
87  if (bxZero>=0 && bxZero<fpga.numOfBx()) {
88  os << "Output word " << std::hex << fpga.hfSumsWord().at(bxZero) << std::dec << std::endl;
89  }
90 
91  return os;
92 }
93 
97 }
98 
100  m_hfOutputSumsPipe.clear();
102  // Make one copy of the empty pipeline for each type of Hf lut
103  unsigned nTypes = (unsigned) L1GctHfEtSumsLut::numberOfLutTypes;
104  for (unsigned t=0; t<nTypes; ++t) {
106  }
107 }
108 
110  if (m_setupOk) {
113  }
114 }
115 
116 
117 // process the event
119 {
120  if (m_setupOk) {
121  // step through the different types of Hf summed quantity
122  // and store each one in turn into the relevant pipeline
123 
124  // bit count, positive eta, ring 1
126 
127  // bit count, negative eta, ring 1
129 
130  // bit count, positive eta, ring 2
132 
133  // bit count, negative eta, ring 2
135 
136  // et sum, positive eta, ring 1
138 
139  // et sum, negative eta, ring 1
141 
142  // et sum, positive eta, ring 2
144 
145  // et sum, negative eta, ring 2
147 
148  }
149 }
150 
151 // Convert bit count value using LUT and store in the pipeline
153  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*>::const_iterator bclut = m_bitCountLuts.find(type);
154  if (bclut != m_bitCountLuts.end()) {
155  m_hfOutputSumsPipe[type].store( (*bclut->second)[value], bxRel() );
156  }
157 }
158 
159 // Convert et sum value using LUT and store in the pipeline
161  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*>::const_iterator eslut = m_etSumLuts.find(type);
162  if (eslut != m_etSumLuts.end()) {
163  m_hfOutputSumsPipe[type].store( (*eslut->second)[value], bxRel() );
164  }
165 }
166 
167 
168 
171 {
172  std::vector<uint16_t> result(numOfBx());
173  std::map<L1GctHfEtSumsLut::hfLutType, Pipeline<uint16_t> >::const_iterator lut=m_hfOutputSumsPipe.find(type);
174  if (lut != m_hfOutputSumsPipe.end()) {
175  result = (lut->second).contents;
176  }
177 
178  return result;
179 
180 }
181 
182 std::vector<unsigned> L1GctGlobalHfSumAlgos::hfSumsWord() const {
183  std::vector<unsigned> result(numOfBx(), 0x00001000);
184  std::vector<uint16_t> outputBits;
185 
187  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx); }
188 
190  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 3; }
191 
193  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 6; }
194 
196  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 9; }
197 
199  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 12; }
200 
202  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 16; }
203 
205  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 19; }
206 
208  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 22; }
209 
210  return result;
211 }
212 
215 {
216  // Replaces existing list of luts with a new one
217  while (!m_bitCountLuts.empty()) {
218  delete m_bitCountLuts.begin()->second;
219  m_bitCountLuts.erase(m_bitCountLuts.begin());
220  }
225 
226  while (!m_etSumLuts.empty()) {
227  delete m_etSumLuts.begin()->second;
228  m_etSumLuts.erase(m_etSumLuts.begin());
229  }
234 
235 }
236 
239 {
240  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*>::const_iterator bclut = m_bitCountLuts.find(type);
241  if (bclut != m_bitCountLuts.end()) {
242  return (bclut->second);
243  } else {
244  return 0;
245  }
246 }
247 
249 {
250  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*>::const_iterator eslut = m_etSumLuts.find(type);
251  if (eslut != m_etSumLuts.end()) {
252  return (eslut->second);
253  } else {
254  return 0;
255  }
256 }
257 
260 {
261  std::vector<double> result;
262  const L1GctHfEtSumsLut* ESLut = getESLut(type);
263  if (ESLut != 0) { result = ESLut->lutFunction()->getThresholds(); }
264  return result;
265 }
266 
type
Definition: HCALResponse.h:21
std::vector< unsigned > hfSumsWord() const
L1GctWheelJetFpga * m_minusWheelJetFpga
std::map< L1GctHfEtSumsLut::hfLutType, Pipeline< uint16_t > > m_hfOutputSumsPipe
Emulates the GCT summing and packing of Hf Et sums and tower-over-threshold counts.
~L1GctGlobalHfSumAlgos()
Destructor.
bool m_verbose
Flag to control output messages.
hfTowerSumsType m_hfInputSumsPlusWheel
int bxRel() const
L1GctGlobalHfSumAlgos(const std::vector< L1GctWheelJetFpga * > &WheelJetFpga)
Constructor needs the Wheel card Fpgas set up first.
int bxMin() const
Support for multiple beam crossing operation.
virtual void fetchInput()
get input data from sources; this is the standard way to provide input
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int numOfBx() const
const L1CaloEtScale * lutFunction() const
Return the Lut function.
hfTowerSumsType m_hfInputSumsMinusWheel
ABC for a GCT trigger data processing unit.
unsigned value() const
access value as unsigned
std::map< L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut * > m_etSumLuts
const L1GctHfBitCountsLut * getBCLut(const L1GctHfEtSumsLut::hfLutType type) const
Get lut pointers.
const std::vector< double > & getThresholds() const
get thresholds
Definition: L1CaloEtScale.h:65
L1GctWheelJetFpga * m_plusWheelJetFpga
LUT for compression of HF feature bit counts to output format.
tuple result
Definition: query.py:137
void storeEtSum(L1GctHfEtSumsLut::hfLutType type, uint16_t value)
L1GctJetCount< kHfEtSumBits > etSum0
std::vector< uint16_t > hfSumsOutput(const L1GctHfEtSumsLut::hfLutType type) const
Access to output quantities.
LUT for compression of HF Et sum to output format.
virtual void process()
process the data, fill output buffers
tuple lut
Definition: lumiPlot.py:244
std::map< L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut * > m_bitCountLuts
L1GctJetCount< kHfCountBits > nOverThreshold1
hfTowerSumsType getOutputHfSums() const
get the output Hf Sums
const L1GctHfEtSumsLut * getESLut(const L1GctHfEtSumsLut::hfLutType type) const
std::vector< double > getThresholds(const L1GctHfEtSumsLut::hfLutType type) const
Get thresholds.
L1GctJetCount< kHfEtSumBits > etSum1
virtual void resetProcessor()
Separate reset methods for the processor itself and any data stored in pipelines. ...
void setupLuts(const L1CaloEtScale *scale)
Setup luts.
void storeBitCount(L1GctHfEtSumsLut::hfLutType type, uint16_t value)
L1GctJetCount< kHfCountBits > nOverThreshold0