EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
EvtGenExternal
EvtSherpaRandom.hh
Go to the documentation of this file.
1
2
/***********************************************************************
3
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4
* *
5
* This file is part of EvtGen. *
6
* *
7
* EvtGen is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* EvtGen is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19
***********************************************************************/
20
21
#ifdef EVTGEN_SHERPA
22
23
#ifndef EVTSHERPARANDOM_HH
24
#define EVTSHERPARANDOM_HH
25
26
#include "
EvtGenBase/EvtRandom.hh
"
27
28
#include "ATOOLS/Math/Random.H"
29
30
/* Description: Class to specify the chosen EvtGen random number (engine)
31
* to be used for Sherpa.
32
*/
33
34
class
EvtSherpaRandom
:
public
ATOOLS::External_RNG {
35
public
:
36
double
Get
() {
return
EvtRandom::Flat
(); }
37
38
private
:
39
};
40
41
// The following code makes EvtSherpaRandom loadable in Sherpa
42
44
45
// In Sherpa versions v2.2.15 and earlier the DECLARE_GETTER macro produces code that doesn't compile with gcc versions > 12 and C++20
46
// So, in those cases, instead use explicit code that has been modified to work correctly
47
#ifdef EVTGEN_SHERPA_USEMACRO
48
DECLARE_GETTER(
EvtSherpaRandom
,
"EvtSherpaRandom"
, ATOOLS::External_RNG,
49
ATOOLS::RNG_Key );
50
#else
51
namespace
ATOOLS {
52
template
<>
53
class
Getter<External_RNG, RNG_Key, EvtSherpaRandom> :
54
public
Getter_Function<External_RNG, RNG_Key> {
55
public
:
56
Getter(
const
bool
& d =
true
) :
57
Getter_Function<External_RNG, RNG_Key>{
"EvtSherpaRandom"
}
58
{
59
SetDisplay( d );
60
}
61
62
protected
:
63
void
PrintInfo( std::ostream& str,
const
size_t
width )
const
;
64
Object_Type* operator()(
const
Parameter_Type& parameters )
const
;
65
66
private
:
67
static
Getter<External_RNG, RNG_Key, EvtSherpaRandom> s_initializer;
68
};
69
}
// namespace ATOOLS
70
71
ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>
72
ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>::s_initializer{
73
true
};
74
#endif
75
76
ATOOLS::External_RNG*
77
ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>::operator()(
78
const
ATOOLS::RNG_Key& )
const
79
{
80
return
new
EvtSherpaRandom
();
81
}
82
83
// This eventually prints a help message
84
void
ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>::PrintInfo(
85
std::ostream& str,
const
size_t
)
const
86
{
87
str <<
" EvtGen-Sherpa RNG interface"
;
88
}
89
91
92
#endif
93
94
#endif
EvtRandom.hh
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
EvtSherpaRandom
Definition
EvtSherpaRandom.hh:34
EvtSherpaRandom::Get
double Get()
Definition
EvtSherpaRandom.hh:36
Generated by
1.17.0