BOSS 7.1.2
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 "KKMC/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
36
38
39 if (_randomEngine==0){
40 cerr <<"No random engine available in "
41 <<"KKMCRandom::random()."<<endl;
42 }
43
44 return _randomEngine->flat();
45 }
46
47
48
49double KKMCRandom::Flat( double min, double max){
50
51 if ( min > max ) {
52 cerr<< "min>max in KKMCRandom::Flat(" << min << "," << max << ")" <<endl;
53 }
54
55 return KKMCRandom::random()*( max - min )+min;
56
57}
58
59double KKMCRandom::Flat(double max){
60
61 return max*KKMCRandom::random();
62
63}
64
66
67 return KKMCRandom::random();
68
69 }
70
71void KKMCRandom::FlatArray(double* vect, const int size){
72 if(_randomEngine == 0) cout<<"Can not get randomEngine pointer in KKMCRandom::FlatArray"<<endl;
73 else _randomEngine->flatArray(size,vect);
74}
75
76
77//----------------
78extern "C"{
79 extern double rlu_(int *); //jetset74
80}
81
82
83double rlu_(int *){
84 double rdm= KKMCRandom::Flat();
85 // std::cout<<"rlu_ = "<<rdm<<std::endl;
86 return rdm;
87 }
double rlu_(int *)
static double Flat()
static void FlatArray(double *vect, const int size)
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
static double random()