Go to the documentation of this file.00001 #include "RecoLocalTracker/SiStripZeroSuppression/interface/MedianCMNSubtractor.h"
00002
00003 void MedianCMNSubtractor::subtract(const uint32_t& detId,std::vector<int16_t>& digis) {subtract_(detId,digis);}
00004 void MedianCMNSubtractor::subtract(const uint32_t& detId,std::vector<float>& digis) {subtract_(detId,digis);}
00005
00006 template<typename T>
00007 inline
00008 void MedianCMNSubtractor::
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;
00016
00017 _vmedians.clear();
00018
00019 while( strip < end ) {
00020 endAPV = strip+128; tmp.clear();
00021 tmp.insert(tmp.end(),strip,endAPV);
00022 const float offset = median(tmp);
00023
00024 _vmedians.push_back(std::pair<short,float>((strip-digis.begin())/128,offset));
00025
00026 while (strip < endAPV) {
00027 *strip = static_cast<T>(*strip-offset);
00028 strip++;
00029 }
00030
00031 }
00032 }