CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/GeneratorInterface/ThePEGInterface/interface/RandomEngineGlue.h

Go to the documentation of this file.
00001 #ifndef GeneratorInterface_ThePEGInterface_RandomEngineGlue_h
00002 #define GeneratorInterface_ThePEGInterface_RandomEngineGlue_h
00003 
00004 #include <string>
00005 
00006 #include <boost/shared_ptr.hpp>
00007 
00008 #include <ThePEG/Interface/ClassDocumentation.h>
00009 #include <ThePEG/Interface/InterfacedBase.h>
00010 #include <ThePEG/Interface/Parameter.h>
00011 #include <ThePEG/Utilities/ClassTraits.h>
00012 
00013 #include <ThePEG/Repository/StandardRandom.h>
00014 
00015 #include "GeneratorInterface/ThePEGInterface/interface/Proxy.h"
00016 
00017 namespace CLHEP {
00018         class HepRandomEngine;  // forward declaration
00019 }
00020 
00021 namespace ThePEG {
00022 
00023 class RandomEngineGlue : public RandomGenerator {
00024     public:
00025         RandomEngineGlue();
00026         virtual ~RandomEngineGlue();
00027 
00028         void flush();
00029 
00030         static void Init();
00031 
00032         class Proxy : public ThePEG::Proxy<Proxy> {
00033             public:
00034                 RandomEngineGlue *getInstance() const { return instance; }
00035 
00036             private:
00037                 friend class RandomEngineGlue;
00038                 friend class ThePEG::Proxy<Proxy>;
00039 
00040                 inline Proxy(ProxyID id) : Base(id), instance(0) {}
00041 
00042                 RandomEngineGlue *instance;
00043         };
00044 
00045     protected:
00046         virtual void fill();
00047         virtual void setSeed(long seed);
00048 
00049         virtual IBPtr clone() const { return new_ptr(*this); }
00050         virtual IBPtr fullclone() const { return new_ptr(*this); }
00051 
00052         virtual void doinit() throw(InitException);
00053 
00054     private:
00055         Proxy::ProxyID          proxyID;
00056         CLHEP::HepRandomEngine  *randomEngine;
00057 
00058         static ClassDescription<RandomEngineGlue> initRandomEngineGlue;
00059 };
00060 
00061 template<>
00062 struct BaseClassTrait<RandomEngineGlue, 1> : public ClassTraitsType {
00064         typedef RandomGenerator NthBase;
00065 };
00066 
00069 template<>
00070 struct ClassTraits<RandomEngineGlue> :
00071                         public ClassTraitsBase<RandomEngineGlue> {
00073         static string className() { return "ThePEG::RandomEngineGlue"; }
00074         static string library() { return "libGeneratorInterfaceThePEGInterface.so"; }
00075 };
00076 
00077 } // namespace ThePEG
00078 
00079 #endif // GeneratorInterface_ThePEGInterface_RandomEngineGlue_h