Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:16

0001 #ifndef _DataFormats_EcalDigi_ECALTIMEDIGI_H_
0002 #define _DataFormats_EcalDigi_ECALTIMEDIGI_H_
0003 
0004 #include <ostream>
0005 #include <vector>
0006 #include "DataFormats/DetId/interface/DetId.h"
0007 
0008 class EcalTimeDigi {
0009 public:
0010   typedef DetId key_type;  ///< For the sorted collection
0011 
0012   EcalTimeDigi();  // for persistence
0013   explicit EcalTimeDigi(const DetId& id);
0014 
0015   void swap(EcalTimeDigi& rh) {
0016     std::swap(id_, rh.id_);
0017     std::swap(size_, rh.size_);
0018     std::swap(data_, rh.data_);
0019   }
0020 
0021   const DetId& id() const { return id_; }
0022   int size() const { return size_; }
0023 
0024   const float& operator[](unsigned int i) const { return data_[i]; }
0025   const float& sample(unsigned int i) const { return data_[i]; }
0026 
0027   void setSize(unsigned int size);
0028   void setSample(unsigned int i, const float sam) { data_[i] = sam; }
0029   void setSampleOfInterest(int i) { sampleOfInterest_ = i; }
0030 
0031   /// Gets the BX==0 sample. If =-1 then it means that only OOT hits are present
0032   int sampleOfInterest() const { return sampleOfInterest_; }
0033 
0034 private:
0035   DetId id_;
0036   unsigned int size_;
0037   int sampleOfInterest_;
0038   std::vector<float> data_;
0039 };
0040 
0041 inline void swap(EcalTimeDigi& lh, EcalTimeDigi& rh) { lh.swap(rh); }
0042 
0043 std::ostream& operator<<(std::ostream& s, const EcalTimeDigi& digi);
0044 
0045 #endif