Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_EcalDigi_EcalEBPhase2TriggerPrimitiveDigi_h
0002 #define DataFormats_EcalDigi_EcalEBPhase2TriggerPrimitiveDigi_h
0003 
0004 #include <ostream>
0005 #include <vector>
0006 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0007 #include "DataFormats/EcalDigi/interface/EcalEBPhase2TriggerPrimitiveSample.h"
0008 
0009 /** \class EcalEBPhase2TriggerPrimitiveDigi
0010 \author N. Marinelli - Univ. of Notre Dame
0011 
0012 
0013 */
0014 
0015 class EcalEBPhase2TriggerPrimitiveDigi {
0016 public:
0017   typedef EBDetId key_type;  ///< For the sorted collection
0018 
0019   EcalEBPhase2TriggerPrimitiveDigi();  // for persistence
0020   EcalEBPhase2TriggerPrimitiveDigi(const EBDetId& id);
0021 
0022   void swap(EcalEBPhase2TriggerPrimitiveDigi& rh) {
0023     std::swap(id_, rh.id_);
0024     std::swap(size_, rh.size_);
0025     std::swap(data_, rh.data_);
0026   }
0027 
0028   const EBDetId& id() const { return id_; }
0029   int size() const { return size_; }
0030 
0031   const EcalEBPhase2TriggerPrimitiveSample& operator[](int i) const { return data_[i]; }
0032   const EcalEBPhase2TriggerPrimitiveSample& sample(int i) const { return data_[i]; }
0033 
0034   void setSize(int size);
0035   void setSample(int i, const EcalEBPhase2TriggerPrimitiveSample& sam);
0036   void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); }
0037 
0038   /// get the 12 bits Et of interesting sample
0039   int encodedEt() const;
0040 
0041   /// Spike flag
0042   bool l1aSpike() const;
0043 
0044   /// Time info
0045   int time() const;
0046 
0047   /// True if debug mode (# of samples > 1)
0048   bool isDebug() const;
0049 
0050   /// Gets the interesting sample
0051   int sampleOfInterest() const;
0052 
0053 private:
0054   EBDetId id_;
0055   int size_;
0056   std::vector<EcalEBPhase2TriggerPrimitiveSample> data_;
0057 };
0058 
0059 inline void swap(EcalEBPhase2TriggerPrimitiveDigi& lh, EcalEBPhase2TriggerPrimitiveDigi& rh) { lh.swap(rh); }
0060 
0061 std::ostream& operator<<(std::ostream& s, const EcalEBPhase2TriggerPrimitiveDigi& digi);
0062 
0063 #endif