BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
KKMCRandom.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtRandom.cc
12//
13// Description: routines to get random numbers from
14// random number generator.
15//
16// Modification history:
17//
18// DJL/RYD September 25, 1996 Module created
19//
20//------------------------------------------------------------------------
21//
22
23#include "KKMCRandom.h"
24
25#include "CLHEP/Random/RanluxEngine.h"
26#include <iostream>
27using namespace std;
28using namespace CLHEP;
29
30HepRandomEngine* KKMCRandom::_randomEngine = 0;
31
32void KKMCRandom::setRandomEngine( CLHEP::HepRandomEngine* randomEngine ) {
33 _randomEngine = randomEngine;
34}
35
37
38 if ( _randomEngine == 0 )
39 {
40 cerr << "No random engine available in "
41 << "KKMCRandom::random()." << endl;
42 }
43
44 return _randomEngine->flat();
45}
46
47double KKMCRandom::Flat( double min, double max ) {
48
49 if ( min > max )
50 { cerr << "min>max in KKMCRandom::Flat(" << min << "," << max << ")" << endl; }
51
52 return KKMCRandom::random() * ( max - min ) + min;
53}
54
55double KKMCRandom::Flat( double max ) { return max * KKMCRandom::random(); }
56
58
59void KKMCRandom::FlatArray( double* vect, const int size ) {
60 if ( _randomEngine == 0 )
61 cout << "Can not get randomEngine pointer in KKMCRandom::FlatArray" << endl;
62 else _randomEngine->flatArray( size, vect );
63}
64
65//----------------
66extern "C" {
67extern float rlu_( int* ); // jetset74
68}
69
70float rlu_( int* ) {
71 float rdm = KKMCRandom::Flat();
72 // std::cout<<"rlu_ = "<<rdm<<std::endl;
73 return rdm;
74}
#define min(a, b)
#define max(a, b)
float rlu_(int *)
static double Flat()
static void FlatArray(double *vect, const int size)
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
static double random()