CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RandBreitWigner.h

Go to the documentation of this file.
00001 // $Id: RandBreitWigner.h,v 1.3.4.1 2005/03/18 22:26:48 garren 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 // M Fischler      - put and get to/from streams 12/10/04
00023 // =======================================================================
00024 
00025 #ifndef RandBreitWigner_h
00026 #define RandBreitWigner_h 1
00027 
00028 #include "CLHEP/Random/defs.h"
00029 #include "CLHEP/Random/RandFlat.h"
00030 
00031 namespace CLHEP {
00032 
00037 class RandBreitWigner : public HepRandom {
00038 
00039 public:
00040 
00041   inline RandBreitWigner ( HepRandomEngine& anEngine, double a=1.0,
00042                                        double b=0.2 );
00043   inline RandBreitWigner ( HepRandomEngine* anEngine, double a=1.0,
00044                                        double b=0.2 );
00045   // These constructors should be used to instantiate a RandBreitWigner
00046   // distribution object defining a local engine for it.
00047   // The static generator will be skipped using the non-static methods
00048   // defined below.
00049   // If the engine is passed by pointer the corresponding engine object
00050   // will be deleted by the RandBreitWigner destructor.
00051   // If the engine is passed by reference the corresponding engine object
00052   // will not be deleted by the RandBreitWigner destructor.
00053 
00054   virtual ~RandBreitWigner();
00055   // Destructor
00056 
00057   // Static methods to shoot random values using the static generator
00058 
00059   static  double shoot( double a=1.0, double b=0.2 );
00060 
00061   static  double shoot( double a, double b, double c );
00062 
00063   static  double shootM2( double a=1.0, double b=0.2 );
00064 
00065   static  double shootM2( double a, double b, double c );
00066 
00067   static  void shootArray ( const int size, double* vect);
00068 
00069   static  void shootArray ( const int size, double* vect,
00070                             double a, double b );
00071 
00072   static  void shootArray ( const int size, double* vect,
00073                             double a, double b, double c );
00074                            
00075   //  Static methods to shoot random values using a given engine
00076   //  by-passing the static generator.
00077 
00078   static  double shoot( HepRandomEngine* anEngine, double a=1.0,
00079                            double b=0.2 );
00080   static  double shoot( HepRandomEngine* anEngine, double a,
00081                            double b, double c );
00082   static  double shootM2( HepRandomEngine* anEngine, double a=1.0,
00083                              double b=0.2 );
00084   static  double shootM2( HepRandomEngine* anEngine, double a,
00085                              double b, double c );
00086   static  void shootArray ( HepRandomEngine* anEngine,
00087                             const int size, double* vect );
00088   static  void shootArray ( HepRandomEngine* anEngine,
00089                             const int size, double* vect,
00090                             double a, double b );
00091   static  void shootArray ( HepRandomEngine* anEngine,
00092                             const int size, double* vect,
00093                             double a, double b, double c );
00094 
00095   //  Methods using the localEngine to shoot random values, by-passing
00096   //  the static generator. These methods respect distribution parameters
00097   //  passed by the user at instantiation unless superseded by actual
00098   //  arguments in the call.
00099 
00100   double fire();
00101 
00102   double fire( double a, double b );
00103 
00104   double fire( double a, double b, double c );
00105 
00106   double fireM2();
00107 
00108   double fireM2( double a, double b );
00109 
00110   double fireM2( double a, double b, double c );
00111 
00112   void fireArray ( const int size, double* vect);
00113 
00114   void fireArray ( const int size, double* vect,
00115                    double a, double b );
00116 
00117   void fireArray ( const int size, double* vect,
00118                    double a, double b, double c );
00119   double operator()();
00120   double operator()( double a, double b );
00121   double operator()( double a, double b, double c );
00122 
00123   // Save and restore to/from streams
00124   
00125   std::ostream & put ( std::ostream & os ) const;
00126   std::istream & get ( std::istream & is );
00127 
00128   std::string name() const;
00129   HepRandomEngine & engine();
00130 
00131   static std::string distributionName() {return "RandBreitWigner";}  
00132   // Provides the name of this distribution class
00133          
00134 private:
00135 
00136   // Private copy constructor. Defining it here disallows use.
00137   RandBreitWigner(const RandBreitWigner& d);
00138 
00139   HepRandomEngine* localEngine;
00140   bool deleteEngine;
00141   double defaultA;
00142   double defaultB;
00143 
00144 };
00145 
00146 }  // namespace CLHEP
00147 
00148 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00149 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00150 using namespace CLHEP;
00151 #endif
00152 
00153 #include "CLHEP/Random/RandBreitWigner.icc"
00154 
00155 #endif

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7