Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_EcalDig_EcalEBPhase2TriggerPrimitiveSample_h
0002 #define DataFormats_EcalDig_EcalEBPhase2TriggerPrimitiveSample_h
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /** \class EcalEBPhase2TriggerPrimitiveSample
0008 \author N. Marinelli - Univ of Notre Dame
0009 
0010 */
0011 
0012 class EcalEBPhase2TriggerPrimitiveSample {
0013 public:
0014   EcalEBPhase2TriggerPrimitiveSample();
0015   EcalEBPhase2TriggerPrimitiveSample(uint32_t data);
0016   EcalEBPhase2TriggerPrimitiveSample(int encodedEt);
0017   EcalEBPhase2TriggerPrimitiveSample(int encodedEt, bool isASpike);
0018   EcalEBPhase2TriggerPrimitiveSample(int encodedEt, bool isASpike, int timing);
0019 
0020   ///Set data
0021   void setValue(uint32_t data) { theSample_ = data; }
0022   // The sample is a 18 bit word defined as:
0023   //
0024   //     o o 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   uint32_t raw() const { return theSample_ & 0x3ffff; }
0032 
0033   /// get the encoded Et (12 bits)
0034   int encodedEt() const { return (theSample_ & 0x3ffff) & 0xFFF; }
0035 
0036   bool l1aSpike() const { return (theSample_ & 0x3ffff & 0x1000) != 0; }
0037 
0038   int time() const { return (theSample_ & 0x3ffff) >> 13; }
0039 
0040   /// for streaming
0041   uint32_t operator()() { return theSample_ & 0x3ffff; }
0042 
0043 private:
0044   uint32_t theSample_;
0045 };
0046 
0047 std::ostream& operator<<(std::ostream& s, const EcalEBPhase2TriggerPrimitiveSample& samp);
0048 
0049 #endif