CMS 3D CMS Logo

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