CMS 3D CMS Logo

EcalEBPhase2TriggerPrimitiveDigi.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <algorithm>
4 
5 static constexpr int MAXSAMPLES = 20;
6 // This is the number of digi samples one wants to put in the TP digis. In Phase I was 5, but this setting was used. In the end in Phase I one one sample, corresponding to BC0 was filled. For Phase2 we have not decided yet. We leave this setting as it is while we decide what to do
7 
9 
11  : id_(id), size_(0), data_(MAXSAMPLES) {}
12 
14  data_[i] = sam;
15 }
16 
18  // sample of interest to be save in the TP digis
19  if (size_ == 1)
20  return 0;
21  else if (size_ == 5)
22  return 2;
23  else
24  return -1;
25 }
26 
29  int sample = sampleOfInterest();
30  if (sample != -1)
31  return data_[sample].encodedEt();
32  else
33  return -1;
34 }
35 
37  int sample = sampleOfInterest();
38  if (sample != -1)
39  return data_[sample].l1aSpike();
40  else
41  return -1;
42 }
43 
45  int sample = sampleOfInterest();
46  if (sample != -1)
47  return data_[sample].time();
48  else
49  return -1;
50 }
51 
52 bool EcalEBPhase2TriggerPrimitiveDigi::isDebug() const { return (size_ > 1); }
53 
55 
56 std::ostream& operator<<(std::ostream& s, const EcalEBPhase2TriggerPrimitiveDigi& digi) {
57  s << digi.id() << " " << digi.size() << " samples " << std::endl;
58  for (int i = 0; i < digi.size(); i++)
59  s << " " << digi.sample(i) << std::endl;
60  return s;
61 }
size
Write out results.
void setSample(int i, const EcalEBPhase2TriggerPrimitiveSample &sam)
int sampleOfInterest() const
Gets the interesting sample.
int encodedEt() const
get the 12 bits Et of interesting sample
const EcalEBPhase2TriggerPrimitiveSample & sample(int i) const
static constexpr int MAXSAMPLES
std::vector< EcalEBPhase2TriggerPrimitiveSample > data_
std::ostream & operator<<(std::ostream &s, const EcalEBPhase2TriggerPrimitiveDigi &digi)
bool isDebug() const
True if debug mode (# of samples > 1)