Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:38:53

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