CMS 3D CMS Logo

EcalLiteDTUSample.h
Go to the documentation of this file.
1 #ifndef DataFormats_EcalDigi_EcalLiteDTUSample_h
2 #define DataFormats_EcalDigi_EcalLiteDTUSample_h
3 
4 #include <iosfwd>
5 #include <cstdint>
7 
8 namespace ecalLiteDTU {
9  typedef uint16_t sample_type;
10 
12  constexpr int adc(sample_type sample) { return sample & ecalPh2::kAdcMask; }
15  constexpr sample_type pack(int adc, int gainId) {
17  }
18 } // namespace ecalLiteDTU
19 
26 public:
29  EcalLiteDTUSample(int adc, int gainId);
30 
32  uint16_t raw() const { return theSample; }
34  int adc() const { return theSample & ecalPh2::kAdcMask; }
36  int gainId() const { return (theSample >> ecalPh2::NBITS) & ecalPh2::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 EcalLiteDTUSample&);
46 
47 #endif
EcalLiteDTUSample(uint16_t data)
constexpr sample_type pack(int adc, int gainId)
uint16_t raw() const
get the raw word
static constexpr unsigned int kGainIdMask
Definition: EcalConstants.h:45
int adc() const
get the ADC sample (12 bits)
std::ostream & operator<<(std::ostream &, const EcalLiteDTUSample &)
static constexpr unsigned int kAdcMask
Definition: EcalConstants.h:44
int gainId() const
get the gainId (2 bits)
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
static constexpr unsigned int NBITS
Definition: EcalConstants.h:37
uint16_t operator()() const
for streaming
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
uint16_t sample_type
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)