Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DIGIECAL_ECALDATAFRAME_H
0002 #define DIGIECAL_ECALDATAFRAME_H
0003 
0004 #include "DataFormats/EcalDigi/interface/EcalMGPASample.h"
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/Common/interface/DataFrame.h"
0007 
0008 #define EcalMgpaBitwiseGain12 1
0009 #define EcalMgpaBitwiseGain6 2
0010 #define EcalMgpaBitwiseGain1 3
0011 #define EcalMgpaBitwiseGain0 0
0012 
0013 /** \class EcalDataFrame
0014       
0015 */
0016 class EcalDataFrame {
0017 public:
0018   EcalDataFrame() {}
0019   // EcalDataFrame(DetId i) :  m_data(i) {}
0020   EcalDataFrame(edm::DataFrame const& iframe) : m_data(iframe) {}
0021 
0022   virtual ~EcalDataFrame() {}
0023 
0024   DetId id() const { return m_data.id(); }
0025 
0026   int size() const { return m_data.size(); }
0027 
0028   EcalMGPASample operator[](int i) const { return m_data[i]; }
0029   EcalMGPASample sample(int i) const { return m_data[i]; }
0030 
0031   // get the leading sample (the first non saturated sample)
0032   // starting from the fourth sample
0033   // (it relies on the fact that the unpaker will discard fixed gain0 DataFrame)
0034   // .. sample numbering: [0, 9]
0035   // .. return -1 in case of no saturation
0036   int lastUnsaturatedSample() const;
0037   // just the boolean method
0038   bool isSaturated() const { return (lastUnsaturatedSample() != -1); }
0039 
0040   // FIXME (shall we throw??)
0041   void setSize(int) {}
0042   // void setPresamples(int ps);
0043   void setSample(int i, EcalMGPASample sam) { m_data[i] = sam; }
0044 
0045   bool hasSwitchToGain6() const;
0046   bool hasSwitchToGain1() const;
0047 
0048   static constexpr int MAXSAMPLES = 10;
0049 
0050   edm::DataFrame const& frame() const { return m_data; }
0051   edm::DataFrame& frame() { return m_data; }
0052 
0053 private:
0054   edm::DataFrame m_data;
0055 };
0056 
0057 #endif