BOSS 7.0.9
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>
18using namespace std;
19using namespace CLHEP;
20
21HepRandomEngine* BabayagaRandom::_randomEngine=0;
22
23void BabayagaRandom::setRandomEngine(CLHEP::HepRandomEngine* randomEngine){
24 _randomEngine=randomEngine;
25}
26
27
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
39double 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
50
52
53}
54
56
58
59 }
60
61void 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
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
static double Flat()
static void FlatArray(double *vect, const int size)
static double random()