CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
PercentileCMNSubtractor Class Reference

#include <PercentileCMNSubtractor.h>

Inheritance diagram for PercentileCMNSubtractor:
SiStripCommonModeNoiseSubtractor

Public Member Functions

void subtract (const uint32_t &, const uint16_t &firstAPV, std::vector< int16_t > &)
 
void subtract (const uint32_t &, const uint16_t &firstAPV, std::vector< float > &)
 
- Public Member Functions inherited from SiStripCommonModeNoiseSubtractor
const std::vector< std::pair
< short, float > > & 
getAPVsCM ()
 
virtual void init (const edm::EventSetup &es)
 
virtual ~SiStripCommonModeNoiseSubtractor ()
 

Private Member Functions

template<typename T >
float percentile (std::vector< T > &, double)
 
 PercentileCMNSubtractor (double in)
 
template<typename T >
void subtract_ (const uint32_t &, const uint16_t &firstAPV, std::vector< T > &)
 

Private Attributes

double percentile_
 

Friends

class SiStripRawProcessingFactory
 

Additional Inherited Members

- Protected Member Functions inherited from SiStripCommonModeNoiseSubtractor
template<typename T >
float median (std::vector< T > &)
 
 SiStripCommonModeNoiseSubtractor ()
 
- Protected Attributes inherited from SiStripCommonModeNoiseSubtractor
std::vector< std::pair< short,
float > > 
_vmedians
 

Detailed Description

Definition at line 5 of file PercentileCMNSubtractor.h.

Constructor & Destructor Documentation

PercentileCMNSubtractor::PercentileCMNSubtractor ( double  in)
inlineprivate

Definition at line 18 of file PercentileCMNSubtractor.h.

Member Function Documentation

template<typename T >
float PercentileCMNSubtractor::percentile ( std::vector< T > &  sample,
double  pct 
)
inlineprivate

Definition at line 38 of file PercentileCMNSubtractor.cc.

Referenced by subtract_().

38  {
39  typename std::vector<T>::iterator mid = sample.begin() + int(sample.size()*pct/100.0);
40  std::nth_element(sample.begin(), mid, sample.end());
41  return *mid;
42 }
void PercentileCMNSubtractor::subtract ( const uint32_t &  detId,
const uint16_t &  firstAPV,
std::vector< int16_t > &  digis 
)
virtual

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 3 of file PercentileCMNSubtractor.cc.

References subtract_().

3 {subtract_(detId, firstAPV, digis);}
void subtract_(const uint32_t &, const uint16_t &firstAPV, std::vector< T > &)
void PercentileCMNSubtractor::subtract ( const uint32_t &  detId,
const uint16_t &  firstAPV,
std::vector< float > &  digis 
)
virtual

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 4 of file PercentileCMNSubtractor.cc.

References subtract_().

4 {subtract_(detId,firstAPV, digis);}
void subtract_(const uint32_t &, const uint16_t &firstAPV, std::vector< T > &)
template<typename T >
void PercentileCMNSubtractor::subtract_ ( const uint32_t &  detId,
const uint16_t &  firstAPV,
std::vector< T > &  digis 
)
inlineprivate

Definition at line 9 of file PercentileCMNSubtractor.cc.

References SiStripCommonModeNoiseSubtractor::_vmedians, end, evf::evtn::offset(), percentile(), percentile_, and tmp.

Referenced by subtract().

9  {
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 = percentile(tmp,percentile_);
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 }
float percentile(std::vector< T > &, double)
#define end
Definition: vmac.h:38
unsigned int offset(bool)
std::vector< std::pair< short, float > > _vmedians
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
long double T

Friends And Related Function Documentation

friend class SiStripRawProcessingFactory
friend

Definition at line 7 of file PercentileCMNSubtractor.h.

Member Data Documentation

double PercentileCMNSubtractor::percentile_
private

Definition at line 19 of file PercentileCMNSubtractor.h.

Referenced by subtract_().