CLHEP/Random/RandGauss.h
// $Id: RandGauss.h,v 1.12 2000/09/07 13:18:33 mf Exp $
// -*- C++ -*-
//
// -----------------------------------------------------------------------
// HEP Random
// --- RandGauss ---
// class header file
// -----------------------------------------------------------------------
// This file is part of Geant4 (simulation toolkit for HEP).
// Class defining methods for shooting gaussian distributed random values,
// given a mean (default=0) or specifying also a deviation (default=1).
// Gaussian random numbers are generated two at the time, so every
// other time shoot is called the number returned is the one generated the
// time before.
// Default values are used for operator()().
// =======================================================================
// Gabriele Cosmo - Created: 5th September 1995
// - Minor corrections: 31st October 1996
// - Added methods to shoot arrays: 28th July 1997
// J.Marraffino - Added default arguments as attributes and
// operator() with arguments. Introduced method normal()
// for computation in fire(): 16th Feb 1998
// Gabriele Cosmo - Relocated static data from HepRandom: 5th Jan 1999
// =======================================================================
#ifndef RandGauss_h
#define RandGauss_h 1
#include "CLHEP/Random/Random.h"
class RandGauss : public HepRandom {
public:
inline RandGauss ( HepRandomEngine& anEngine, HepDouble mean=0.0,
HepDouble stdDev=1.0 );
inline RandGauss ( HepRandomEngine* anEngine, HepDouble mean=0.0,
HepDouble stdDev=1.0 );
// These constructors should be used to instantiate a RandGauss
// distribution object defining a local engine for it.
// The static generator will be skipped using the non-static methods
// defined below.
// If the engine is passed by pointer the corresponding engine object
// will be deleted by the RandGauss destructor.
// If the engine is passed by reference the corresponding engine object
// will not be deleted by the RandGauss destructor.
virtual ~RandGauss();
// Destructor
// Static methods to shoot random values using the static generator
static HepDouble shoot();
static inline HepDouble shoot( HepDouble mean, HepDouble stdDev );
static void shootArray ( const HepInt size, HepDouble* vect,
HepDouble mean=0.0, HepDouble stdDev=1.0 );
// Static methods to shoot random values using a given engine
// by-passing the static generator.
static HepDouble shoot( HepRandomEngine* anEngine );
static inline HepDouble shoot( HepRandomEngine* anEngine,
HepDouble mean, HepDouble stdDev );
static void shootArray ( HepRandomEngine* anEngine, const HepInt size,
HepDouble* vect, HepDouble mean=0.0,
HepDouble stdDev=1.0 );
// Methods using the localEngine to shoot random values, by-passing
// the static generator.
HepDouble fire();
inline HepDouble fire( HepDouble mean, HepDouble stdDev );
void fireArray ( const HepInt size, HepDouble* vect);
void fireArray ( const HepInt size, HepDouble* vect,
HepDouble mean, HepDouble stdDev );
virtual HepDouble operator()();
virtual HepDouble operator()( HepDouble mean, HepDouble stdDev );
// Methods setFlag(false) and setF(false) if invoked in the client
// code before shoot/fire will force generation of a new couple of
// values.
static HepBoolean getFlag() {return set_st;}
static void setFlag( HepBoolean val ) {set_st = val;}
HepBoolean getF() const {return set;}
void setF( HepBoolean val ) {set = val;}
// Methods overriding the base class static saveEngineStatus ones,
// by adding extra data so that save in one program, then further gaussians,
// will produce the identical sequence to restore in another program, then
// generating gaussian randoms there
static void saveEngineStatus( const char filename[] = "Config.conf" );
// Saves to file the current status of the current engine.
static void restoreEngineStatus( const char filename[] = "Config.conf" );
// Restores a saved status (if any) for the current engine.
protected:
// Protected copy constructor. Defining it here disallows user use.
RandGauss(const RandGauss& d);
static HepDouble getVal() {return nextGauss_st;}
static void setVal( HepDouble nextVal ) {nextGauss_st = nextVal;}
HepDouble normal();
const HepDouble defaultMean;
const HepDouble defaultStdDev;
private:
HepRandomEngine* localEngine;
HepBoolean deleteEngine, set;
HepDouble nextGauss;
// static data
static HepBoolean set_st;
static HepDouble nextGauss_st;
};
#include "CLHEP/Random/RandGauss.icc"
#endif
Generated by GNU enscript 1.6.1.