| The Gaudi Framework v32r1 (f65d50dc)

HepRndmGenerator.h
Go to the documentation of this file.
1 //====================================================================
2 // CLHEP Random Generator definition file
3 //--------------------------------------------------------------------
4 //
5 // Package : HepRndm ( The LHCb Offline System)
6 // Author : M.Frank
7 // History :
8 // +---------+----------------------------------------------+---------
9 // | Date | Comment | Who
10 // +---------+----------------------------------------------+---------
11 // | 29/10/99| Initial version | MF
12 // +---------+----------------------------------------------+---------
13 //
14 //====================================================================
15 #ifndef HEPRNDM_HEPRNDMGENERATOR_H
16 #define HEPRNDM_HEPRNDMGENERATOR_H 1
17
18 // Framework include files
19 #include "RndmGen.h"
20 #include "RndmGenSvc.h"
21
22 #include "HepRndmBaseEngine.h"
23
24 namespace HepRndm {
25
26 template <class TYPE>
27 class Generator : public RndmGen {
28 public:
29 typedef TYPE Parameters;
30
31 protected:
32 CLHEP::HepRandomEngine* m_hepEngine = nullptr;
33 TYPE* m_specs = nullptr;
34
35 public:
36 Generator( IInterface* engine ) : RndmGen( engine ) {}
38 StatusCode initialize( const IRndmGen::Param& par ) override;
40 double shoot() const override;
41 };
42
44 template <class TYPE>
45 StatusCode Generator<TYPE>::initialize( const IRndmGen::Param& par ) {
46 StatusCode status = RndmGen::initialize( par );
47 if ( status.isSuccess() ) {
48 try {
49 m_specs = dynamic_cast<TYPE*>( m_params.get() );
50 if ( m_specs ) {
51 BaseEngine* engine = dynamic_cast<BaseEngine*>( m_engine.get() );
52 if ( engine ) {
53 m_hepEngine = engine->hepEngine();
54 if ( m_hepEngine ) { return StatusCode::SUCCESS; }
55 }
56 }
57 } catch ( ... ) {}
58 }
59 return StatusCode::FAILURE;
60 }
61 } // namespace HepRndm
62
63 #endif // HEPRNDM_HEPRNDMGENERATOR_H
RndmGenSvc.h
HepRndm::Generator::Parameters
TYPE Parameters
Definition: HepRndmGenerator.h:29
HepRndm::Generator::shoot
double shoot() const override
Single shot.
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
HepRndm::Generator::Generator
Generator(IInterface *engine)
Definition: HepRndmGenerator.h:36
HepRndmBaseEngine.h
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:465
HepRndm::Generator::initialize
StatusCode initialize(const IRndmGen::Param &par) override
Initialize the generator.
Definition: HepRndmGenerator.h:45
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IRndmGen::Param
Definition: IRndmGen.h:39
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
RndmGen::initialize
StatusCode initialize(const IRndmGen::Param &par) override
IRndmGen implementation.
Definition: RndmGen.cpp:26
RndmGen.h
RndmGen
Random Generator definition.
Definition: RndmGen.h:41
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
HepRndm
Definition: HepRndmBaseEngine.h:27
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
HepRndm::BaseEngine
Definition: HepRndmBaseEngine.h:29
HepRndm::Generator::m_specs
TYPE * m_specs
Definition: HepRndmGenerator.h:33
HepRndm::Generator
Definition: HepRndmGenerator.h:27
HepRndm::Generator::m_hepEngine
CLHEP::HepRandomEngine * m_hepEngine
Definition: HepRndmGenerator.h:32
HepRndm::BaseEngine::hepEngine
CLHEP::HepRandomEngine * hepEngine()
Definition: HepRndmBaseEngine.h:35