5 #include "StSvtHybridNoise.hh"
15 double StSvtHybridNoise::makeGausDev(
double sigma,
double mean)
27 v1 = 2.0*((float)rand()/(float)RAND_MAX) - 1.0;
28 v2 = 2.0*((float)rand()/(float)RAND_MAX) - 1.0;
31 }
while(rsq >= 1.0 || rsq == 0.0);
33 u = ::sqrt(-2.0*::log(rsq)/rsq);
48 double StSvtHybridNoise::prob(
double sigma,
double threshold)
51 double num = 0, prob = 0;
53 num = threshold/(M_SQRT2*sigma);
54 prob = 0.5*(1. - erf(num));
59 double StSvtHybridNoise::maxDistValue(
double sigma ,
double threshold)
61 double num = 0, distValue = 0, coeff;
63 num = threshold/(M_SQRT2*sigma);
64 coeff = 1.0/(sigma*M_PI);
66 distValue = coeff*exp(-num*num);
72 double StSvtHybridNoise::countAboveThreshold(
double sigma,
double randNum)
77 count = sigma*::sqrt(2*M_PI)*randNum;
78 count =sigma*::sqrt( -2.0*::log(count));