CMS 3D CMS Logo

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

#include <SiGaussianTailNoiseAdder.h>

Inheritance diagram for SiGaussianTailNoiseAdder:
SiNoiseAdder

Public Member Functions

void addBaselineShift (std::vector< float > &, std::vector< bool > &) const override
 
void addCMNoise (std::vector< float > &, float, std::vector< bool > &, CLHEP::HepRandomEngine *) const override
 
void addNoise (std::vector< float > &, size_t &, size_t &, int, float, CLHEP::HepRandomEngine *) const override
 
void addNoiseVR (std::vector< float > &, std::vector< float > &, CLHEP::HepRandomEngine *) const override
 
void addPedestals (std::vector< float > &, std::vector< float > &) const override
 
 SiGaussianTailNoiseAdder (float)
 
 ~SiGaussianTailNoiseAdder () override
 
- Public Member Functions inherited from SiNoiseAdder
virtual ~SiNoiseAdder ()
 

Private Attributes

std::unique_ptr< GaussianTailNoiseGeneratorgenNoise
 
const float threshold
 

Detailed Description

Definition at line 17 of file SiGaussianTailNoiseAdder.h.

Constructor & Destructor Documentation

◆ SiGaussianTailNoiseAdder()

SiGaussianTailNoiseAdder::SiGaussianTailNoiseAdder ( float  th)

Definition at line 4 of file SiGaussianTailNoiseAdder.cc.

◆ ~SiGaussianTailNoiseAdder()

SiGaussianTailNoiseAdder::~SiGaussianTailNoiseAdder ( )
override

Definition at line 7 of file SiGaussianTailNoiseAdder.cc.

7 {}

Member Function Documentation

◆ addBaselineShift()

void SiGaussianTailNoiseAdder::addBaselineShift ( std::vector< float > &  in,
std::vector< bool > &  badChannels 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 66 of file SiGaussianTailNoiseAdder.cc.

66  {
67  size_t nAPVs = in.size() / 128;
68  std::vector<float> vShift;
69  double apvCharge, apvMult;
70 
71  size_t iChannel;
72  for (size_t APVn = 0; APVn < nAPVs; ++APVn) {
73  apvMult = 0;
74  apvCharge = 0;
75  for (iChannel = APVn * 128; iChannel != APVn * 128 + 128; ++iChannel) {
76  if (in[iChannel] > 0) {
77  ++apvMult;
78  apvCharge += in[iChannel];
79  }
80  if (apvMult == 0)
81  vShift.push_back(0);
82  else
83  vShift.push_back(apvCharge / apvMult);
84  }
85  }
86 
87  for (iChannel = 0; iChannel != in.size(); ++iChannel) {
88  if (!badChannels[iChannel])
89  in[iChannel] -= vShift[(int)(iChannel / 128)];
90  }
91 }

References recoMuon::in, and createfilelist::int.

Referenced by DigiSimLinkAlgorithm::run().

◆ addCMNoise()

void SiGaussianTailNoiseAdder::addCMNoise ( std::vector< float > &  in,
float  cmnRMS,
std::vector< bool > &  badChannels,
CLHEP::HepRandomEngine *  engine 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 52 of file SiGaussianTailNoiseAdder.cc.

55  {
56  int nAPVs = in.size() / 128;
57  std::vector<float> CMNv;
58  for (int APVn = 0; APVn < nAPVs; ++APVn)
59  CMNv.push_back(CLHEP::RandGaussQ::shoot(engine, 0., cmnRMS));
60  for (size_t iChannel = 0; iChannel != in.size(); iChannel++) {
61  if (!badChannels[iChannel])
62  in[iChannel] += CMNv[(int)(iChannel / 128)];
63  }
64 }

References recoMuon::in, and createfilelist::int.

Referenced by DigiSimLinkAlgorithm::run().

◆ addNoise()

void SiGaussianTailNoiseAdder::addNoise ( std::vector< float > &  in,
size_t &  minChannel,
size_t &  maxChannel,
int  numStrips,
float  noiseRMS,
CLHEP::HepRandomEngine *  engine 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 9 of file SiGaussianTailNoiseAdder.cc.

14  {
15  std::vector<std::pair<int, float> > generatedNoise;
16  genNoise->generate(numStrips, threshold, noiseRMS, generatedNoise, engine);
17 
18  // noise on strips with signal:
19  for (size_t iChannel = minChannel; iChannel < maxChannel; iChannel++) {
20  if (in[iChannel] != 0) {
21  in[iChannel] += CLHEP::RandGaussQ::shoot(engine, 0., noiseRMS);
22  }
23  }
24 
25  // Noise on the other strips
26  typedef std::vector<std::pair<int, float> >::const_iterator VI;
27  for (VI p = generatedNoise.begin(); p != generatedNoise.end(); p++) {
28  if (in[(*p).first] == 0) {
29  in[(*p).first] += (*p).second;
30  }
31  }
32 }

References genNoise, recoMuon::in, AlCaHLTBitMon_ParallelJobs::p, and threshold.

Referenced by DigiSimLinkAlgorithm::run().

◆ addNoiseVR()

void SiGaussianTailNoiseAdder::addNoiseVR ( std::vector< float > &  in,
std::vector< float > &  noiseRMS,
CLHEP::HepRandomEngine *  engine 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 34 of file SiGaussianTailNoiseAdder.cc.

36  {
37  // Add noise
38  // Full Gaussian noise is added everywhere
39  for (size_t iChannel = 0; iChannel != in.size(); iChannel++) {
40  if (noiseRMS[iChannel] > 0.)
41  in[iChannel] += CLHEP::RandGaussQ::shoot(engine, 0., noiseRMS[iChannel]);
42  }
43 }

References recoMuon::in.

Referenced by DigiSimLinkAlgorithm::run().

◆ addPedestals()

void SiGaussianTailNoiseAdder::addPedestals ( std::vector< float > &  in,
std::vector< float > &  ped 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 45 of file SiGaussianTailNoiseAdder.cc.

45  {
46  for (size_t iChannel = 0; iChannel != in.size(); iChannel++) {
47  if (ped[iChannel] > 0.)
48  in[iChannel] += ped[iChannel];
49  }
50 }

References recoMuon::in.

Referenced by DigiSimLinkAlgorithm::run().

Member Data Documentation

◆ genNoise

std::unique_ptr<GaussianTailNoiseGenerator> SiGaussianTailNoiseAdder::genNoise
private

Definition at line 30 of file SiGaussianTailNoiseAdder.h.

Referenced by addNoise().

◆ threshold

const float SiGaussianTailNoiseAdder::threshold
private

Definition at line 29 of file SiGaussianTailNoiseAdder.h.

Referenced by addNoise(), and utils.StatisticalTest::get_status().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GaussianTailNoiseGenerator
Definition: GaussianTailNoiseGenerator.h:24
SiGaussianTailNoiseAdder::threshold
const float threshold
Definition: SiGaussianTailNoiseAdder.h:29
recoMuon::in
Definition: RecoMuonEnumerators.h:6
createfilelist.int
int
Definition: createfilelist.py:10
SiGaussianTailNoiseAdder::genNoise
std::unique_ptr< GaussianTailNoiseGenerator > genNoise
Definition: SiGaussianTailNoiseAdder.h:30