4 #include "CLHEP/Random/RandGaussQ.h"
10 gaussDistribution(new CLHEP::RandGaussQ(rndEngine)),
19 size_t& minChannel,
size_t& maxChannel,
20 int numStrips,
float noiseRMS)
const {
22 std::vector<std::pair<int,float> > generatedNoise;
26 for (
size_t iChannel=minChannel; iChannel<maxChannel; iChannel++) {
27 if(in[iChannel] != 0) {
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;
44 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
45 if(noiseRMS[iChannel] > 0.) in[iChannel] +=
gaussDistribution->fire(0.,noiseRMS[iChannel]);
50 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
51 if(ped[iChannel]>0.) in[iChannel] += ped[iChannel];
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)];
65 size_t nAPVs = in.size()/128;
66 std::vector<float> vShift;
67 double apvCharge, apvMult;
70 for(
size_t APVn =0; APVn < nAPVs; ++APVn){
71 apvMult=0; apvCharge=0;
72 for(iChannel=APVn*128; iChannel!=APVn*128+128; ++iChannel) {
75 apvCharge+= in[iChannel];
77 if(apvMult==0) vShift.push_back(0);
78 else vShift.push_back(apvCharge/apvMult);
82 for (iChannel=0; iChannel!=in.size(); ++iChannel) {
83 if(!badChannels[iChannel]) in[iChannel] -= vShift[(int)(iChannel/128)];
void addPedestals(std::vector< float > &, std::vector< float > &) const
std::unique_ptr< GaussianTailNoiseGenerator > genNoise
~SiGaussianTailNoiseAdder()
SiGaussianTailNoiseAdder(float, CLHEP::HepRandomEngine &)
void addNoiseVR(std::vector< float > &, std::vector< float > &) const
void addBaselineShift(std::vector< float > &, std::vector< bool > &) const
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution
void addNoise(std::vector< float > &, size_t &, size_t &, int, float) const
void addCMNoise(std::vector< float > &, float, std::vector< bool > &) const