Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-12-20 03:21:47

0001 #ifndef ECALEBTRIGGERPRIMITIVESAMPLE_H
0002 #define ECALEBTRIGGERPRIMITIVESAMPLE_H 1
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /** \class EcalEBTriggerPrimitiveSample
0008 \author N. Marinelli - Univ of Notre Dame
0009 
0010 */
0011 
0012 class EcalEBTriggerPrimitiveSample {
0013 public:
0014   EcalEBTriggerPrimitiveSample();
0015   EcalEBTriggerPrimitiveSample(uint16_t data);
0016   EcalEBTriggerPrimitiveSample(int encodedEt);
0017   EcalEBTriggerPrimitiveSample(int encodedEt, bool isASpike);
0018   EcalEBTriggerPrimitiveSample(int encodedEt, bool isASpike, int timing);
0019 
0020   ///Set data
0021   void setValue(uint16_t data) { theSample = data; }
0022   // The sample is a 16 bit word defined as:
0023   //
0024   //     o o o o o    o      o o o o o o o o o o
0025   //     |________|        |_______________________|
0026   //      ~60ps res  spike         Et
0027   //      time info  flag
0028   //
0029 
0030   /// get the raw word
0031   uint16_t raw() const { return theSample; }
0032 
0033   /// get the encoded Et (10 bits)
0034   int encodedEt() const { return theSample & 0x3ff; }
0035 
0036   bool l1aSpike() const { return (theSample & 0x400) != 0; }
0037 
0038   int time() const { return theSample >> 11; }
0039 
0040   /// for streaming
0041   uint16_t operator()() { return theSample; }
0042 
0043 private:
0044   uint16_t theSample;
0045 };
0046 
0047 std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveSample& samp);
0048 
0049 #endif