CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCStripDigi.cc
Go to the documentation of this file.
1 
9 #include <iostream>
10 #include <stdint.h>
11 
12 // Constructors
13 CSCStripDigi::CSCStripDigi (const int & istrip, const std::vector<int> & vADCCounts, const std::vector<uint16_t> & vADCOverflow, const std::vector<uint16_t> & vOverlap, const std::vector<uint16_t> & vErrorstat ):
14  strip(istrip),
15  ADCCounts(vADCCounts),
16  ADCOverflow(vADCOverflow),
17  OverlappedSample(vOverlap),
18  Errorstat(vErrorstat)
19 {
20 }
21 
22 CSCStripDigi::CSCStripDigi (const int & istrip, const std::vector<int> & vADCCounts):
23  strip(istrip),
24  ADCCounts(vADCCounts),
25  ADCOverflow(8,0),
26  OverlappedSample(8,0),
27  Errorstat(8,0)
28 {
29 }
30 
31 
33  strip(0),
34  ADCCounts(8,0),
35  ADCOverflow(8,0),
36  OverlappedSample(8,0),
37  Errorstat(8,0)
38 {
39 }
40 
41 std::vector<int> CSCStripDigi::getADCCounts() const { return ADCCounts; }
42 
43 
45 std::vector<int> CSCStripDigi::getL1APhase() const {
46  std::vector<int> L1APhaseResult;
47  for (int i=0; i<(int)getOverlappedSample().size(); i++) {
48  L1APhaseResult.push_back((getOverlappedSample()[i]>>8) & 0x1);}
49  return L1APhaseResult;
50 }
51 
52 // Comparison
53 bool
55  if ( getStrip() != digi.getStrip() ) return false;
56  if ( getADCCounts().size() != digi.getADCCounts().size() ) return false;
57  if ( getADCCounts() != digi.getADCCounts() ) return false;
58  return true;
59 }
60 
61 // Getters
62 //int CSCStripDigi::getStrip() const { return strip; }
63 //std::vector<int> CSCStripDigi::getADCCounts() const { return ADCCounts; }
64 
65 
66 // Setters
67 //void CSCStripDigi::setStrip(int istrip) {
68 // strip = istrip;
69 //}
70 
71 
72 void CSCStripDigi::setADCCounts(std::vector<int>vADCCounts) {
73  bool badVal = false;
74  for (int i=0; i<(int)vADCCounts.size(); i++) {
75  if (vADCCounts[i] < 1) badVal = true;
76  }
77  if ( !badVal ) {
78  ADCCounts = vADCCounts;
79  } else {
80  std::vector<int> ZeroCounts(8,0);
81  ADCCounts = ZeroCounts;
82  }
83 }
84 
85 // Debug
86 void
88  std::cout << "CSC Strip: " << getStrip() << " ADC Counts: ";
89  for (int i=0; i<(int)getADCCounts().size(); i++) {std::cout << getADCCounts()[i] << " ";}
90  std::cout << "\n";
91  std::cout << " " << " ADCOverflow: ";
92  for (int i=0; i<(int)getADCOverflow().size(); i++) {std::cout << getADCOverflow()[i] << " ";}
93  std::cout << "\n";
94  std::cout << " " << " OverflappedSample: ";
95  for (int i=0; i<(int)getOverlappedSample().size(); i++) {
96  //if(getOverlappedSample()[i]!=1)
97  std::cout << getOverlappedSample()[i] << " ";}
98  std::cout << "\n";
99  std::cout << " " << " L1APhases: ";
100  for(int i=0; i<(int)getL1APhase().size(); i++){
101  std::cout << getL1APhase()[i] << " ";
102  }
103  std::cout << "\n";
104 }
105 
106 std::ostream & operator<<(std::ostream & o, const CSCStripDigi& digi) {
107  o << " " << digi.getStrip();
108  for (size_t i = 0; i<digi.getADCCounts().size(); ++i ){
109  o <<" " <<(digi.getADCCounts())[i]; }
110  return o;
111 
112 }
113 
114 
115 
int i
Definition: DBlmapReader.cc:9
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::vector< int > getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.cc:41
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
std::vector< int > ADCCounts
Definition: CSCStripDigi.h:68
int getStrip() const
Definition: CSCStripDigi.h:39
std::vector< int > getL1APhase() const
Get L1APhase from OverlappedSample (9th bit)
Definition: CSCStripDigi.cc:45
void setADCCounts(std::vector< int > ADCCounts)
Definition: CSCStripDigi.cc:72
std::vector< uint16_t > getADCOverflow() const
Other getters.
Definition: CSCStripDigi.h:48
void print() const
Definition: CSCStripDigi.cc:87
bool operator==(const CSCStripDigi &digi) const
Definition: CSCStripDigi.cc:54
std::vector< uint16_t > getOverlappedSample() const
Definition: CSCStripDigi.h:49
tuple cout
Definition: gather_cfg.py:121