#include <PercentileCMNSubtractor.h>
Public Member Functions | |
void | subtract (const uint32_t &, std::vector< int16_t > &) |
void | subtract (const uint32_t &, std::vector< float > &) |
Private Member Functions | |
template<typename T > | |
float | percentile (std::vector< T > &, double) |
PercentileCMNSubtractor (double in) | |
template<typename T > | |
void | subtract_ (const uint32_t &, std::vector< T > &) |
Private Attributes | |
double | percentile_ |
Friends | |
class | SiStripRawProcessingFactory |
Definition at line 5 of file PercentileCMNSubtractor.h.
PercentileCMNSubtractor::PercentileCMNSubtractor | ( | double | in | ) | [inline, private] |
Definition at line 18 of file PercentileCMNSubtractor.h.
: percentile_(in) {};
float PercentileCMNSubtractor::percentile | ( | std::vector< T > & | sample, |
double | pct | ||
) | [inline, private] |
Definition at line 38 of file PercentileCMNSubtractor.cc.
Referenced by subtract_().
{ typename std::vector<T>::iterator mid = sample.begin() + int(sample.size()*pct/100.0); std::nth_element(sample.begin(), mid, sample.end()); return *mid; }
void PercentileCMNSubtractor::subtract | ( | const uint32_t & | detId, |
std::vector< float > & | digis | ||
) | [virtual] |
Implements SiStripCommonModeNoiseSubtractor.
Definition at line 4 of file PercentileCMNSubtractor.cc.
References subtract_().
{subtract_(detId,digis);}
void PercentileCMNSubtractor::subtract | ( | const uint32_t & | detId, |
std::vector< int16_t > & | digis | ||
) | [virtual] |
Implements SiStripCommonModeNoiseSubtractor.
Definition at line 3 of file PercentileCMNSubtractor.cc.
References subtract_().
{subtract_(detId,digis);}
void PercentileCMNSubtractor::subtract_ | ( | const uint32_t & | detId, |
std::vector< T > & | digis | ||
) | [inline, private] |
Definition at line 9 of file PercentileCMNSubtractor.cc.
References SiStripCommonModeNoiseSubtractor::_vmedians, end, evf::evtn::offset(), percentile(), percentile_, strip(), and tmp.
Referenced by subtract().
{ std::vector<T> tmp; tmp.reserve(128); typename std::vector<T>::iterator strip( digis.begin() ), end( digis.end() ), endAPV; _vmedians.clear(); while( strip < end ) { endAPV = strip+128; tmp.clear(); tmp.insert(tmp.end(),strip,endAPV); const float offset = percentile(tmp,percentile_); _vmedians.push_back(std::pair<short,float>((strip-digis.begin())/128,offset)); while (strip < endAPV) { *strip = static_cast<T>(*strip-offset); strip++; } } }
friend class SiStripRawProcessingFactory [friend] |
Reimplemented from SiStripCommonModeNoiseSubtractor.
Definition at line 7 of file PercentileCMNSubtractor.h.
double PercentileCMNSubtractor::percentile_ [private] |
Definition at line 19 of file PercentileCMNSubtractor.h.
Referenced by subtract_().