7 #include "CLHEP/Random/RandFlat.h"
8 #include "CLHEP/Random/RandPoisson.h"
10 #include <gsl/gsl_randist.h>
11 #include <gsl/gsl_rng.h>
12 #include <gsl/gsl_sf_erf.h>
13 #include <gsl/gsl_sf_result.h>
15 extern "C" float freq_(
const float &
x);
16 extern "C" float gausin_(
const float &
x);
21 std::map<
int,
float, std::less<int>> &theMap) {
27 int status = gsl_sf_erf_Q_e(threshold, &result);
32 std::cerr <<
"GaussNoiseProducerFP420::could not compute gaussian tail "
33 "probability for the threshold chosen"
35 float probabilityLeft = result.val;
39 float meanNumberOfNoisyChannels = probabilityLeft * NumberOfchannels;
40 int numberOfNoisyChannels = CLHEP::RandPoisson::shoot(meanNumberOfNoisyChannels);
45 static gsl_rng
const *
const mt19937 = gsl_rng_alloc(gsl_rng_mt19937);
47 float lowLimit = threshold * noiseRMS;
48 for (
int i = 0;
i < numberOfNoisyChannels;
i++) {
50 int theChannelNumber = (int)CLHEP::RandFlat::shootInt(NumberOfchannels);
54 float noise = gsl_ran_gaussian_tail(mt19937, lowLimit, noiseRMS);
57 theMap[theChannelNumber] =
noise;
float freq_(const float &x)
float gausin_(const float &x)
void generate(int NumberOfchannels, float threshold, float noiseRMS, std::map< int, float, std::less< int >> &theMap)