/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/Bhwide/Bhwide-00-00-11/src/BhwideRandom.cxx

Go to the documentation of this file.
00001 #include "Bhwide/BhwideRandom.h"
00002 
00003 #include "CLHEP/Random/RanluxEngine.h"
00004 #include <iostream>
00005 using namespace std;
00006 using namespace CLHEP;
00007 
00008 HepRandomEngine* BhwideRandom::_randomEngine=0;
00009 
00010 void BhwideRandom::setRandomEngine(CLHEP::HepRandomEngine* randomEngine){
00011   _randomEngine=randomEngine;
00012 }
00013 
00014 double BhwideRandom::random(){
00015 
00016   if (_randomEngine==0){
00017     cerr <<"No random engine available in "
00018                            <<"BhwideRandom::random()."<<endl;
00019   }
00020     return _randomEngine->flat();
00021   }
00022 
00023 
00024 
00025 double BhwideRandom::Flat( double min, double max){
00026 
00027   if ( min > max ) {
00028     cerr<< "min>max in BhwideRandom::Flat(" << min << "," << max << ")" <<endl;
00029   }
00030 
00031   return BhwideRandom::random()*( max - min )+min;
00032 
00033 } 
00034 
00035 double BhwideRandom::Flat(double max){
00036 
00037   return max*BhwideRandom::random();
00038 
00039 } 
00040 
00041 double BhwideRandom::Flat(){
00042 
00043   return BhwideRandom::random();
00044 
00045  } 
00046 
00047 void BhwideRandom::FlatArray(double* vect, const int size){
00048   if(_randomEngine == 0) cout<<"Can not get randomEngine pointer in BhwideRandom::FlatArray"<<endl;
00049   else _randomEngine->flatArray(size,vect);
00050 }
00051 
00052 
00053 

Generated on Tue Nov 29 23:12:36 2016 for BOSS_7.0.2 by  doxygen 1.4.7