CGEM BOSS
6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRandom.cc
Go to the documentation of this file.
1
//--------------------------------------------------------------------------
2
//
3
// Environment:
4
// This software is part of the EvtGen package developed jointly
5
// for the BaBar and CLEO collaborations. If you use all or part
6
// of it, please give an appropriate acknowledgement.
7
//
8
// Copyright Information: See EvtGen/COPYRIGHT
9
// Copyright (C) 1998 Caltech, UCSB
10
//
11
// Module: EvtRandom.cc
12
//
13
// Description: routines to get random numbers from
14
// random number generator.
15
//
16
// Modification history:
17
//
18
// DJL/RYD September 25, 1996 Module created
19
//
20
//------------------------------------------------------------------------
21
//
22
#include "
EvtGenBase/EvtPatches.hh
"
23
24
#include <stdlib.h>
25
#include <stdio.h>
26
#include <math.h>
27
#include <iostream>
28
#include "
EvtGenBase/EvtRandomEngine.hh
"
29
#include "
EvtGenBase/EvtRandom.hh
"
30
#include "
EvtGenBase/EvtReport.hh
"
31
using
std::endl;
32
33
34
EvtRandomEngine
* EvtRandom::_randomEngine=0;
35
36
void
EvtRandom::setRandomEngine
(
EvtRandomEngine
* randomEngine){
37
_randomEngine=randomEngine;
38
}
39
40
41
double
EvtRandom::random
(){
42
43
if
(_randomEngine==0){
44
report
(
ERROR
,
"EvtGen"
) <<
"No random engine available in "
45
<<
"EvtRandom::random()."
<<endl;
46
::abort();
47
}
48
49
return
_randomEngine->
random
();
50
51
}
52
53
54
// Random number routine to generate numbers between
55
// min and max. By djl on July 27, 1995.
56
double
EvtRandom::Flat
(
double
min,
double
max){
57
58
if
( min > max ) {
59
report
(
ERROR
,
"EvtGen"
) <<
"min>max in EvtRandom::Flat("
<< min <<
","
<< max <<
")"
<<endl;
60
::abort();
61
}
62
63
return
EvtRandom::random
()*( max - min )+min;
64
65
}
66
67
double
EvtRandom::Flat
(
double
max){
68
69
return
max*
EvtRandom::random
();
70
71
}
72
73
double
EvtRandom::Flat
(){
74
75
return
EvtRandom::random
();
76
77
}
78
79
80
EvtPatches.hh
EvtRandomEngine.hh
EvtRandom.hh
report
ostream & report(Severity severity, const char *facility)
Definition
EvtReport.cc:36
EvtReport.hh
ERROR
@ ERROR
Definition
EvtReport.hh:49
EvtRandomEngine
Definition
EvtRandomEngine.hh:26
EvtRandomEngine::random
virtual double random()
Definition
EvtRandomEngine.cc:31
EvtRandom::random
static double random()
Definition
EvtRandom.cc:41
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cc:73
EvtRandom::setRandomEngine
static void setRandomEngine(EvtRandomEngine *randomEngine)
Definition
EvtRandom.cc:36
6.6.5.i
Generator
BesEvtGen
BesEvtGen-00-01-96-slc6tag
src
EvtGen
EvtGenBase
EvtRandom.cc
Generated by
1.12.0