Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

HepRndmGenerator.h

Go to the documentation of this file.
00001 //====================================================================
00002 //      CLHEP Random Generator definition file
00003 //--------------------------------------------------------------------
00004 //
00005 //      Package    : HepRndm ( The LHCb Offline System)
00006 //      Author     : M.Frank
00007 //  History    :
00008 // +---------+----------------------------------------------+---------
00009 // |    Date |                 Comment                      | Who     
00010 // +---------+----------------------------------------------+---------
00011 // | 29/10/99| Initial version                              | MF
00012 // +---------+----------------------------------------------+---------
00013 //
00014 //====================================================================
00015 #ifndef HEPRNDM_HEPRNDMGENERATOR_H
00016 #define HEPRNDM_HEPRNDMGENERATOR_H 1
00017 
00018 // Framework include files
00019 #include "RndmGen.h"
00020 #include "RndmGenSvc.h"
00021 
00022 #include "HepRndmBaseEngine.h"
00023 
00024 namespace HepRndm  {
00025 
00026   template <class TYPE>
00027   class Generator : public RndmGen   {
00028   public:
00029     typedef TYPE Parameters;
00030   protected:
00031     CLHEP::HepRandomEngine* m_hepEngine;
00032     TYPE*            m_specs;
00033   public: 
00034     Generator(IInterface* engine);
00035     virtual ~Generator();
00037     virtual StatusCode initialize(const IRndmGen::Param& par);
00039     virtual double shoot()  const;
00040   };
00041 
00042   template <class TYPE> Generator<TYPE>::Generator(IInterface* engine)
00043   : RndmGen (engine), m_hepEngine(0), m_specs(0)    {
00044   }
00045 
00046   template <class TYPE> Generator<TYPE>::~Generator()    {  
00047   }
00048 
00050   template <class TYPE> StatusCode Generator<TYPE>::initialize(const IRndmGen::Param& par)   {
00051     StatusCode status = RndmGen::initialize(par);
00052     if ( status.isSuccess() )   {
00053       try   {
00054         m_specs = dynamic_cast<TYPE*>(m_params);
00055         if ( 0 != m_specs )  {
00056           BaseEngine* engine = dynamic_cast<BaseEngine*>(m_engine);
00057           if ( 0 != engine )    {
00058             m_hepEngine = engine->hepEngine();
00059             if ( 0 != m_hepEngine )   {
00060               return StatusCode::SUCCESS;
00061             }
00062           }
00063         }
00064       }
00065       catch (...)   {
00066       }
00067     }
00068     return StatusCode::FAILURE;
00069   }
00070 }
00071 
00072 #endif // HEPRNDM_HEPRNDMGENERATOR_H

Generated at Wed Mar 17 18:06:49 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004