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 
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  std::vector<int> const& getADCCounts() const { return ADCCounts; }
45 
47  std::vector<int> getL1APhase() const {
48  std::vector<int> L1APhaseResult(getOverlappedSample().size());
49  for (int i = 0; i < (int)getOverlappedSample().size(); i++)
50  L1APhaseResult[i] = (getOverlappedSample()[i] >> 8) & 0x1;
51  return L1APhaseResult;
52  }
53 
54  int getL1APhase(int i) const { return (getOverlappedSample()[i] >> 8) & 0x1; }
55 
57  std::vector<uint16_t> const& getADCOverflow() const { return ADCOverflow; }
58  std::vector<uint16_t> const& getOverlappedSample() const { return OverlappedSample; }
59  std::vector<uint16_t> const& getErrorstat() const { return Errorstat; }
60 
61  // Set the strip number
62  void setStrip(int istrip) { strip = istrip; }
63 
64  // Set with a vector of ADC readings
65  void setADCCounts(const std::vector<int>& ADCCounts);
66 
67  // Print content of digi
68  void print() const;
69 
71  float pedestal() const { return 0.5f * (ADCCounts[0] + ADCCounts[1]); }
72  float amplitude() const { return ADCCounts[4] - pedestal(); }
73 
74 private:
75  uint16_t strip;
76  std::vector<int> ADCCounts;
77  std::vector<uint16_t> ADCOverflow;
78  std::vector<uint16_t> OverlappedSample;
79  std::vector<uint16_t> Errorstat;
80 };
81 
82 std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi);
83 
84 #endif
CSCStripDigi::getADCOverflow
std::vector< uint16_t > const & getADCOverflow() const
Other getters.
Definition: CSCStripDigi.h:57
mps_fire.i
i
Definition: mps_fire.py:428
CSCStripDigi::getL1APhase
std::vector< int > getL1APhase() const
Get L1APhase from OverlappedSample (9th bit)
Definition: CSCStripDigi.h:47
CSCStripDigi::OverlappedSample
std::vector< uint16_t > OverlappedSample
Definition: CSCStripDigi.h:78
CSCStripDigi::getL1APhase
int getL1APhase(int i) const
Definition: CSCStripDigi.h:54
CSCStripDigi::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)
Definition: CSCStripDigi.h:20
CSCStripDigi::getStrip
int getStrip() const
Definition: CSCStripDigi.h:41
operator<<
std::ostream & operator<<(std::ostream &o, const CSCStripDigi &digi)
Definition: CSCStripDigi.cc:58
CSCStripDigi::ADCCounts
std::vector< int > ADCCounts
Definition: CSCStripDigi.h:76
CSCStripDigi::getOverlappedSample
std::vector< uint16_t > const & getOverlappedSample() const
Definition: CSCStripDigi.h:58
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
CSCStripDigi::ADCOverflow
std::vector< uint16_t > ADCOverflow
Definition: CSCStripDigi.h:77
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
CSCStripDigi::setADCCounts
void setADCCounts(const std::vector< int > &ADCCounts)
Definition: CSCStripDigi.cc:22
CSCStripDigi::CSCStripDigi
CSCStripDigi()
Definition: CSCStripDigi.h:35
CSCStripDigi::CSCStripDigi
CSCStripDigi(const int &istrip, const std::vector< int > &vADCCounts)
Definition: CSCStripDigi.h:32
CSCStripDigi::strip
uint16_t strip
Definition: CSCStripDigi.h:75
CSCStripDigi::operator==
bool operator==(const CSCStripDigi &digi) const
Definition: CSCStripDigi.cc:12
CSCStripDigi::Errorstat
std::vector< uint16_t > Errorstat
Definition: CSCStripDigi.h:79
CSCStripDigi::getErrorstat
std::vector< uint16_t > const & getErrorstat() const
Definition: CSCStripDigi.h:59
createfilelist.int
int
Definition: createfilelist.py:10
CSCStripDigi::getADCCounts
std::vector< int > const & getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.h:44
CSCStripDigi::print
void print() const
Definition: CSCStripDigi.cc:37
CSCStripDigi::pedestal
float pedestal() const
methods for calibrations
Definition: CSCStripDigi.h:71
CSCStripDigi
Definition: CSCStripDigi.h:17
CSCStripDigi::setStrip
void setStrip(int istrip)
Definition: CSCStripDigi.h:62
CSCStripDigi::amplitude
float amplitude() const
Definition: CSCStripDigi.h:72
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443