cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Pythia6Hadroniser.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2024 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#include "
CepGen/Core/Exception.h
"
20
#include "
CepGen/Core/RunParameters.h
"
21
#include "
CepGen/Event/Event.h
"
22
#include "
CepGen/Modules/EventModifierFactory.h
"
23
#include "
CepGen/Modules/RandomGeneratorFactory.h
"
24
#include "
CepGen/Physics/Hadroniser.h
"
25
#include "
CepGen/Utils/RandomGenerator.h
"
26
#include "
CepGen/Utils/String.h
"
27
#include "
CepGenAddOns/Pythia6Wrapper/EventInterface.h
"
28
#include "
CepGenAddOns/Pythia6Wrapper/Pythia6Interface.h
"
29
30
namespace
cepgen
{
31
namespace
hadr {
34
class
Pythia6Hadroniser
:
public
Hadroniser
{
35
public
:
36
explicit
Pythia6Hadroniser
(
const
ParametersList
& params)
37
:
Hadroniser
(params),
38
rnd_gen_(RandomGeneratorFactory::get().build(
steer
<
ParametersList
>(
"randomGenerator"
))) {}
39
40
static
inline
ParametersDescription
description
() {
41
auto
desc =
Hadroniser::description
();
42
desc.setDescription(
"Interface to the Pythia 6 string hadronisation/fragmentation algorithm"
);
43
desc.add(
"randomGenerator"
, RandomGeneratorFactory::get().describeParameters(
"stl"
))
44
.setDescription(
"random number generator to use for the various intermediate computations"
);
45
return
desc;
46
}
47
48
inline
void
readString
(
const
std::string& param)
override
{
pythia6::pygive
(param); }
49
inline
void
initialise
()
override
{
50
CG_WARNING
(
"Pythia6Hadroniser"
) <<
"Branching fraction not yet implemented in this hadroniser.\n\t"
51
<<
"You will have to specify manually the multiplication factor according\n\t"
52
<<
"to your list of open channels."
;
53
kin_mode_ =
runParameters
().
kinematics
().
incomingBeams
().
mode
();
54
}
55
inline
bool
run
(
Event
& ev,
double
& weight,
bool
fast)
override
{
56
weight = 1.;
57
pythia6::EventInterface
evt(
58
ev,
59
fast ?
mode::Kinematics::ElasticElastic
// do not treat beam remnants when running in fast mode
60
: kin_mode_,
61
rnd_gen_.get());
62
evt.
prepareHadronisation
();
// fill Pythia 6 common blocks
63
64
CG_DEBUG_LOOP
(
"Pythia6Hadroniser"
)
65
<<
"Dump of the event before the hadronisation:"
<< ev <<
"\n\t"
66
<<
utils::s
(
"string object"
, evt.
numStrings
(),
true
) <<
" identified and constructed."
;
67
68
const
int
old_npart =
pyjets_
.n;
69
evt.
run
();
// run the hadronisation/decay
70
if
(!fast &&
pyjets_
.n == old_npart)
71
return
false
;
// hadronisation failed
72
73
return
true
;
74
}
75
76
private
:
77
mode::Kinematics
kin_mode_{
mode::Kinematics::ElasticElastic
};
78
const
std::unique_ptr<utils::RandomGenerator> rnd_gen_;
79
};
80
}
// namespace hadr
81
}
// namespace cepgen
82
using
cepgen::hadr::Pythia6Hadroniser
;
83
REGISTER_MODIFIER
(
"pythia6"
,
Pythia6Hadroniser
);
EventInterface.h
EventModifierFactory.h
REGISTER_MODIFIER
#define REGISTER_MODIFIER(name, obj)
Add a generic event modification module definition to the factory.
Definition
EventModifierFactory.h:25
Event.h
Exception.h
Hadroniser.h
CG_WARNING
#define CG_WARNING(mod)
Definition
Message.h:228
CG_DEBUG_LOOP
#define CG_DEBUG_LOOP(mod)
Definition
Message.h:224
Pythia6Interface.h
pyjets_
struct @7 pyjets_
Particles content of the event.
RandomGeneratorFactory.h
RandomGenerator.h
RunParameters.h
String.h
cepgen::EventHandler::runParameters
const RunParameters & runParameters() const
List of run parameters.
Definition
EventHandler.cpp:44
cepgen::Event
Container for the information on the in- and outgoing particles' kinematics.
Definition
Event.h:28
cepgen::IncomingBeams::mode
mode::Kinematics mode() const
Type of kinematics to consider for the phase space.
Definition
IncomingBeams.cpp:204
cepgen::Kinematics::incomingBeams
IncomingBeams & incomingBeams()
Beam/primary particle kinematics.
Definition
Kinematics.h:36
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::RunParameters::kinematics
const Kinematics & kinematics() const
Events kinematics for phase space definition.
Definition
RunParameters.cpp:125
cepgen::Steerable::steer
T steer(const std::string &key) const
Retrieve a parameters as previously steered.
Definition
Steerable.h:39
cepgen::hadr::Hadroniser
Class template to define any hadroniser as a general object with defined methods.
Definition
Hadroniser.h:32
cepgen::hadr::Hadroniser::description
static ParametersDescription description()
Definition
Hadroniser.cpp:27
cepgen::hadr::Pythia6Hadroniser
Interface to the Pythia 6 algorithm.
Definition
Pythia6Hadroniser.cpp:34
cepgen::hadr::Pythia6Hadroniser::readString
void readString(const std::string ¶m) override
Parse a configuration string.
Definition
Pythia6Hadroniser.cpp:48
cepgen::hadr::Pythia6Hadroniser::Pythia6Hadroniser
Pythia6Hadroniser(const ParametersList ¶ms)
Definition
Pythia6Hadroniser.cpp:36
cepgen::hadr::Pythia6Hadroniser::description
static ParametersDescription description()
Definition
Pythia6Hadroniser.cpp:40
cepgen::hadr::Pythia6Hadroniser::run
bool run(Event &ev, double &weight, bool fast) override
Modify an event.
Definition
Pythia6Hadroniser.cpp:55
cepgen::hadr::Pythia6Hadroniser::initialise
void initialise() override
Definition
Pythia6Hadroniser.cpp:49
cepgen::pythia6::EventInterface
Interface to the Pythia 6 event content.
Definition
EventInterface.h:33
cepgen::pythia6::EventInterface::prepareHadronisation
void prepareHadronisation()
Definition
EventInterface.cpp:41
cepgen::pythia6::EventInterface::run
void run()
Definition
EventInterface.cpp:155
cepgen::pythia6::EventInterface::numStrings
size_t numStrings() const
Definition
EventInterface.h:38
cepgen::mode::Kinematics
Kinematics
Type of scattering.
Definition
Modes.h:28
cepgen::mode::Kinematics::ElasticElastic
@ ElasticElastic
proton-proton elastic case
cepgen::pythia6::pygive
void pygive(const std::string &line)
Definition
Pythia6Interface.cpp:53
cepgen::utils::s
std::string s(const std::string &word, float num, bool show_number)
Add a trailing "s" when needed.
Definition
String.cpp:228
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
CepGenAddOns
Pythia6Wrapper
Pythia6Hadroniser.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7