CMS 3D CMS Logo

MedianCMNSubtractor.cc
Go to the documentation of this file.
2 
3 void MedianCMNSubtractor::subtract(const uint32_t& detId,const uint16_t& firstAPV, std::vector<int16_t>& digis) {subtract_(detId,firstAPV,digis);}
4 void MedianCMNSubtractor::subtract(const uint32_t& detId,const uint16_t& firstAPV, std::vector<float>& digis) {subtract_(detId,firstAPV, digis);}
5 
6 template<typename T>
7 inline
9 subtract_(const uint32_t& detId,const uint16_t& firstAPV, std::vector<T>& digis){
10 
11  std::vector<T> tmp; tmp.reserve(128);
12  typename std::vector<T>::iterator
13  strip( digis.begin() ),
14  end( digis.end() ),
15  endAPV;
16 
17  _vmedians.clear();
18 
19  while( strip < end ) {
20  endAPV = strip+128; tmp.clear();
21  tmp.insert(tmp.end(),strip,endAPV);
22  const float offset = median(tmp);
23 
24  _vmedians.push_back(std::pair<short,float>((strip-digis.begin())/128+firstAPV,offset));
25 
26  while (strip < endAPV) {
27  *strip = static_cast<T>(*strip-offset);
28  strip++;
29  }
30 
31  }
32 }
void subtract_(const uint32_t &, const uint16_t &, std::vector< T > &)
#define end
Definition: vmac.h:37
std::vector< std::pair< short, float > > _vmedians
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void subtract(const uint32_t &, const uint16_t &, std::vector< int16_t > &) override
long double T