CGEM BOSS
6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
BabayagaRandom.cxx
Go to the documentation of this file.
1
//--------------------------------------------------------------------------
2
//
3
// Module: BabayagaRandom.h
4
//
5
// Description: routines to unify random numbers using Bes random service
6
//
7
// Modification history:
8
//
9
// Ping RG Feb. 16, 2009 Module created
10
//
11
//------------------------------------------------------------------------
12
//
13
14
#include "
../Babayaga/BabayagaRandom.h
"
15
16
#include "CLHEP/Random/RanluxEngine.h"
17
#include <iostream>
18
using namespace
std
;
19
using namespace
CLHEP;
20
21
HepRandomEngine* BabayagaRandom::_randomEngine=0;
22
23
void
BabayagaRandom::setRandomEngine
(CLHEP::HepRandomEngine* randomEngine){
24
_randomEngine=randomEngine;
25
}
26
27
28
double
BabayagaRandom::random
(){
29
30
if
(_randomEngine==0){
31
cerr <<
"No random engine available in "
32
<<
"BabayagaRandom::random()."
<<endl;
33
}
34
return
_randomEngine->flat();
35
}
36
37
38
39
double
BabayagaRandom::Flat
(
double
min,
double
max){
40
41
if
( min > max ) {
42
cerr<<
"min>max in BabayagaRandom::Flat("
<< min <<
","
<< max <<
")"
<<endl;
43
}
44
45
return
BabayagaRandom::random
()*( max - min )+min;
46
47
}
48
49
double
BabayagaRandom::Flat
(
double
max){
50
51
return
max*
BabayagaRandom::random
();
52
53
}
54
55
double
BabayagaRandom::Flat
(){
56
57
return
BabayagaRandom::random
();
58
59
}
60
61
void
BabayagaRandom::FlatArray
(
double
* vect,
const
int
size){
62
if
(_randomEngine == 0) cout<<
"Can not get randomEngine pointer in BabayagaRandom::FlatArray"
<<endl;
63
else
_randomEngine->flatArray(size,vect);
64
}
65
66
67
BabayagaRandom.h
BabayagaRandom::setRandomEngine
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
Definition
BabayagaRandom.cxx:23
BabayagaRandom::Flat
static double Flat()
Definition
BabayagaRandom.cxx:55
BabayagaRandom::FlatArray
static void FlatArray(double *vect, const int size)
Definition
BabayagaRandom.cxx:61
BabayagaRandom::random
static double random()
Definition
BabayagaRandom.cxx:28
std
Definition
RootEventData_rootcint.cxx:16
6.6.5.h
Generator
Babayaga
Babayaga-00-00-25
src
BabayagaRandom.cxx
Generated by
1.12.0