Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0002 
0003 ESDataFrame::ESDataFrame() : id_(0), size_(0) {}
0004 
0005 ESDataFrame::ESDataFrame(const ESDetId& id) : id_(id), size_(0) {}
0006 
0007 ESDataFrame::ESDataFrame(const edm::DataFrame& df) : id_(df.id()) {
0008   setSize(df.size());
0009   for (int i(0); i != size_; ++i) {
0010     static const int offset(65536);  // for uint16 to int16
0011     static const uint16_t limit(32767);
0012     const int dint(limit < df[i] ? (int)df[i] - offset : df[i]);
0013     data_[i] = ESSample((int16_t)dint);
0014   }
0015 }
0016 
0017 void ESDataFrame::setSize(int size) {
0018   if (size > MAXSAMPLES)
0019     size_ = MAXSAMPLES;
0020   else if (size <= 0)
0021     size_ = 0;
0022   else
0023     size_ = size;
0024 }
0025 
0026 std::ostream& operator<<(std::ostream& s, const ESDataFrame& digi) {
0027   s << digi.id() << " " << digi.size() << " samples " << std::endl;
0028   for (int i = 0; i < digi.size(); i++)
0029     s << "  " << digi.sample(i) << std::endl;
0030   return s;
0031 }