![]() |
![]() |
#include <SiGaussianTailNoiseAdder.h>
Public Member Functions | |
void | addBaselineShift (std::vector< double > &, std::vector< bool > &) const |
void | addCMNoise (std::vector< double > &, float, std::vector< bool > &) const |
void | addNoise (std::vector< double > &, size_t &, size_t &, int, float) const |
void | addNoiseVR (std::vector< double > &, std::vector< float > &) const |
void | addPedestals (std::vector< double > &, std::vector< float > &) const |
SiGaussianTailNoiseAdder (float, CLHEP::HepRandomEngine &) | |
~SiGaussianTailNoiseAdder () | |
Private Attributes | |
std::unique_ptr < CLHEP::RandGaussQ > | gaussDistribution |
std::unique_ptr < GaussianTailNoiseGenerator > | genNoise |
CLHEP::HepRandomEngine & | rndEngine |
const float | threshold |
Definition at line 18 of file SiGaussianTailNoiseAdder.h.
SiGaussianTailNoiseAdder::SiGaussianTailNoiseAdder | ( | float | th, |
CLHEP::HepRandomEngine & | eng | ||
) |
Definition at line 7 of file SiGaussianTailNoiseAdder.cc.
: threshold(th), rndEngine(eng), gaussDistribution(new CLHEP::RandGaussQ(rndEngine)), genNoise(new GaussianTailNoiseGenerator(rndEngine)) { }
SiGaussianTailNoiseAdder::~SiGaussianTailNoiseAdder | ( | ) |
Definition at line 15 of file SiGaussianTailNoiseAdder.cc.
{ }
void SiGaussianTailNoiseAdder::addBaselineShift | ( | std::vector< double > & | in, |
std::vector< bool > & | badChannels | ||
) | const [virtual] |
Implements SiNoiseAdder.
Definition at line 64 of file SiGaussianTailNoiseAdder.cc.
Referenced by DigiSimLinkAlgorithm::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 | ||
) | const [virtual] |
Implements SiNoiseAdder.
Definition at line 55 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution.
Referenced by DigiSimLinkAlgorithm::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 | ||
) | const [virtual] |
Implements SiNoiseAdder.
Definition at line 18 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution, genNoise, AlCaHLTBitMon_ParallelJobs::p, and threshold.
Referenced by DigiSimLinkAlgorithm::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 | ||
) | const [virtual] |
Implements SiNoiseAdder.
Definition at line 41 of file SiGaussianTailNoiseAdder.cc.
References gaussDistribution.
Referenced by DigiSimLinkAlgorithm::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 | ||
) | const [virtual] |
Implements SiNoiseAdder.
Definition at line 49 of file SiGaussianTailNoiseAdder.cc.
Referenced by DigiSimLinkAlgorithm::run().
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().