Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:26

0001 #ifndef GeneratorInterface_Pythia8Interface_P8RndmEngine_h
0002 #define GeneratorInterface_Pythia8Interface_P8RndmEngine_h
0003 
0004 /** \class gen::P8RndmEngine
0005 
0006 Description: Used to set an external random number engine
0007 in Pythia 8.  Pythia 8 recognizes a class that has
0008 Pythia8::RndmEngine as a base class and a virtual
0009 flat method.  If you pass a pointer to an object of
0010 this class to Pythia 8 it will use it to generate
0011 random numbers.
0012 
0013 Independent of Pythia 8, one can set the CLHEP
0014 engine that this class uses in its flat method.
0015 
0016 \author W. David Dagenhart, created 26 November 2013
0017 */
0018 
0019 #include "Pythia8/Basics.h"
0020 
0021 namespace CLHEP {
0022   class HepRandomEngine;
0023 }
0024 
0025 namespace gen {
0026 
0027   class P8RndmEngine : public Pythia8::RndmEngine {
0028   public:
0029     P8RndmEngine() : randomEngine_(nullptr) {}
0030 
0031     // Routine for generating a random number.
0032     double flat() override;
0033 
0034     void setRandomEngine(CLHEP::HepRandomEngine* v) { randomEngine_ = v; }
0035 
0036   private:
0037     void throwNullPtr() const;
0038 
0039     CLHEP::HepRandomEngine* randomEngine_;
0040   };
0041 }  // namespace gen
0042 #endif