Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef ECALTRIGGERPRIMITIVESAMPLE_H
0002 #define ECALTRIGGERPRIMITIVESAMPLE_H 1
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /** \class EcalTriggerPrimitiveSample
0008       
0009 
0010 */
0011 
0012 class EcalTriggerPrimitiveSample {
0013 public:
0014   EcalTriggerPrimitiveSample();
0015   EcalTriggerPrimitiveSample(uint16_t data);
0016   EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int triggerFlag);
0017   EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int stripFGVB, int triggerFlag);
0018 
0019   ///Set data
0020   void setValue(uint16_t data) { theSample = data; }
0021   /// get the raw word
0022   uint16_t raw() const { return theSample; }
0023   /// get the encoded/compressed Et (8 bits)
0024   int compressedEt() const { return theSample & 0xFF; }
0025   /// get the fine-grain bit (1 bit)
0026   bool fineGrain() const { return (theSample & 0x100) != 0; }
0027   /// get the Trigger tower Flag (3 bits)
0028   int ttFlag() const { return (theSample >> 9) & 0x7; }
0029 
0030   /// Gets the L1A spike detection flag. Beware the flag is inverted.
0031   /// Deprecated, use instead sFGVB() method, whose name is less missleading
0032   /// @return 0 spike like pattern
0033   ///         1 EM shower like pattern
0034   int l1aSpike() const { return (theSample >> 12) & 0x1; }
0035 
0036   /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection
0037   /// @return 0 spike like pattern
0038   ///         1 EM shower like pattern
0039   int sFGVB() const { return (theSample >> 12) & 0x1; }
0040 
0041   /// for streaming
0042   uint16_t operator()() { return theSample; }
0043 
0044 private:
0045   uint16_t theSample;
0046 };
0047 
0048 std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveSample& samp);
0049 
0050 #endif