CMS 3D CMS Logo

EcalMGPASample.h
Go to the documentation of this file.
1 #ifndef DataFormats_EcalDigi_EcalMGPASample_h
2 #define DataFormats_EcalDigi_EcalMGPASample_h
3 
4 #include <iosfwd>
5 #include <cstdint>
7 
8 namespace ecalMGPA {
9  typedef uint16_t sample_type;
10 
12  constexpr int adc(sample_type sample) { return sample & ecalPh1::kAdcMask; }
15  constexpr sample_type pack(int adc, int gainId) {
17  }
18 } // namespace ecalMGPA
19 
26 public:
28  EcalMGPASample(uint16_t data) { theSample = data; }
29  EcalMGPASample(int adc, int gainId);
30 
32  uint16_t raw() const { return theSample; }
34  int adc() const { return theSample & ecalPh1::kAdcMask; }
36  int gainId() const { return (theSample >> ecalPh1::NBITS) & ecalPh1::kGainIdMask; }
38  uint16_t operator()() const { return theSample; }
39  operator uint16_t() const { return theSample; }
40 
41 private:
42  uint16_t theSample;
43 };
44 
45 std::ostream& operator<<(std::ostream&, const EcalMGPASample&);
46 
47 #endif
constexpr sample_type pack(int adc, int gainId)
uint16_t theSample
std::ostream & operator<<(std::ostream &, const EcalMGPASample &)
static constexpr unsigned int NBITS
Definition: EcalConstants.h:54
EcalMGPASample(uint16_t data)
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
uint16_t sample_type
Definition: EcalMGPASample.h:9
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static constexpr unsigned int kGainIdMask
Definition: EcalConstants.h:58
int adc() const
get the ADC sample (12 bits)
uint16_t operator()() const
for streaming
uint16_t raw() const
get the raw word
static constexpr unsigned int kAdcMask
Definition: EcalConstants.h:57
int gainId() const
get the gainId (2 bits)