CMS 3D CMS Logo

MedianCMNSubtractor.cc
Go to the documentation of this file.
2 
3 void MedianCMNSubtractor::subtract(uint32_t detId, uint16_t firstAPV, std::vector<int16_t>& digis) {subtract_(detId,firstAPV,digis);}
4 void MedianCMNSubtractor::subtract(uint32_t detId, uint16_t firstAPV, std::vector<float>& digis) {subtract_(detId,firstAPV, digis);}
5 
6 template<typename T>
7 inline
9 subtract_(uint32_t detId, 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_(uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)
#define end
Definition: vmac.h:39
void subtract(uint32_t detId, uint16_t firstAPV, std::vector< int16_t > &digis) override
std::vector< std::pair< short, float > > _vmedians
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
long double T