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

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7