CMS 3D CMS Logo

EcalEBTriggerPrimitiveDigi.cc
Go to the documentation of this file.
2 #include <iostream>
3 
5 //EcalTriggerPrimitiveDigi::EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id) : id_(id),
6 //size_(0), data_(MAXSAMPLES) {
7 //}
8 
9 EcalEBTriggerPrimitiveDigi::EcalEBTriggerPrimitiveDigi(const EBDetId& id) : id_(id), size_(0), data_(MAXSAMPLES) {}
10 
12  // std::cout << " In setSample i " << i << " sam " << sam << std::endl;
13  data_[i] = sam;
14  // std::cout << " In setSample data_[i] " << data_[i] << std::endl;
15 }
16 
18  if (size_ == 1)
19  return 0;
20  else if (size_ == 5)
21  return 2;
22  else
23  return -1;
24 }
25 
28  int sample = sampleOfInterest();
29  if (sample != -1)
30  return data_[sample].encodedEt();
31  else
32  return -1;
33 }
34 
36  int sample = sampleOfInterest();
37  if (sample != -1)
38  return data_[sample].l1aSpike();
39  else
40  return -1;
41 }
42 
44  int sample = sampleOfInterest();
45  if (sample != -1)
46  return data_[sample].time();
47  else
48  return -1;
49 }
50 
52  if (size_ == 1)
53  return false;
54  else if (size_ > 1)
55  return true;
56  return false;
57 }
58 
60  if (size < 0)
61  size_ = 0;
62  else if (size > MAXSAMPLES)
63  size_ = MAXSAMPLES;
64  else
65  size_ = size;
66 }
67 
68 std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveDigi& digi) {
69  s << digi.id() << " " << digi.size() << " samples " << std::endl;
70  for (int i = 0; i < digi.size(); i++)
71  s << " " << digi.sample(i) << std::endl;
72  return s;
73 }
size
Write out results.
std::ostream & operator<<(std::ostream &s, const EcalEBTriggerPrimitiveDigi &digi)
int sampleOfInterest() const
Gets the interesting sample.
std::vector< EcalEBTriggerPrimitiveSample > data_
void setSample(int i, const EcalEBTriggerPrimitiveSample &sam)
bool isDebug() const
True if debug mode (# of samples > 1)
int encodedEt() const
get the 10 bits Et of interesting sample
const EcalEBTriggerPrimitiveSample & sample(int i) const