CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
TT6CMNSubtractor Class Reference

#include <TT6CMNSubtractor.h>

Inheritance diagram for TT6CMNSubtractor:
SiStripCommonModeNoiseSubtractor

Public Member Functions

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

Private Member Functions

template<typename T >
void subtract_ (uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)
 
 TT6CMNSubtractor (double in, edm::ConsumesCollector iC)
 

Private Attributes

double cut_to_avoid_signal_
 
const SiStripNoisesnoiseHandle
 
edm::ESGetToken< SiStripNoises, SiStripNoisesRcdnoiseToken_
 
edm::ESWatcher< SiStripNoisesRcdnoiseWatcher_
 
const SiStripQualityqualityHandle
 
edm::ESGetToken< SiStripQuality, SiStripQualityRcdqualityToken_
 
edm::ESWatcher< SiStripQualityRcdqualityWatcher_
 

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 12 of file TT6CMNSubtractor.h.

Constructor & Destructor Documentation

◆ TT6CMNSubtractor()

TT6CMNSubtractor::TT6CMNSubtractor ( double  in,
edm::ConsumesCollector  iC 
)
inlineprivate

Definition at line 24 of file TT6CMNSubtractor.h.

Member Function Documentation

◆ init()

void TT6CMNSubtractor::init ( const edm::EventSetup es)
overridevirtual

Reimplemented from SiStripCommonModeNoiseSubtractor.

Definition at line 7 of file TT6CMNSubtractor.cc.

References edm::ESWatcher< T >::check(), edm::EventSetup::getData(), noiseHandle, noiseToken_, noiseWatcher_, qualityHandle, qualityToken_, and qualityWatcher_.

7  {
8  if (noiseWatcher_.check(es)) {
10  }
11  if (qualityWatcher_.check(es)) {
13  }
14 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESWatcher< SiStripQualityRcd > qualityWatcher_
const SiStripNoises * noiseHandle
edm::ESWatcher< SiStripNoisesRcd > noiseWatcher_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
const SiStripQuality * qualityHandle
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_

◆ subtract() [1/2]

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

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 16 of file TT6CMNSubtractor.cc.

References hcalRecHitTable_cff::detId, and subtract_().

16  {
17  subtract_(detId, firstAPV, digis);
18 }
void subtract_(uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)

◆ subtract() [2/2]

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

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 19 of file TT6CMNSubtractor.cc.

References hcalRecHitTable_cff::detId, and subtract_().

19  {
20  subtract_(detId, firstAPV, digis);
21 }
void subtract_(uint32_t detId, uint16_t firstAPV, std::vector< T > &digis)

◆ subtract_()

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

Definition at line 24 of file TT6CMNSubtractor.cc.

References funct::abs(), cut_to_avoid_signal_, hcalRecHitTable_cff::detId, compareTotals::fs, SiStripNoises::getNoiseFast(), SiStripNoises::getRange(), SiStripBadStrip::getRange(), SiStripQuality::IsStripBad(), eostools::ls(), noiseHandle, and qualityHandle.

Referenced by subtract().

24  {
25  short FixedBias = 128;
28 
29  typename std::vector<T>::iterator fs, ls;
30  double sumVal = 0.0;
31  double sumWt = 0.0;
32 
33  for (uint16_t istrip = 0; istrip < digis.size(); ++istrip) {
34  if (!qualityHandle->IsStripBad(detQualityRange, istrip + firstAPV * 128)) {
35  float stripNoise = noiseHandle->getNoiseFast(istrip + firstAPV * 128, detNoiseRange);
36 
37  if (std::abs(digis[istrip] - FixedBias) < cut_to_avoid_signal_ * stripNoise) {
38  double nWeight = 1 / (stripNoise * stripNoise);
39  sumVal += (digis[istrip] - FixedBias) * nWeight;
40  sumWt += nWeight;
41  }
42  }
43 
44  if (istrip % 128 == 127) {
45  double CM = (sumWt) ? sumVal / sumWt : 0.0;
46 
47  fs = digis.begin() + istrip - 127;
48  ls = digis.begin() + istrip + 1;
49 
50  while (fs < ls) {
51  *fs = static_cast<T>(*fs - FixedBias - CM);
52  fs++;
53  }
54 
55  sumVal = 0.0;
56  sumWt = 0.0;
57  }
58  }
59 }
const SiStripNoises * noiseHandle
const Range getRange(const uint32_t detID) const
static float getNoiseFast(const uint16_t &strip, const Range &range)
Definition: SiStripNoises.h:67
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def ls(path, rec=False)
Definition: eostools.py:349
const SiStripQuality * qualityHandle
bool IsStripBad(uint32_t detid, short strip) const
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
long double T

Friends And Related Function Documentation

◆ SiStripRawProcessingFactory

friend class SiStripRawProcessingFactory
friend

Definition at line 13 of file TT6CMNSubtractor.h.

Member Data Documentation

◆ cut_to_avoid_signal_

double TT6CMNSubtractor::cut_to_avoid_signal_
private

Definition at line 28 of file TT6CMNSubtractor.h.

Referenced by subtract_().

◆ noiseHandle

const SiStripNoises* TT6CMNSubtractor::noiseHandle
private

Definition at line 31 of file TT6CMNSubtractor.h.

Referenced by init(), and subtract_().

◆ noiseToken_

edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> TT6CMNSubtractor::noiseToken_
private

Definition at line 29 of file TT6CMNSubtractor.h.

Referenced by init().

◆ noiseWatcher_

edm::ESWatcher<SiStripNoisesRcd> TT6CMNSubtractor::noiseWatcher_
private

Definition at line 33 of file TT6CMNSubtractor.h.

Referenced by init().

◆ qualityHandle

const SiStripQuality* TT6CMNSubtractor::qualityHandle
private

Definition at line 32 of file TT6CMNSubtractor.h.

Referenced by init(), and subtract_().

◆ qualityToken_

edm::ESGetToken<SiStripQuality, SiStripQualityRcd> TT6CMNSubtractor::qualityToken_
private

Definition at line 30 of file TT6CMNSubtractor.h.

Referenced by init().

◆ qualityWatcher_

edm::ESWatcher<SiStripQualityRcd> TT6CMNSubtractor::qualityWatcher_
private

Definition at line 34 of file TT6CMNSubtractor.h.

Referenced by init().