CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
BhwideRandom.cxx
Go to the documentation of this file.
2
3#include "CLHEP/Random/RanluxEngine.h"
4#include <iostream>
5using namespace std;
6using namespace CLHEP;
7
8HepRandomEngine* BhwideRandom::_randomEngine=0;
9
10void BhwideRandom::setRandomEngine(CLHEP::HepRandomEngine* randomEngine){
11 _randomEngine=randomEngine;
12}
13
15
16 if (_randomEngine==0){
17 cerr <<"No random engine available in "
18 <<"BhwideRandom::random()."<<endl;
19 }
20 return _randomEngine->flat();
21 }
22
23
24
25double BhwideRandom::Flat( double min, double max){
26
27 if ( min > max ) {
28 cerr<< "min>max in BhwideRandom::Flat(" << min << "," << max << ")" <<endl;
29 }
30
31 return BhwideRandom::random()*( max - min )+min;
32
33}
34
35double BhwideRandom::Flat(double max){
36
37 return max*BhwideRandom::random();
38
39}
40
42
43 return BhwideRandom::random();
44
45 }
46
47void BhwideRandom::FlatArray(double* vect, const int size){
48 if(_randomEngine == 0) cout<<"Can not get randomEngine pointer in BhwideRandom::FlatArray"<<endl;
49 else _randomEngine->flatArray(size,vect);
50}
51
52
53
static void FlatArray(double *vect, const int size)
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
static double random()
static double Flat()