/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/Bhlumi/Bhlumi-00-00-12/src/BhlumiRandom.cxx

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