CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <boost/cstdint.hpp>
6 
7 namespace ecalMGPA {
8  typedef uint16_t sample_type;
9 
11  inline int adc(sample_type sample) { return sample&0xFFF; }
13  inline int gainId(sample_type sample) { return (sample>>12)&0x3; }
14  inline sample_type pack(int adc, int gainId) {
15  return (adc&0xFFF) | ((gainId&0x3)<<12);
16  }
17 }
18 
19 
27  public:
30  EcalMGPASample(int adc, int gainId);
31 
33  uint16_t raw() const { return theSample; }
35  int adc() const { return theSample&0xFFF; }
37  int gainId() const { return (theSample>>12)&0x3; }
39  uint16_t operator()() const { return theSample; }
40  operator uint16_t () const { return theSample; }
41 
42  private:
43  uint16_t theSample;
44 };
45 
46 std::ostream& operator<<(std::ostream&, const EcalMGPASample&);
47 
48 
49 
50 #endif
int adc(sample_type sample)
get the ADC sample (12 bits)
int gainId(sample_type sample)
get the gainId (2 bits)
uint16_t theSample
uint16_t raw() const
get the raw word
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
sample_type pack(int adc, int gainId)
int gainId() const
get the gainId (2 bits)
EcalMGPASample(uint16_t data)
uint16_t operator()() const
for streaming
uint16_t sample_type
Definition: EcalMGPASample.h:8
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int adc() const
get the ADC sample (12 bits)