RandExponential.icc

Go to the documentation of this file.
00001 // $Id:$
00002 // -*- C++ -*-
00003 // 
00004 // -----------------------------------------------------------------------
00005 //                             HEP Random
00006 //                       --- RandExponential ---
00007 //                 inlined functions implementation file
00008 // -----------------------------------------------------------------------
00009 // This file is part of Geant4 (simulation toolkit for HEP).
00010  
00011 // =======================================================================
00012 // Gabriele Cosmo - Created: 19th August 1998
00013 // =======================================================================
00014 
00015 #include <cmath>        // for log()
00016 
00017 namespace CLHEP {
00018 
00019 inline RandExponential::RandExponential(HepRandomEngine & anEngine,
00020                                         double mean )
00021 : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), defaultMean(mean) {}
00022 
00023 inline RandExponential::RandExponential(HepRandomEngine * anEngine,
00024                                         double mean )
00025 : HepRandom(), localEngine(anEngine), defaultMean(mean) {}
00026 
00027 //-------------
00028 
00029 inline double RandExponential::shoot(HepRandomEngine* anEngine) {
00030   return -std::log(anEngine->flat());
00031 }
00032 
00033 inline double RandExponential::shoot(HepRandomEngine* anEngine,
00034                                         double mean) {
00035   return -std::log(anEngine->flat())*mean;
00036 }
00037 
00038 //-------------
00039 
00040 inline double RandExponential::fire() {
00041   return -std::log(localEngine->flat())*defaultMean;
00042 }
00043 
00044 inline double RandExponential::fire(double mean) {
00045   return -std::log(localEngine->flat())*mean;
00046 }
00047 
00048 }  // namespace CLHEP

Generated on Mon May 27 17:50:33 2013 for Geant4 by  doxygen 1.4.7