CMS 3D CMS Logo

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