Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DIGIECAL_ECALTBTDCSAMPLE_H
0002 #define DIGIECAL_ECALTBTDCSAMPLE_H 1
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /** \class EcalTBTDCSample
0008  *  Simple container packer/unpacker for a single sample from the TB TDC raw data
0009  *
0010  *
0011  *  $Id: 
0012  */
0013 
0014 class EcalTBTDCSample {
0015 public:
0016   EcalTBTDCSample() { theSample = 0; }
0017   EcalTBTDCSample(uint32_t data) { theSample = data; }
0018   EcalTBTDCSample(unsigned int tdcChan, unsigned int tdcVal);
0019 
0020   /// get the raw word
0021   uint32_t raw() const { return theSample; }
0022   /// get the ADC sample (24 bits)
0023   unsigned int tdcValue() const { return theSample & 0xFFFFFF; }
0024   /// get the gainId (8 bits)
0025   unsigned int tdcChannel() const { return (theSample >> 24) & 0xFF; }
0026   /// for streaming
0027   uint32_t operator()() { return theSample; }
0028 
0029 private:
0030   uint32_t theSample;
0031 };
0032 
0033 std::ostream& operator<<(std::ostream&, const EcalTBTDCSample&);
0034 
0035 #endif