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() == 0 ) ++cnt; 00010 } 00011 if ( cnt == 5 ) return i-1; // the last unsaturated sample 00012 } 00013 return -1; // no saturation found 00014 }