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 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 ()
 
- Public Member Functions inherited from SiNoiseAdder
virtual ~SiNoiseAdder ()
 

Private Attributes

std::unique_ptr
< GaussianTailNoiseGenerator
genNoise
 
const float threshold
 

Detailed Description

Definition at line 17 of file SiGaussianTailNoiseAdder.h.

Constructor & Destructor Documentation

SiGaussianTailNoiseAdder::SiGaussianTailNoiseAdder ( float  th)

Definition at line 4 of file SiGaussianTailNoiseAdder.cc.

4  :
5  threshold(th),
7 {
8 }
std::unique_ptr< GaussianTailNoiseGenerator > genNoise
SiGaussianTailNoiseAdder::~SiGaussianTailNoiseAdder ( )

Definition at line 10 of file SiGaussianTailNoiseAdder.cc.

10  {
11 }

Member Function Documentation

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

Implements SiNoiseAdder.

Definition at line 60 of file SiGaussianTailNoiseAdder.cc.

Referenced by DigiSimLinkAlgorithm::run().

60  {
61  size_t nAPVs = in.size()/128;
62  std::vector<float> vShift;
63  double apvCharge, apvMult;
64 
65  size_t iChannel;
66  for(size_t APVn =0; APVn < nAPVs; ++APVn){
67  apvMult=0; apvCharge=0;
68  for(iChannel=APVn*128; iChannel!=APVn*128+128; ++iChannel) {
69  if(in[iChannel]>0){
70  ++apvMult;
71  apvCharge+= in[iChannel];
72  }
73  if(apvMult==0) vShift.push_back(0);
74  else vShift.push_back(apvCharge/apvMult);
75  }
76  }
77 
78  for (iChannel=0; iChannel!=in.size(); ++iChannel) {
79  if(!badChannels[iChannel]) in[iChannel] -= vShift[(int)(iChannel/128)];
80  }
81 }
void SiGaussianTailNoiseAdder::addCMNoise ( std::vector< float > &  in,
float  cmnRMS,
std::vector< bool > &  badChannels,
CLHEP::HepRandomEngine *  engine 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 51 of file SiGaussianTailNoiseAdder.cc.

Referenced by DigiSimLinkAlgorithm::run().

51  {
52  int nAPVs = in.size()/128;
53  std::vector<float> CMNv;
54  for(int APVn =0; APVn < nAPVs; ++APVn) CMNv.push_back(CLHEP::RandGaussQ::shoot(engine, 0., cmnRMS));
55  for (size_t iChannel=0; iChannel!=in.size(); iChannel++) {
56  if(!badChannels[iChannel]) in[iChannel] += CMNv[(int)(iChannel/128)];
57  }
58 }
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 13 of file SiGaussianTailNoiseAdder.cc.

References genNoise, AlCaHLTBitMon_ParallelJobs::p, and threshold.

Referenced by DigiSimLinkAlgorithm::run().

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

Implements SiNoiseAdder.

Definition at line 37 of file SiGaussianTailNoiseAdder.cc.

Referenced by DigiSimLinkAlgorithm::run().

37  {
38  // Add noise
39  // Full Gaussian noise is added everywhere
40  for (size_t iChannel=0; iChannel!=in.size(); iChannel++) {
41  if(noiseRMS[iChannel] > 0.) in[iChannel] += CLHEP::RandGaussQ::shoot(engine, 0., noiseRMS[iChannel]);
42  }
43 }
void SiGaussianTailNoiseAdder::addPedestals ( std::vector< float > &  in,
std::vector< float > &  ped 
) const
overridevirtual

Implements SiNoiseAdder.

Definition at line 45 of file SiGaussianTailNoiseAdder.cc.

Referenced by DigiSimLinkAlgorithm::run().

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

Member Data Documentation

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

Definition at line 30 of file SiGaussianTailNoiseAdder.h.

Referenced by addNoise().

const float SiGaussianTailNoiseAdder::threshold
private

Definition at line 29 of file SiGaussianTailNoiseAdder.h.

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