Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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(waveform_, rh.waveform_);
0019     std::swap(data_, rh.data_);
0020   }
0021 
0022   const DetId& id() const { return id_; }
0023   int size() const { return size_; }
0024 
0025   const float& operator[](unsigned int i) const { return data_[i]; }
0026   const float& sample(unsigned int i) const { return data_[i]; }
0027 
0028   void setSize(unsigned int size);
0029   void setWaveform(float* waveform);
0030   void setSample(unsigned int i, const float sam) { data_[i] = sam; }
0031   void setSampleOfInterest(int i) { sampleOfInterest_ = i; }
0032 
0033   /// Gets the BX==0 sample. If =-1 then it means that only OOT hits are present
0034   int sampleOfInterest() const { return sampleOfInterest_; }
0035   std::vector<float> waveform() const { return waveform_; }
0036 
0037   static const unsigned int WAVEFORMSAMPLES = 250;
0038 
0039 private:
0040   DetId id_;
0041   unsigned int size_;
0042   int sampleOfInterest_;
0043   std::vector<float> waveform_;
0044   std::vector<float> data_;
0045 };
0046 
0047 inline void swap(EcalTimeDigi& lh, EcalTimeDigi& rh) { lh.swap(rh); }
0048 
0049 std::ostream& operator<<(std::ostream& s, const EcalTimeDigi& digi);
0050 
0051 #endif