CMS 3D CMS Logo

CSCStripDigi.h
Go to the documentation of this file.
1 #ifndef CSCStripDigi_CSCStripDigi_h
2 #define CSCStripDigi_CSCStripDigi_h
3 
13 #include <vector>
14 #include <iosfwd>
15 #include <cstdint>
16 
18 
19 public:
20 
21  // Construct from the strip number and all the other data members.
22  CSCStripDigi (const int & istrip, const std::vector<int> & vADCCounts, const std::vector<uint16_t> & vADCOverflow, const std::vector<uint16_t> & vOverlap,
23  const std::vector<uint16_t> & vErrorstat ) :
24  strip(istrip),
25  ADCCounts(vADCCounts),
26  ADCOverflow(vADCOverflow),
27  OverlappedSample(vOverlap),
28  Errorstat(vErrorstat) {}
29 
30  // Construct from the strip number and the ADC readings.
31  CSCStripDigi (const int & istrip, const std::vector<int> & vADCCounts):
32  strip(istrip),
33  ADCCounts(vADCCounts),
34  ADCOverflow(8,0),
35  OverlappedSample(8,0),
36  Errorstat(8,0){}
37 
38 
40  strip(0),
41  ADCCounts(8,0),
42  ADCOverflow(8,0),
43  OverlappedSample(8,0),
44  Errorstat(8,0){}
45 
46 
47  // Digis are equal if they are on the same strip and have same ADC readings
48  bool operator==(const CSCStripDigi& digi) const;
49 
50  // Get the strip number. counts from 1.
51  int getStrip() const { return strip;}
52 
54  std::vector<int> const & getADCCounts() const { return ADCCounts; }
55 
56 
58  std::vector<int> getL1APhase() const {
59  std::vector<int> L1APhaseResult(getOverlappedSample().size());
60  for (int i=0; i<(int)getOverlappedSample().size(); i++)
61  L1APhaseResult[i] = (getOverlappedSample()[i]>>8) & 0x1;
62  return L1APhaseResult;
63  }
64 
65  int getL1APhase(int i) const {
66  return (getOverlappedSample()[i]>>8) & 0x1;
67  }
68 
70  std::vector<uint16_t> const & getADCOverflow() const {return ADCOverflow;}
71  std::vector<uint16_t> const & getOverlappedSample() const {return OverlappedSample;}
72  std::vector<uint16_t> const & getErrorstat() const {return Errorstat;}
73 
74  // Set the strip number
75  void setStrip(int istrip) { strip = istrip; }
76 
77  // Set with a vector of ADC readings
78  void setADCCounts (const std::vector<int>& ADCCounts);
79 
80  // Print content of digi
81  void print() const;
82 
84  float pedestal() const {return 0.5f*(ADCCounts[0]+ADCCounts[1]);}
85  float amplitude() const {return ADCCounts[4]-pedestal();}
86 
87 private:
88 
89  uint16_t strip;
90  std::vector<int> ADCCounts;
91  std::vector<uint16_t> ADCOverflow;
92  std::vector<uint16_t> OverlappedSample;
93  std::vector<uint16_t> Errorstat;
94 };
95 
96 std::ostream & operator<<(std::ostream & o, const CSCStripDigi& digi);
97 
98 #endif
99 
std::vector< int > getL1APhase() const
Get L1APhase from OverlappedSample (9th bit)
Definition: CSCStripDigi.h:58
size
Write out results.
std::vector< uint16_t > const & getOverlappedSample() const
Definition: CSCStripDigi.h:71
std::vector< uint16_t > OverlappedSample
Definition: CSCStripDigi.h:92
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)
Definition: CSCStripDigi.h:22
std::vector< int > const & getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.h:54
std::vector< uint16_t > Errorstat
Definition: CSCStripDigi.h:93
std::vector< int > ADCCounts
Definition: CSCStripDigi.h:90
float pedestal() const
methods for calibrations
Definition: CSCStripDigi.h:84
void setADCCounts(const std::vector< int > &ADCCounts)
Definition: CSCStripDigi.cc:23
int getStrip() const
Definition: CSCStripDigi.h:51
std::vector< uint16_t > ADCOverflow
Definition: CSCStripDigi.h:91
CSCStripDigi(const int &istrip, const std::vector< int > &vADCCounts)
Definition: CSCStripDigi.h:31
std::vector< uint16_t > const & getADCOverflow() const
Other getters.
Definition: CSCStripDigi.h:70
void setStrip(int istrip)
Definition: CSCStripDigi.h:75
std::ostream & operator<<(std::ostream &o, const CSCStripDigi &digi)
Definition: CSCStripDigi.cc:51
std::vector< uint16_t > const & getErrorstat() const
Definition: CSCStripDigi.h:72
void print() const
Definition: CSCStripDigi.cc:38
bool operator==(const CSCStripDigi &digi) const
Definition: CSCStripDigi.cc:14
uint16_t strip
Definition: CSCStripDigi.h:89
float amplitude() const
Definition: CSCStripDigi.h:85
int getL1APhase(int i) const
Definition: CSCStripDigi.h:65