P8RndmEngine

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#ifndef GeneratorInterface_Pythia8Interface_P8RndmEngine_h
#define GeneratorInterface_Pythia8Interface_P8RndmEngine_h

/** \class gen::P8RndmEngine

Description: Used to set an external random number engine
in Pythia 8.  Pythia 8 recognizes a class that has
Pythia8::RndmEngine as a base class and a virtual
flat method.  If you pass a pointer to an object of
this class to Pythia 8 it will use it to generate
random numbers.

Independent of Pythia 8, one can set the CLHEP
engine that this class uses in its flat method.

\author W. David Dagenhart, created 26 November 2013
*/

#include "Pythia8/Basics.h"

namespace CLHEP {
  class HepRandomEngine;
}

namespace gen {

  class P8RndmEngine : public Pythia8::RndmEngine {
  public:
    P8RndmEngine() : randomEngine_(nullptr) {}

    // Routine for generating a random number.
    double flat() override;

    void setRandomEngine(CLHEP::HepRandomEngine* v) { randomEngine_ = v; }

  private:
    void throwNullPtr() const;

    CLHEP::HepRandomEngine* randomEngine_;
  };
  typedef std::shared_ptr<P8RndmEngine> P8RndmEnginePtr;
}  // namespace gen
#endif