BOSS 8.0.0
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
24#include "BabayagaNLORandom.h"
25
26#include <iostream>
27using namespace std;
28using namespace CLHEP;
29
30HepRandomEngine* BabayagaNLORandom::_randomEngine = 0;
31
32void BabayagaNLORandom::setRandomEngine( CLHEP::HepRandomEngine* randomEngine ) {
33 _randomEngine = randomEngine;
34}
35
37
38 if ( _randomEngine == 0 )
39 {
40 cerr << "No random engine available in "
41 << "BabayagaNLORandom::random()." << endl;
42 }
43
44 return _randomEngine->flat();
45}
46
47double BabayagaNLORandom::Flat( double min, double max ) {
48
49 if ( min > max )
50 {
51 cerr << "min>max in BabayagaNLORandom::Flat(" << min << "," << max << ")" << endl;
52 double tmp = min;
53 min = max;
54 max = tmp;
55 }
56
57 return BabayagaNLORandom::random() * ( max - min ) + min;
58}
59
61
63
64void BabayagaNLORandom::FlatArray( double* vect, const int size ) {
65 if ( _randomEngine == 0 )
66 cout << "Can not get randomEngine pointer in BabayagaNLORandom::FlatArray" << endl;
67 else { _randomEngine->flatArray( size, vect ); }
68}
69
70void BabayagaNLORandom::FlatArrayF( float* vect, const int size ) {
71
72 if ( _randomEngine == 0 )
73 {
74 cout << "Can not get randomEngine pointer in BabayagaNLORandom::FlatArray" << endl;
75 return;
76 }
77 else
78 {
79 for ( int ir = 0; ir < size; ir++ ) vect[ir] = _randomEngine->flat();
80 }
81}
82
83extern "C" {
84
85void babayaga_ranlux_( float* vect, const int& size ) {
87}
88
89void babayaga_ranluxd_( double* vect, const int& size ) {
90 BabayagaNLORandom::FlatArray( vect, size );
91}
92}
void babayaga_ranlux_(float *vect, const int &size)
void babayaga_ranluxd_(double *vect, const int &size)
#define min(a, b)
#define max(a, b)
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)