00001 #include "DataFormats/EcalDigi/interface/EcalDataFrame.h" 00002 00003 int EcalDataFrame::lastUnsaturatedSample() const 00004 { 00005 int cnt = 0; 00006 for ( size_t i = 3; i < m_data.size(); ++i ) { 00007 cnt = 0; 00008 for ( size_t j = i; j < (i + 5) && j < m_data.size(); ++j ) { 00009 if ( ((EcalMGPASample)m_data[j]).gainId() == EcalMgpaBitwiseGain0 ) ++cnt; 00010 } 00011 if ( cnt == 5 ) return i-1; // the last unsaturated sample 00012 } 00013 return -1; // no saturation found 00014 } 00015 00016 00017 bool EcalDataFrame:: hasSwitchToGain6() const 00018 { 00019 for(unsigned int u=0; u<m_data.size(); u++) 00020 { 00021 if ( ( static_cast<EcalMGPASample>(m_data[u]) ).gainId() == EcalMgpaBitwiseGain6 ) return true; 00022 } 00023 return false; 00024 } 00025 00026 00027 bool EcalDataFrame:: hasSwitchToGain1() const 00028 { 00029 for(unsigned int u=0; u<m_data.size(); u++) 00030 { 00031 if ( ( static_cast<EcalMGPASample>(m_data[u]) ).gainId() == EcalMgpaBitwiseGain1 ) return true; 00032 } 00033 return false; 00034 }