src
FastSimulation
Utilities
src
GaussianTail.cc
Go to the documentation of this file.
1
#include "
FastSimulation/Utilities/interface/GaussianTail.h
"
2
#include "
FastSimulation/Utilities/interface/RandomEngineAndDistribution.h
"
3
4
#include <cmath>
5
GaussianTail::GaussianTail
(
double
sigma,
double
threshold
) : sigma_(sigma), threshold_(
threshold
) {
6
s_
=
threshold_
/
sigma_
;
7
ssquare_
=
s_
*
s_
;
8
}
9
10
GaussianTail::~GaussianTail
() { ; }
11
12
double
GaussianTail::shoot
(
RandomEngineAndDistribution
const
* random)
const
{
13
// in the zero suppresion case, s is usually >2
14
if
(
s_
> 1.) {
15
/* Use the "supertail" deviates from the last two steps
16
* of Marsaglia's rectangle-wedge-tail method, as described
17
* in Knuth, v2, 3rd ed, pp 123-128. (See also exercise 11, p139,
18
* and the solution, p586.)
19
*/
20
21
double
u,
v
,
x
;
22
23
do
{
24
u = random->
flatShoot
();
25
do
{
26
v
= random->
flatShoot
();
27
}
while
(
v
== 0.0);
28
x
=
std::sqrt
(
ssquare_
- 2 *
std::log
(
v
));
29
}
while
(
x
* u >
s_
);
30
return
x
*
sigma_
;
31
}
else
{
32
/* For small s, use a direct rejection method. The limit s < 1
33
can be adjusted to optimise the overall efficiency
34
*/
35
36
double
x
;
37
38
do
{
39
x
= random->
gaussShoot
();
40
}
while
(
x
<
s_
);
41
return
x
*
sigma_
;
42
}
43
}
GaussianTail::s_
double s_
Definition:
GaussianTail.h:25
GaussianTail::threshold_
double threshold_
Definition:
GaussianTail.h:24
findQualityFiles.v
v
Definition:
findQualityFiles.py:179
GaussianTail::shoot
double shoot(RandomEngineAndDistribution const *) const
Definition:
GaussianTail.cc:12
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:23
GaussianTail::GaussianTail
GaussianTail(double sigma=1., double threshold=2.)
Definition:
GaussianTail.cc:5
GaussianTail::sigma_
double sigma_
Definition:
GaussianTail.h:23
RandomEngineAndDistribution::gaussShoot
double gaussShoot(double mean=0.0, double sigma=1.0) const
Definition:
RandomEngineAndDistribution.h:29
DiMuonV_cfg.threshold
threshold
Definition:
DiMuonV_cfg.py:101
RandomEngineAndDistribution.h
GaussianTail::ssquare_
double ssquare_
Definition:
GaussianTail.h:26
GaussianTail.h
RandomEngineAndDistribution::flatShoot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition:
RandomEngineAndDistribution.h:27
dqm-mbProfile.log
log
Definition:
dqm-mbProfile.py:17
GaussianTail::~GaussianTail
~GaussianTail()
Definition:
GaussianTail.cc:10
DDAxes::x
RandomEngineAndDistribution
Definition:
RandomEngineAndDistribution.h:18
Generated for CMSSW Reference Manual by
1.8.14