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