8 #include "CLHEP/Random/RandPoisson.h" 9 #include "CLHEP/Random/RandFlat.h" 10 #include <gsl/gsl_sf_erf.h> 11 #include <gsl/gsl_sf_result.h> 12 #include <gsl/gsl_randist.h> 13 #include <gsl/gsl_rng.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 )
29 int status = gsl_sf_erf_Q_e(threshold, &result);
32 if (status != 0)
std::cerr<<
"GaussNoiseProducerFP420::could not compute gaussian tail probability for the threshold chosen"<<std::endl;
33 float probabilityLeft = result.val;
36 float meanNumberOfNoisyChannels = probabilityLeft * NumberOfchannels;
37 int numberOfNoisyChannels = CLHEP::RandPoisson::shoot(meanNumberOfNoisyChannels);
42 static gsl_rng
const *
const mt19937 = gsl_rng_alloc (gsl_rng_mt19937);
44 float lowLimit = threshold * noiseRMS;
45 for (
int i = 0;
i < numberOfNoisyChannels;
i++) {
48 int theChannelNumber = (
int) CLHEP::RandFlat::shootInt(NumberOfchannels);
51 float noise = gsl_ran_gaussian_tail(mt19937, lowLimit, noiseRMS);
54 theMap[theChannelNumber] = noise;
float freq_(const float &x)
void generate(int NumberOfchannels, float threshold, float noiseRMS, std::map< int, float, std::less< int > > &theMap)
float gausin_(const float &x)