The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
HepRndmGenerator.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
//====================================================================
12
// CLHEP Random Generator definition file
13
//--------------------------------------------------------------------
14
//
15
// Package : HepRndm ( The LHCb Offline System)
16
// Author : M.Frank
17
// History :
18
// +---------+----------------------------------------------+---------
19
// | Date | Comment | Who
20
// +---------+----------------------------------------------+---------
21
// | 29/10/99| Initial version | MF
22
// +---------+----------------------------------------------+---------
23
//
24
//====================================================================
25
#pragma once
26
27
// Framework include files
28
#include "
RndmGen.h
"
29
#include "
RndmGenSvc.h
"
30
31
#include "
HepRndmBaseEngine.h
"
32
33
namespace
HepRndm
{
34
35
template
<
class
TYPE>
36
class
Generator
:
public
RndmGen
{
37
public
:
38
typedef
TYPE
Parameters
;
39
40
protected
:
41
CLHEP::HepRandomEngine*
m_hepEngine
=
nullptr
;
42
TYPE*
m_specs
=
nullptr
;
43
44
public
:
45
Generator
(
IInterface
* engine ) :
RndmGen
( engine ) {}
47
StatusCode
initialize
(
const
IRndmGen::Param
& par )
override
;
49
double
shoot
()
const override
;
50
};
51
53
template
<
class
TYPE>
54
StatusCode
Generator<TYPE>::initialize
(
const
IRndmGen::Param
& par ) {
55
StatusCode
status =
RndmGen::initialize
( par );
56
if
( status.
isSuccess
() ) {
57
try
{
58
m_specs
=
dynamic_cast<
TYPE*
>
(
m_params
.get() );
59
if
(
m_specs
) {
60
BaseEngine
* engine =
dynamic_cast<
BaseEngine
*
>
(
m_engine
.get() );
61
if
( engine ) {
62
m_hepEngine
= engine->
hepEngine
();
63
if
(
m_hepEngine
) {
return
StatusCode::SUCCESS
; }
64
}
65
}
66
}
catch
( ... ) {}
67
}
68
return
StatusCode::FAILURE
;
69
}
70
}
// namespace HepRndm
HepRndmBaseEngine.h
RndmGen.h
RndmGenSvc.h
HepRndm::BaseEngine
Definition
HepRndmBaseEngine.h:119
HepRndm::BaseEngine::hepEngine
CLHEP::HepRandomEngine * hepEngine()
Definition
HepRndmBaseEngine.h:126
HepRndm::Generator::initialize
StatusCode initialize(const IRndmGen::Param &par) override
Initialize the generator.
Definition
HepRndmGenerator.h:54
HepRndm::Generator::m_specs
TYPE * m_specs
Definition
HepRndmGenerator.h:42
HepRndm::Generator::Parameters
TYPE Parameters
Definition
HepRndmGenerator.h:38
HepRndm::Generator::m_hepEngine
CLHEP::HepRandomEngine * m_hepEngine
Definition
HepRndmGenerator.h:41
HepRndm::Generator::Generator
Generator(IInterface *engine)
Definition
HepRndmGenerator.h:45
HepRndm::Generator::shoot
double shoot() const override
Single shot.
IInterface
Definition of the basic interface.
Definition
IInterface.h:225
IRndmGen::Param
Definition
IRndmGen.h:45
RndmGen::m_engine
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition
RndmGen.h:56
RndmGen::RndmGen
RndmGen(IInterface *engine)
Standard Constructor.
Definition
RndmGen.cpp:33
RndmGen::m_params
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition
RndmGen.h:54
RndmGen::initialize
StatusCode initialize(const IRndmGen::Param &par) override
IRndmGen implementation.
Definition
RndmGen.cpp:36
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::isSuccess
bool isSuccess() const
Definition
StatusCode.h:302
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
HepRndm
Definition
HepRndmBaseEngine.h:39
GaudiSvc
src
RndmGenSvc
HepRndmGenerator.h
Generated on
for The Gaudi Framework by
1.17.0