BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BabayagaNLORandom.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// Wang Boqun September 06, 2010 Add fortran interface
20//
21//------------------------------------------------------------------------
22//
23
25
26#include "CLHEP/Random/RanluxEngine.h"
27#include <iostream>
28using namespace std;
29using namespace CLHEP;
30
31HepRandomEngine* BabayagaNLORandom::_randomEngine=0;
32
33void BabayagaNLORandom::setRandomEngine(CLHEP::HepRandomEngine* randomEngine){
34 _randomEngine=randomEngine;
35}
36
37
39
40 if (_randomEngine==0){
41 cerr <<"No random engine available in "
42 <<"BabayagaNLORandom::random()."<<endl;
43 }
44
45 return _randomEngine->flat();
46 }
47
48
49
50double BabayagaNLORandom::Flat( double min, double max){
51
52 if ( min > max ) {
53 cerr<< "min>max in BabayagaNLORandom::Flat(" << min << "," << max << ")" <<endl;
54 }
55
56 return BabayagaNLORandom::random()*( max - min )+min;
57
58}
59
61
63
64}
65
67
69
70 }
71
72void BabayagaNLORandom::FlatArray(double* vect, const int size){
73 if(_randomEngine == 0)
74 cout<<"Can not get randomEngine pointer in BabayagaNLORandom::FlatArray"<<endl;
75 else {
76 _randomEngine->flatArray(size,vect);
77 }
78}
79
80void BabayagaNLORandom::FlatArrayF(float* vect, const int size){
81
82 double *dvec = new double [size];
83 if(_randomEngine == 0) {
84 cout<<"Can not get randomEngine pointer in BabayagaNLORandom::FlatArray"<<endl;
85 return;
86 }
87 else {
88 _randomEngine->flatArray(size,dvec);
89 }
90
91 for (int i=0; i<size; i++) vect[i] = dvec[i];
92
93 delete [] dvec;
94}
95
96extern "C" {
97
98 void babayaga_ranlux_ (float* vect, const int &size){
100 }
101
102 void babayaga_ranluxd_ (double* vect, const int &size){
104 }
105
106}
void babayaga_ranlux_(float *vect, const int &size)
void babayaga_ranluxd_(double *vect, const int &size)
static double random()
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
static void FlatArrayF(float *vect, const int size)
static void FlatArray(double *vect, const int size)