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
 
void addCMNoise (std::vector< float > &, float, std::vector< bool > &) const
 
void addNoise (std::vector< float > &, size_t &, size_t &, int, float) const
 
void addNoiseVR (std::vector< float > &, std::vector< float > &) const
 
void addPedestals (std::vector< float > &, std::vector< float > &) const
 
 SiGaussianTailNoiseAdder (float, CLHEP::HepRandomEngine &)
 
 ~SiGaussianTailNoiseAdder ()
 
- Public Member Functions inherited from SiNoiseAdder
virtual ~SiNoiseAdder ()
 

Private Attributes

std::unique_ptr
< CLHEP::RandGaussQ > 
gaussDistribution
 
std::unique_ptr
< GaussianTailNoiseGenerator
genNoise
 
CLHEP::HepRandomEngine & rndEngine
 
const float threshold
 

Detailed Description

Definition at line 18 of file SiGaussianTailNoiseAdder.h.

Constructor & Destructor Documentation

SiGaussianTailNoiseAdder::SiGaussianTailNoiseAdder ( float  th,
CLHEP::HepRandomEngine &  eng 
)

Definition at line 7 of file SiGaussianTailNoiseAdder.cc.

7  :
8  threshold(th),
9  rndEngine(eng),
10  gaussDistribution(new CLHEP::RandGaussQ(rndEngine)),
12 {
13 }
CLHEP::HepRandomEngine & rndEngine
std::unique_ptr< GaussianTailNoiseGenerator > genNoise
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution
SiGaussianTailNoiseAdder::~SiGaussianTailNoiseAdder ( )

Definition at line 15 of file SiGaussianTailNoiseAdder.cc.

15  {
16 }

Member Function Documentation

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

Implements SiNoiseAdder.

Definition at line 64 of file SiGaussianTailNoiseAdder.cc.

Referenced by DigiSimLinkAlgorithm::run().

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

Implements SiNoiseAdder.

Definition at line 55 of file SiGaussianTailNoiseAdder.cc.

References gaussDistribution.

Referenced by DigiSimLinkAlgorithm::run().

55  {
56  int nAPVs = in.size()/128;
57  std::vector<float> CMNv;
58  for(int APVn =0; APVn < nAPVs; ++APVn) CMNv.push_back(gaussDistribution->fire(0.,cmnRMS));
59  for (size_t iChannel=0; iChannel!=in.size(); iChannel++) {
60  if(!badChannels[iChannel]) in[iChannel] += CMNv[(int)(iChannel/128)];
61  }
62 }
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution
void SiGaussianTailNoiseAdder::addNoise ( std::vector< float > &  in,
size_t &  minChannel,
size_t &  maxChannel,
int  numStrips,
float  noiseRMS 
) const
virtual

Implements SiNoiseAdder.

Definition at line 18 of file SiGaussianTailNoiseAdder.cc.

References gaussDistribution, genNoise, AlCaHLTBitMon_ParallelJobs::p, and threshold.

Referenced by DigiSimLinkAlgorithm::run().

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

Implements SiNoiseAdder.

Definition at line 41 of file SiGaussianTailNoiseAdder.cc.

References gaussDistribution.

Referenced by DigiSimLinkAlgorithm::run().

41  {
42  // Add noise
43  // Full Gaussian noise is added everywhere
44  for (size_t iChannel=0; iChannel!=in.size(); iChannel++) {
45  if(noiseRMS[iChannel] > 0.) in[iChannel] += gaussDistribution->fire(0.,noiseRMS[iChannel]);
46  }
47 }
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution
void SiGaussianTailNoiseAdder::addPedestals ( std::vector< float > &  in,
std::vector< float > &  ped 
) const
virtual

Implements SiNoiseAdder.

Definition at line 49 of file SiGaussianTailNoiseAdder.cc.

Referenced by DigiSimLinkAlgorithm::run().

49  {
50  for (size_t iChannel=0; iChannel!=in.size(); iChannel++) {
51  if(ped[iChannel]>0.) in[iChannel] += ped[iChannel];
52  }
53 }

Member Data Documentation

std::unique_ptr<CLHEP::RandGaussQ> SiGaussianTailNoiseAdder::gaussDistribution
private

Definition at line 32 of file SiGaussianTailNoiseAdder.h.

Referenced by addCMNoise(), addNoise(), and addNoiseVR().

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

Definition at line 33 of file SiGaussianTailNoiseAdder.h.

Referenced by addNoise().

CLHEP::HepRandomEngine& SiGaussianTailNoiseAdder::rndEngine
private

Definition at line 31 of file SiGaussianTailNoiseAdder.h.

const float SiGaussianTailNoiseAdder::threshold
private

Definition at line 30 of file SiGaussianTailNoiseAdder.h.

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