CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoLocalTracker/SiStripZeroSuppression/src/FastLinearCMNSubtractor.cc

Go to the documentation of this file.
00001 #include "RecoLocalTracker/SiStripZeroSuppression/interface/FastLinearCMNSubtractor.h"
00002 
00003 void FastLinearCMNSubtractor::subtract(const uint32_t& detId,std::vector<int16_t>& digis){ subtract_(detId,digis);}
00004 void FastLinearCMNSubtractor::subtract(const uint32_t& detId,std::vector<float>& digis){ subtract_(detId,digis);}
00005 
00006 template<typename T>
00007 inline
00008 void FastLinearCMNSubtractor::
00009 subtract_(const uint32_t& detId,std::vector<T>& digis){
00010 
00011   std::vector<T> tmp;  tmp.reserve(128);
00012   typename std::vector<T>::iterator 
00013     strip( digis.begin() ), 
00014     end(   digis.end()   ),
00015     endAPV, high, low;
00016 
00017   while( strip < end ) {
00018     endAPV = strip+128; tmp.clear();
00019     tmp.insert(tmp.end(),strip,endAPV);
00020     const float offset = median(tmp);
00021     
00022     low = strip;   high = strip+64;   tmp.clear(); 
00023     while( high < endAPV) tmp.push_back( *high++ - *low++ );
00024     const float slope = median(tmp)/64.;
00025 
00026     while (strip < endAPV) {
00027       *strip = static_cast<T>( *strip - (offset + slope*(65 - (endAPV-strip) ) ) );
00028       strip++;
00029     }
00030 
00031   }
00032 }
00033 
00034 // Details on https://abbaneo.web.cern.ch/abbaneo/cmode/cm.html
00035