CMS 3D CMS Logo

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 (uint32_t detId, uint16_t firstAPV, std::vector< float > &digis) override
 
void subtract (uint32_t detId, uint16_t firstAPV, std::vector< int16_t > &digis) override
 
- Public Member Functions inherited from SiStripCommonModeNoiseSubtractor
const std::vector< std::pair< short, float > > & getAPVsCM () const
 
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_ (uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)
 

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::PercentileCMNSubtractor ( double  in)
inlineprivate

Definition at line 17 of file PercentileCMNSubtractor.h.

17 : percentile_(in){};

Member Function Documentation

◆ percentile()

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

Definition at line 34 of file PercentileCMNSubtractor.cc.

34  {
35  typename std::vector<T>::iterator mid = sample.begin() + int(sample.size() * pct / 100.0);
36  std::nth_element(sample.begin(), mid, sample.end());
37  return *mid;
38 }

References createfilelist::int, and simplePhotonAnalyzer_cfi::sample.

Referenced by subtract_().

◆ subtract() [1/2]

void PercentileCMNSubtractor::subtract ( uint32_t  detId,
uint16_t  firstAPV,
std::vector< float > &  digis 
)
overridevirtual

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 6 of file PercentileCMNSubtractor.cc.

6  {
7  subtract_(detId, firstAPV, digis);
8 }

References subtract_().

◆ subtract() [2/2]

void PercentileCMNSubtractor::subtract ( uint32_t  detId,
uint16_t  firstAPV,
std::vector< int16_t > &  digis 
)
overridevirtual

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 3 of file PercentileCMNSubtractor.cc.

3  {
4  subtract_(detId, firstAPV, digis);
5 }

References subtract_().

◆ subtract_()

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

Definition at line 11 of file PercentileCMNSubtractor.cc.

11  {
12  std::vector<T> tmp;
13  tmp.reserve(128);
14  typename std::vector<T>::iterator strip(digis.begin()), end(digis.end()), endAPV;
15 
16  _vmedians.clear();
17 
18  while (strip < end) {
19  endAPV = strip + 128;
20  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 }

References SiStripCommonModeNoiseSubtractor::_vmedians, mps_fire::end, hltrates_dqm_sourceclient-live_cfg::offset, percentile(), percentile_, digitizers_cfi::strip, and createJobs::tmp.

Referenced by subtract().

Friends And Related Function Documentation

◆ SiStripRawProcessingFactory

friend class SiStripRawProcessingFactory
friend

Definition at line 6 of file PercentileCMNSubtractor.h.

Member Data Documentation

◆ percentile_

double PercentileCMNSubtractor::percentile_
private

Definition at line 17 of file PercentileCMNSubtractor.h.

Referenced by subtract_().

PercentileCMNSubtractor::percentile
float percentile(std::vector< T > &, double)
Definition: PercentileCMNSubtractor.cc:34
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
SiStripCommonModeNoiseSubtractor::_vmedians
std::vector< std::pair< short, float > > _vmedians
Definition: SiStripCommonModeNoiseSubtractor.h:25
PercentileCMNSubtractor::percentile_
double percentile_
Definition: PercentileCMNSubtractor.h:17
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
mps_fire.end
end
Definition: mps_fire.py:242
recoMuon::in
Definition: RecoMuonEnumerators.h:6
createfilelist.int
int
Definition: createfilelist.py:10
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
PercentileCMNSubtractor::subtract_
void subtract_(uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)
Definition: PercentileCMNSubtractor.cc:11