4 #include "CLHEP/Random/RandGaussQ.h"
22 size_t& minChannel,
size_t& maxChannel,
23 int numStrips,
float noiseRMS){
25 std::vector<std::pair<int,float> > generatedNoise;
29 for (
size_t iChannel=minChannel; iChannel<maxChannel; iChannel++) {
30 if(in[iChannel] != 0) {
36 typedef std::vector<std::pair<int,float> >::const_iterator VI;
37 for(VI
p = generatedNoise.begin();
p != generatedNoise.end();
p++){
38 if(in[(*p).first] == 0) {
39 in[(*p).first] += (*p).second;
47 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
48 if(noiseRMS[iChannel] > 0.) in[iChannel] +=
gaussDistribution->fire(0.,noiseRMS[iChannel]);
53 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
54 if(ped[iChannel]>0.) in[iChannel] += ped[iChannel];
59 int nAPVs = in.size()/128;
60 std::vector<float> CMNv;
61 for(
int APVn =0; APVn < nAPVs; ++APVn) CMNv.push_back(
gaussDistribution->fire(0.,cmnRMS));
62 for (
size_t iChannel=0; iChannel!=in.size(); iChannel++) {
63 if(!badChannels[iChannel]) in[iChannel] += CMNv[(int)(iChannel/128)];
68 size_t nAPVs = in.size()/128;
69 std::vector<float> vShift;
70 double apvCharge, apvMult;
73 for(
size_t APVn =0; APVn < nAPVs; ++APVn){
74 apvMult=0; apvCharge=0;
75 for(iChannel=APVn*128; iChannel!=APVn*128+128; ++iChannel) {
78 apvCharge+= in[iChannel];
80 if(apvMult==0) vShift.push_back(0);
81 else vShift.push_back(apvCharge/apvMult);
85 for (iChannel=0; iChannel!=in.size(); ++iChannel) {
86 if(!badChannels[iChannel]) in[iChannel] -= vShift[(int)(iChannel/128)];
GaussianTailNoiseGenerator * genNoise
void addCMNoise(std::vector< double > &, float, std::vector< bool > &)
CLHEP::HepRandomEngine & rndEngine
void addBaselineShift(std::vector< double > &, std::vector< bool > &)
void addNoiseVR(std::vector< double > &, std::vector< float > &)
~SiGaussianTailNoiseAdder()
SiGaussianTailNoiseAdder(float, CLHEP::HepRandomEngine &)
CLHEP::RandGaussQ * gaussDistribution
void addNoise(std::vector< double > &, size_t &, size_t &, int, float)
void generate(int NumberOfchannels, float threshold, float noiseRMS, std::map< int, float > &theMap)
void addPedestals(std::vector< double > &, std::vector< float > &)