#include <SiGaussianTailNoiseAdder.h>
Public Member Functions | |
void | addBaselineShift (std::vector< double > &, std::vector< bool > &) |
void | addCMNoise (std::vector< double > &, float, std::vector< bool > &) |
void | addNoise (std::vector< double > &, size_t &, size_t &, int, float) |
void | addNoiseVR (std::vector< double > &, std::vector< float > &) |
void | addPedestals (std::vector< double > &, std::vector< float > &) |
SiGaussianTailNoiseAdder (float, CLHEP::HepRandomEngine &) | |
~SiGaussianTailNoiseAdder () | |
Private Attributes | |
CLHEP::RandGaussQ * | gaussDistribution |
GaussianTailNoiseGenerator * | genNoise |
float | pedValue |
CLHEP::HepRandomEngine & | rndEngine |
float | threshold |
Definition at line 16 of file SiGaussianTailNoiseAdder.h.
SiGaussianTailNoiseAdder::SiGaussianTailNoiseAdder | ( | float | th, |
CLHEP::HepRandomEngine & | eng | ||
) |
Definition at line 7 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution, genNoise, and rndEngine.
: threshold(th), rndEngine(eng), gaussDistribution(0) { genNoise = new GaussianTailNoiseGenerator(rndEngine); gaussDistribution = new CLHEP::RandGaussQ(rndEngine); }
SiGaussianTailNoiseAdder::~SiGaussianTailNoiseAdder | ( | ) |
Definition at line 16 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution, and genNoise.
{ delete genNoise; delete gaussDistribution; }
void SiGaussianTailNoiseAdder::addBaselineShift | ( | std::vector< double > & | in, |
std::vector< bool > & | badChannels | ||
) | [virtual] |
Implements SiNoiseAdder.
Definition at line 67 of file SiGaussianTailNoiseAdder.cc.
Referenced by SiStripDigitizerAlgorithm::run().
{ size_t nAPVs = in.size()/128; std::vector<float> vShift; double apvCharge, apvMult; size_t iChannel; for(size_t APVn =0; APVn < nAPVs; ++APVn){ apvMult=0; apvCharge=0; for(iChannel=APVn*128; iChannel!=APVn*128+128; ++iChannel) { if(in[iChannel]>0){ ++apvMult; apvCharge+= in[iChannel]; } if(apvMult==0) vShift.push_back(0); else vShift.push_back(apvCharge/apvMult); } } for (iChannel=0; iChannel!=in.size(); ++iChannel) { if(!badChannels[iChannel]) in[iChannel] -= vShift[(int)(iChannel/128)]; } }
void SiGaussianTailNoiseAdder::addCMNoise | ( | std::vector< double > & | in, |
float | cmnRMS, | ||
std::vector< bool > & | badChannels | ||
) | [virtual] |
Implements SiNoiseAdder.
Definition at line 58 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution.
Referenced by SiStripDigitizerAlgorithm::run().
{ int nAPVs = in.size()/128; std::vector<float> CMNv; for(int APVn =0; APVn < nAPVs; ++APVn) CMNv.push_back(gaussDistribution->fire(0.,cmnRMS)); for (size_t iChannel=0; iChannel!=in.size(); iChannel++) { if(!badChannels[iChannel]) in[iChannel] += CMNv[(int)(iChannel/128)]; } }
void SiGaussianTailNoiseAdder::addNoise | ( | std::vector< double > & | in, |
size_t & | minChannel, | ||
size_t & | maxChannel, | ||
int | numStrips, | ||
float | noiseRMS | ||
) | [virtual] |
Implements SiNoiseAdder.
Definition at line 21 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution, GaussianTailNoiseGenerator::generate(), genNoise, AlCaHLTBitMon_ParallelJobs::p, and threshold.
Referenced by SiStripDigitizerAlgorithm::run().
{ std::vector<std::pair<int,float> > generatedNoise; genNoise->generate(numStrips,threshold,noiseRMS,generatedNoise); // noise on strips with signal: for (size_t iChannel=minChannel; iChannel<maxChannel; iChannel++) { if(in[iChannel] != 0) { in[iChannel] += gaussDistribution->fire(0.,noiseRMS); } } // Noise on the other strips typedef std::vector<std::pair<int,float> >::const_iterator VI; for(VI p = generatedNoise.begin(); p != generatedNoise.end(); p++){ if(in[(*p).first] == 0) { in[(*p).first] += (*p).second; } } }
void SiGaussianTailNoiseAdder::addNoiseVR | ( | std::vector< double > & | in, |
std::vector< float > & | noiseRMS | ||
) | [virtual] |
Implements SiNoiseAdder.
Definition at line 44 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution.
Referenced by SiStripDigitizerAlgorithm::run().
{ // Add noise // Full Gaussian noise is added everywhere for (size_t iChannel=0; iChannel!=in.size(); iChannel++) { if(noiseRMS[iChannel] > 0.) in[iChannel] += gaussDistribution->fire(0.,noiseRMS[iChannel]); } }
void SiGaussianTailNoiseAdder::addPedestals | ( | std::vector< double > & | in, |
std::vector< float > & | ped | ||
) | [virtual] |
Implements SiNoiseAdder.
Definition at line 52 of file SiGaussianTailNoiseAdder.cc.
Referenced by SiStripDigitizerAlgorithm::run().
CLHEP::RandGaussQ* SiGaussianTailNoiseAdder::gaussDistribution [private] |
Definition at line 34 of file SiGaussianTailNoiseAdder.h.
Referenced by addCMNoise(), addNoise(), addNoiseVR(), SiGaussianTailNoiseAdder(), and ~SiGaussianTailNoiseAdder().
Definition at line 35 of file SiGaussianTailNoiseAdder.h.
Referenced by addNoise(), SiGaussianTailNoiseAdder(), and ~SiGaussianTailNoiseAdder().
float SiGaussianTailNoiseAdder::pedValue [private] |
Definition at line 31 of file SiGaussianTailNoiseAdder.h.
CLHEP::HepRandomEngine& SiGaussianTailNoiseAdder::rndEngine [private] |
Definition at line 33 of file SiGaussianTailNoiseAdder.h.
Referenced by SiGaussianTailNoiseAdder().
float SiGaussianTailNoiseAdder::threshold [private] |
Definition at line 32 of file SiGaussianTailNoiseAdder.h.
Referenced by addNoise().