Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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/RandomEngine.h
"
3
4
#include <cmath>
5
GaussianTail::GaussianTail
(
const
RandomEngine
* engine,
6
double
sigma,
double
threshold
) :
7
random
(engine),
8
sigma_(sigma),
9
threshold_(threshold)
10
{
11
s_
=
threshold_
/
sigma_
;
12
ssquare_
=
s_
*
s_
;
13
}
14
15
GaussianTail::~GaussianTail
()
16
{
17
;
18
}
19
20
double
GaussianTail::shoot
()
const
21
{
22
// in the zero suppresion case, s is usually >2
23
if
(
s_
>1.)
24
{
25
/* Use the "supertail" deviates from the last two steps
26
* of Marsaglia's rectangle-wedge-tail method, as described
27
* in Knuth, v2, 3rd ed, pp 123-128. (See also exercise 11, p139,
28
* and the solution, p586.)
29
*/
30
31
double
u,
v
,
x
;
32
33
do
34
{
35
u =
random
->
flatShoot
();
36
do
37
{
38
v =
random
->
flatShoot
();
39
}
40
while
(v == 0.0);
41
x =
std::sqrt
(
ssquare_
- 2 *
std::log
(v));
42
}
43
while
(x * u >
s_
);
44
return
x *
sigma_
;
45
}
46
else
47
{
48
/* For small s, use a direct rejection method. The limit s < 1
49
can be adjusted to optimise the overall efficiency
50
*/
51
52
double
x
;
53
54
do
55
{
56
x =
random
->
gaussShoot
();
57
}
58
while
(x <
s_
);
59
return
x *
sigma_
;
60
}
61
}
RandomEngine
Definition:
RandomEngine.h:18
GaussianTail::s_
double s_
Definition:
GaussianTail.h:31
GaussianTail::threshold_
double threshold_
Definition:
GaussianTail.h:30
create_public_lumi_plots.log
log
Definition:
create_public_lumi_plots.py:1108
random
TRandom random
Definition:
MVATrainer.cc:138
RandomEngine::gaussShoot
double gaussShoot(double mean=0.0, double sigma=1.0) const
Definition:
RandomEngine.h:37
GaussianTail::GaussianTail
GaussianTail(const RandomEngine *engine, double sigma=1., double threshold=2.)
Definition:
GaussianTail.cc:5
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:46
RandomEngine.h
GaussianTail::random
const RandomEngine * random
Definition:
GaussianTail.h:27
GaussianTail::sigma_
double sigma_
Definition:
GaussianTail.h:29
dtDQMClient_cfg.threshold
tuple threshold
Definition:
dtDQMClient_cfg.py:16
RandomEngine::flatShoot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition:
RandomEngine.h:30
GaussianTail::shoot
double shoot() const
Definition:
GaussianTail.cc:20
GaussianTail::ssquare_
double ssquare_
Definition:
GaussianTail.h:32
x
Definition:
DDAxes.h:10
GaussianTail.h
GaussianTail::~GaussianTail
~GaussianTail()
Definition:
GaussianTail.cc:15
v
mathSSE::Vec4< T > v
Definition:
newBasic3DVector.h:354
Generated for CMSSW Reference Manual by
1.8.5