CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/DataFormats/EcalDigi/interface/EcalDataFrame.h

Go to the documentation of this file.
00001 #ifndef DIGIECAL_ECALDATAFRAME_H
00002 #define DIGIECAL_ECALDATAFRAME_H
00003 
00004 #include "DataFormats/EcalDigi/interface/EcalMGPASample.h"
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/Common/interface/DataFrame.h"
00007 
00008 #define EcalMgpaBitwiseGain12 1
00009 #define EcalMgpaBitwiseGain6  2
00010 #define EcalMgpaBitwiseGain1  3
00011 #define EcalMgpaBitwiseGain0  0
00012 
00017 class EcalDataFrame {
00018  public:
00019   EcalDataFrame() {}
00020   // EcalDataFrame(DetId i) :  m_data(i) {}
00021   EcalDataFrame(edm::DataFrame const & iframe) : m_data(iframe){} 
00022 
00023   virtual ~EcalDataFrame() {} 
00024 
00025   DetId id() const { return m_data.id();}
00026     
00027   int size() const { return m_data.size();}
00028 
00029   EcalMGPASample operator[](int i) const { return m_data[i];}
00030   EcalMGPASample sample(int i) const { return m_data[i]; }
00031 
00032   // get the leading sample (the first non saturated sample)
00033   // starting from the fourth sample
00034   // (it relies on the fact that the unpaker will discard fixed gain0 DataFrame)
00035   // .. sample numbering: [0, 9]
00036   // .. return -1 in case of no saturation
00037   int lastUnsaturatedSample() const;
00038   // just the boolean method
00039   bool isSaturated() const { return ( lastUnsaturatedSample() != -1 ); }
00040     
00041   // FIXME (shall we throw??)
00042   void setSize(int){}
00043   // void setPresamples(int ps);
00044   void setSample(int i, EcalMGPASample sam) { m_data[i]=sam; }
00045 
00046   bool hasSwitchToGain6() const; 
00047   bool hasSwitchToGain1() const; 
00048   
00049   static const int MAXSAMPLES = 10;
00050 
00051   edm::DataFrame const & frame() const { return m_data;}
00052   edm::DataFrame & frame() { return m_data;}
00053 
00054  private:
00055  
00056   edm::DataFrame m_data;
00057   
00058 };
00059   
00060 #endif