BOSS
8.0.0
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 "
EvtPatches.hh
"
23
24
#include "
EvtRandom.hh
"
25
#include "
EvtRandomEngine.hh
"
26
#include "
EvtReport.hh
"
27
#include <iostream>
28
#include <math.h>
29
#include <stdio.h>
30
#include <stdlib.h>
31
using
std::endl;
32
33
EvtRandomEngine
* EvtRandom::_randomEngine = 0;
34
35
void
EvtRandom::setRandomEngine
(
EvtRandomEngine
* randomEngine ) {
36
_randomEngine = randomEngine;
37
}
38
39
double
EvtRandom::random
() {
40
41
if
( _randomEngine == 0 )
42
{
43
report
(
ERROR
,
"EvtGen"
) <<
"No random engine available in "
44
<<
"EvtRandom::random()."
<< endl;
45
::abort();
46
}
47
48
double
rdm = _randomEngine->
random
();
49
// std::cout<<"EvtRandom::Flat= "<<rdm<<std::endl;
50
return
rdm;
51
}
52
53
// Random number routine to generate numbers between
54
// min and max. By djl on July 27, 1995.
55
double
EvtRandom::Flat
(
double
min
,
double
max
) {
56
57
if
(
min
>
max
)
58
{
59
report
(
ERROR
,
"EvtGen"
) <<
"min>max in EvtRandom::Flat("
<<
min
<<
","
<<
max
<<
")"
60
<< endl;
61
::abort();
62
}
63
64
return
EvtRandom::random
() * (
max
-
min
) +
min
;
65
}
66
67
double
EvtRandom::Flat
(
double
max
) {
return
max
*
EvtRandom::random
(); }
68
69
double
EvtRandom::Flat
() {
return
EvtRandom::random
(); }
min
#define min(a, b)
Definition
Eepipi/src/ee2eepp/basesv5.1/f2c.h:157
max
#define max(a, b)
Definition
Eepipi/src/ee2eepp/basesv5.1/f2c.h:158
EvtPatches.hh
EvtRandomEngine.hh
EvtRandom.hh
report
ostream & report(Severity severity, const char *facility)
Definition
EvtReport.cc:34
EvtReport.hh
ERROR
@ ERROR
Definition
EvtReport.hh:49
EvtRandomEngine
Definition
EvtRandomEngine.hh:26
EvtRandomEngine::random
virtual double random()
Definition
EvtRandomEngine.cc:30
EvtRandom::random
static double random()
Definition
EvtRandom.cc:39
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cc:69
EvtRandom::setRandomEngine
static void setRandomEngine(EvtRandomEngine *randomEngine)
Definition
EvtRandom.cc:35
8.0.0
BOSS_Gen
BesEvtGen
src
EvtGen
EvtGenBase
EvtRandom.cc
Generated by
1.16.1