2 #include "CLHEP/Random/RandGaussQ.h"
14 size_t& minChannel,
size_t& maxChannel,
15 int numStrips,
float noiseRMS,
16 CLHEP::HepRandomEngine* engine)
const {
18 std::vector<std::pair<int,float> > generatedNoise;
22 for (
size_t iChannel=minChannel; iChannel<maxChannel; iChannel++) {
23 if(in[iChannel] != 0) {
24 in[iChannel] += CLHEP::RandGaussQ::shoot(engine, 0., noiseRMS);
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;
40 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
41 if(noiseRMS[iChannel] > 0.) in[iChannel] += CLHEP::RandGaussQ::shoot(engine, 0., noiseRMS[iChannel]);
46 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
47 if(ped[iChannel]>0.) in[iChannel] += ped[iChannel];
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)];
61 size_t nAPVs = in.size()/128;
62 std::vector<float> vShift;
63 double apvCharge, apvMult;
66 for(
size_t APVn =0; APVn < nAPVs; ++APVn){
67 apvMult=0; apvCharge=0;
68 for(iChannel=APVn*128; iChannel!=APVn*128+128; ++iChannel) {
71 apvCharge+= in[iChannel];
73 if(apvMult==0) vShift.push_back(0);
74 else vShift.push_back(apvCharge/apvMult);
78 for (iChannel=0; iChannel!=in.size(); ++iChannel) {
79 if(!badChannels[iChannel]) in[iChannel] -= vShift[(int)(iChannel/128)];
void addBaselineShift(std::vector< float > &, std::vector< bool > &) const override
SiGaussianTailNoiseAdder(float)
void addNoise(std::vector< float > &, size_t &, size_t &, int, float, CLHEP::HepRandomEngine *) const override
std::unique_ptr< GaussianTailNoiseGenerator > genNoise
~SiGaussianTailNoiseAdder()
void addPedestals(std::vector< float > &, std::vector< float > &) const override
void addCMNoise(std::vector< float > &, float, std::vector< bool > &, CLHEP::HepRandomEngine *) const override
void addNoiseVR(std::vector< float > &, std::vector< float > &, CLHEP::HepRandomEngine *) const override