CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/EcalDigi/src/EBDataFrame.cc

Go to the documentation of this file.
00001 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include<iostream>
00004 
00005 float EBDataFrame::spikeEstimator() const
00006 {
00007         if ( size() != 10 ) {
00008                 edm::LogError("InvalidNumberOfSamples") << "This method only applies to signals sampled 10 times ("
00009                         << size() << " samples found)";
00010                 return 10.;
00011         }
00012         // skip faulty channels
00013         if ( sample(5).adc() == 0 ) return 10.;
00014         size_t imax = 0;
00015         int maxAdc = 0;
00016         for ( int i = 0; i < size(); ++i ) {
00017                 if ( sample(i).adc() > maxAdc ) {
00018                         imax = i;
00019                         maxAdc = sample(i).adc();
00020                 }
00021         }
00022         // skip early signals
00023         if ( imax < 4 ) return 10.;
00024         float ped = 1./3. * (sample(0).adc() + sample(1).adc() + sample(2).adc());
00025         return 0.18*(sample(4).adc()-ped)/(sample(5).adc()-ped) + (sample(6).adc()-ped)/(sample(5).adc()-ped);
00026 }
00027 
00028 
00029 std::ostream& operator<<(std::ostream& s, const EBDataFrame& digi) {
00030   s << digi.id() << " " << digi.size() << " samples " << std::endl;
00031   for (int i=0; i<digi.size(); i++) 
00032     s << "  " << digi[i] << std::endl;
00033   return s;
00034 }