CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastLinearCMNSubtractor.cc
Go to the documentation of this file.
2 
3 void FastLinearCMNSubtractor::subtract(const uint32_t& detId, const uint16_t& firstAPV, std::vector<int16_t>& digis){ subtract_(detId, firstAPV, digis);}
4 void FastLinearCMNSubtractor::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, high, low;
16 
17  while( strip < end ) {
18  endAPV = strip+128; tmp.clear();
19  tmp.insert(tmp.end(),strip,endAPV);
20  const float offset = median(tmp);
21 
22  low = strip; high = strip+64; tmp.clear();
23  while( high < endAPV) tmp.push_back( *high++ - *low++ );
24  const float slope = median(tmp)/64.;
25 
26  while (strip < endAPV) {
27  *strip = static_cast<T>( *strip - (offset + slope*(65 - (endAPV-strip) ) ) );
28  strip++;
29  }
30 
31  }
32 }
33 
34 // Details on http://abbaneo.web.cern.ch/abbaneo/cmode/cm.html
35 
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
static const double slope[3]
void subtract(const uint32_t &, const uint16_t &, std::vector< int16_t > &)
#define end
Definition: vmac.h:38
unsigned int offset(bool)
void subtract_(const uint32_t &, const uint16_t &, std::vector< T > &)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
long double T