BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BhlumiRandom.cxx
Go to the documentation of this file.
1#include "BhlumiRandom.h"
2
3#include <iostream>
4using namespace std;
5using namespace CLHEP;
6
7HepRandomEngine* BhlumiRandom::_randomEngine = 0;
8
9void BhlumiRandom::setRandomEngine( CLHEP::HepRandomEngine* randomEngine ) {
10 _randomEngine = randomEngine;
11}
12
14
15 if ( _randomEngine == 0 )
16 {
17 cerr << "No random engine available in "
18 << "BhlumiRandom::random()." << endl;
19 }
20 return _randomEngine->flat();
21}
22
23double BhlumiRandom::Flat( double min, double max ) {
24
25 if ( min > max )
26 { cerr << "min>max in BhlumiRandom::Flat(" << min << "," << max << ")" << endl; }
27
28 return BhlumiRandom::random() * ( max - min ) + min;
29}
30
31double BhlumiRandom::Flat( double max ) { return max * BhlumiRandom::random(); }
32
34
35void BhlumiRandom::FlatArray( double* vect, const int size ) {
36 if ( _randomEngine == 0 )
37 cout << "Can not get randomEngine pointer in BhlumiRandom::FlatArray" << endl;
38 else _randomEngine->flatArray( size, vect );
39}
#define min(a, b)
#define max(a, b)
static void FlatArray(double *vect, const int size)
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
static double random()
static double Flat()