CMS 3D CMS Logo

EcalMGPASample.h
Go to the documentation of this file.
1 #ifndef DIGIECAL_ECALMGPASAMPLE_H
2 #define DIGIECAL_ECALMGPASAMPLE_H
3 
4 #include <iosfwd>
5 #include <cstdint>
6 
7 namespace ecalMGPA {
8  typedef uint16_t sample_type;
9 
11  constexpr int adc(sample_type sample) { return sample & 0xFFF; }
13  constexpr int gainId(sample_type sample) { return (sample >> 12) & 0x3; }
14  constexpr sample_type pack(int adc, int gainId) { return (adc & 0xFFF) | ((gainId & 0x3) << 12); }
15 } // namespace ecalMGPA
16 
23 public:
25  EcalMGPASample(uint16_t data) { theSample = data; }
26  EcalMGPASample(int adc, int gainId);
27 
29  uint16_t raw() const { return theSample; }
31  int adc() const { return theSample & 0xFFF; }
33  int gainId() const { return (theSample >> 12) & 0x3; }
35  uint16_t operator()() const { return theSample; }
36  operator uint16_t() const { return theSample; }
37 
38 private:
39  uint16_t theSample;
40 };
41 
42 std::ostream& operator<<(std::ostream&, const EcalMGPASample&);
43 
44 #endif
EcalMGPASample::EcalMGPASample
EcalMGPASample()
Definition: EcalMGPASample.h:24
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
EcalMGPASample::theSample
uint16_t theSample
Definition: EcalMGPASample.h:39
ecalMGPA::pack
constexpr sample_type pack(int adc, int gainId)
Definition: EcalMGPASample.h:14
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
EcalMGPASample::gainId
int gainId() const
get the gainId (2 bits)
Definition: EcalMGPASample.h:33
EcalMGPASample::adc
int adc() const
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:31
EcalMGPASample::operator()
uint16_t operator()() const
for streaming
Definition: EcalMGPASample.h:35
EcalMGPASample::raw
uint16_t raw() const
get the raw word
Definition: EcalMGPASample.h:29
EcalMGPASample::EcalMGPASample
EcalMGPASample(uint16_t data)
Definition: EcalMGPASample.h:25
EcalMGPASample
Definition: EcalMGPASample.h:22
ecalMGPA::sample_type
uint16_t sample_type
Definition: EcalMGPASample.h:8
ecalMGPA
Definition: EcalMGPASample.h:7
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ecalMGPA::gainId
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
Definition: EcalMGPASample.h:13
operator<<
std::ostream & operator<<(std::ostream &, const EcalMGPASample &)
Definition: EcalMGPASample.cc:6