Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:04

0001 #ifndef DIGIECAL_ECALFEMSAMPLE_H
0002 #define DIGIECAL_ECALFEMSAMPLE_H
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /** \class EcalFEMSample
0008  *  Simple container packer/unpacker for a single sample from the FEM electronics
0009  *
0010  *
0011  *  $Id: 
0012  */
0013 
0014 class EcalFEMSample {
0015 public:
0016   EcalFEMSample() { theSample = 0; }
0017   EcalFEMSample(uint16_t data) { theSample = data; }
0018   EcalFEMSample(int adc, int gainId);
0019 
0020   /// get the raw word
0021   uint16_t raw() const { return theSample; }
0022   /// get the ADC sample (12 bits)
0023   int adc() const { return theSample & 0xFFF; }
0024   /// get the gainId (2 bits)
0025   int gainId() const { return (theSample >> 12) & 0x3; }
0026   /// for streaming
0027   uint16_t operator()() { return theSample; }
0028 
0029 private:
0030   uint16_t theSample;
0031 };
0032 
0033 std::ostream& operator<<(std::ostream&, const EcalFEMSample&);
0034 
0035 #endif