CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

PercentileCMNSubtractor Class Reference

#include <PercentileCMNSubtractor.h>

Inheritance diagram for PercentileCMNSubtractor:
SiStripCommonModeNoiseSubtractor

List of all members.

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 > &)

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

Detailed Description

Definition at line 5 of file PercentileCMNSubtractor.h.


Constructor & Destructor Documentation

PercentileCMNSubtractor::PercentileCMNSubtractor ( double  in) [inline, private]

Definition at line 18 of file PercentileCMNSubtractor.h.

                                     : 
    percentile_(in) {};  

Member Function Documentation

template<typename T >
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,
const uint16_t &  firstAPV,
std::vector< float > &  digis 
) [virtual]

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 4 of file PercentileCMNSubtractor.cc.

References subtract_().

{subtract_(detId,firstAPV, digis);}
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_().

{subtract_(detId, firstAPV, digis);}
template<typename T >
void PercentileCMNSubtractor::subtract_ ( const uint32_t &  detId,
const uint16_t &  firstAPV,
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+firstAPV,offset));

    while (strip < endAPV) {
      *strip = static_cast<T>(*strip-offset);
      strip++;
    }

  }
}

Friends And Related Function Documentation

friend class SiStripRawProcessingFactory [friend]

Reimplemented from SiStripCommonModeNoiseSubtractor.

Definition at line 7 of file PercentileCMNSubtractor.h.


Member Data Documentation

Definition at line 19 of file PercentileCMNSubtractor.h.

Referenced by subtract_().