CMS 3D CMS Logo

FastLinearCMNSubtractor.cc
Go to the documentation of this file.
2 
3 void FastLinearCMNSubtractor::subtract(uint32_t detId, uint16_t firstAPV, std::vector<int16_t>& digis) {
4  subtract_(detId, firstAPV, digis);
5 }
6 void FastLinearCMNSubtractor::subtract(uint32_t detId, uint16_t firstAPV, std::vector<float>& digis) {
7  subtract_(detId, firstAPV, digis);
8 }
9 
10 template <typename T>
11 inline void FastLinearCMNSubtractor::subtract_(uint32_t detId, uint16_t firstAPV, std::vector<T>& digis) {
12  std::vector<T> tmp;
13  tmp.reserve(128);
14  typename std::vector<T>::iterator strip(digis.begin()), end(digis.end()), endAPV, high, low;
15 
16  while (strip < end) {
17  endAPV = strip + 128;
18  tmp.clear();
19  tmp.insert(tmp.end(), strip, endAPV);
20  const float offset = median(tmp);
21 
22  low = strip;
23  high = strip + 64;
24  tmp.clear();
25  while (high < endAPV)
26  tmp.push_back(*high++ - *low++);
27  const float slope = median(tmp) / 64.;
28 
29  while (strip < endAPV) {
30  *strip = static_cast<T>(*strip - (offset + slope * (65 - (endAPV - strip))));
31  strip++;
32  }
33  }
34 }
35 
36 // Details on http://abbaneo.web.cern.ch/abbaneo/cmode/cm.html
static const double slope[3]
void subtract_(uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)
#define end
Definition: vmac.h:39
tmp
align.sh
Definition: createJobs.py:716
long double T
void subtract(uint32_t detId, uint16_t firstAPV, std::vector< int16_t > &digis) override