CLHEP/Random/RandBreitWigner.h

00001 // $Id: RandBreitWigner.h,v 1.11 2002/04/12 15:02:44 evc Exp $
00002 // -*- C++ -*-
00003 //
00004 // -----------------------------------------------------------------------
00005 //                             HEP Random
00006 //                        --- RandBreitWigner ---
00007 //                           class header file
00008 // -----------------------------------------------------------------------
00009 // This file is part of Geant4 (simulation toolkit for HEP).
00010 //
00011 // Class defining methods for shooting numbers according to the
00012 // Breit-Wigner distribution algorithms (plain or mean^2).
00013 // Default values are set: mean=1, gamma=.2, cut=1.
00014 // Plain algorithm is used for shootArray() and fireArray().
00015 // Plain algorithm with default values is used for operator()(). 
00016 
00017 // =======================================================================
00018 // Gabriele Cosmo - Created: 5th September 1995
00019 //                - Added methods to shoot arrays: 28th July 1997
00020 // J.Marraffino   - Added default arguments as attributes and
00021 //                  operator() with arguments: 16th Feb 1998
00022 // =======================================================================
00023 
00024 #ifndef RandBreitWigner_h
00025 #define RandBreitWigner_h 1
00026 
00027 #include "CLHEP/Random/RandFlat.h"
00028 
00033 class RandBreitWigner : public HepRandom {
00034 
00035 public:
00036 
00037   inline RandBreitWigner ( HepRandomEngine& anEngine, double a=1.0,
00038                                        double b=0.2 );
00039   inline RandBreitWigner ( HepRandomEngine* anEngine, double a=1.0,
00040                                        double b=0.2 );
00041   // These constructors should be used to instantiate a RandBreitWigner
00042   // distribution object defining a local engine for it.
00043   // The static generator will be skipped using the non-static methods
00044   // defined below.
00045   // If the engine is passed by pointer the corresponding engine object
00046   // will be deleted by the RandBreitWigner destructor.
00047   // If the engine is passed by reference the corresponding engine object
00048   // will not be deleted by the RandBreitWigner destructor.
00049 
00050   virtual ~RandBreitWigner();
00051   // Destructor
00052 
00053   // Static methods to shoot random values using the static generator
00054 
00055   static  double shoot( double a=1.0, double b=0.2 );
00056 
00057   static  double shoot( double a, double b, double c );
00058 
00059   static  double shootM2( double a=1.0, double b=0.2 );
00060 
00061   static  double shootM2( double a, double b, double c );
00062 
00063   static  void shootArray ( const int size, double* vect);
00064 
00065   static  void shootArray ( const int size, double* vect,
00066                             double a, double b );
00067 
00068   static  void shootArray ( const int size, double* vect,
00069                             double a, double b, double c );
00070                            
00071   //  Static methods to shoot random values using a given engine
00072   //  by-passing the static generator.
00073 
00074   static  double shoot( HepRandomEngine* anEngine, double a=1.0,
00075                            double b=0.2 );
00076   static  double shoot( HepRandomEngine* anEngine, double a,
00077                            double b, double c );
00078   static  double shootM2( HepRandomEngine* anEngine, double a=1.0,
00079                              double b=0.2 );
00080   static  double shootM2( HepRandomEngine* anEngine, double a,
00081                              double b, double c );
00082   static  void shootArray ( HepRandomEngine* anEngine,
00083                             const int size, double* vect );
00084   static  void shootArray ( HepRandomEngine* anEngine,
00085                             const int size, double* vect,
00086                             double a, double b );
00087   static  void shootArray ( HepRandomEngine* anEngine,
00088                             const int size, double* vect,
00089                             double a, double b, double c );
00090 
00091   //  Methods using the localEngine to shoot random values, by-passing
00092   //  the static generator. These methods respect distribution parameters
00093   //  passed by the user at instantiation unless superseded by actual
00094   //  arguments in the call.
00095 
00096   double fire();
00097 
00098   double fire( double a, double b );
00099 
00100   double fire( double a, double b, double c );
00101 
00102   double fireM2();
00103 
00104   double fireM2( double a, double b );
00105 
00106   double fireM2( double a, double b, double c );
00107 
00108   void fireArray ( const int size, double* vect);
00109 
00110   void fireArray ( const int size, double* vect,
00111                    double a, double b );
00112 
00113   void fireArray ( const int size, double* vect,
00114                    double a, double b, double c );
00115   double operator()();
00116   double operator()( double a, double b );
00117   double operator()( double a, double b, double c );
00118   
00119 private:
00120 
00121   // Private copy constructor. Defining it here disallows use.
00122   RandBreitWigner(const RandBreitWigner& d);
00123 
00124   HepRandomEngine* localEngine;
00125   bool deleteEngine;
00126   const double defaultA;
00127   const double defaultB;
00128 
00129 };
00130 
00131 #include "CLHEP/Random/RandBreitWigner.icc"
00132 
00133 #endif

Class Library for High Energy Physics (version 1.8)