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
21#include "CepGen/Event/Event.h"
26#include "CepGen/Utils/String.h"
29
30namespace cepgen {
31 namespace hadr {
35 public:
36 explicit Pythia6Hadroniser(const ParametersList& params)
37 : Hadroniser(params),
38 rnd_gen_(RandomGeneratorFactory::get().build(steer<ParametersList>("randomGenerator"))) {}
39
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.;
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:
78 const std::unique_ptr<utils::RandomGenerator> rnd_gen_;
79 };
80 } // namespace hadr
81} // namespace cepgen
#define REGISTER_MODIFIER(name, obj)
Add a generic event modification module definition to the factory.
#define CG_WARNING(mod)
Definition Message.h:228
#define CG_DEBUG_LOOP(mod)
Definition Message.h:224
struct @7 pyjets_
Particles content of the event.
const RunParameters & runParameters() const
List of run parameters.
Container for the information on the in- and outgoing particles' kinematics.
Definition Event.h:28
mode::Kinematics mode() const
Type of kinematics to consider for the phase space.
IncomingBeams & incomingBeams()
Beam/primary particle kinematics.
Definition Kinematics.h:36
A description object for parameters collection.
const Kinematics & kinematics() const
Events kinematics for phase space definition.
T steer(const std::string &key) const
Retrieve a parameters as previously steered.
Definition Steerable.h:39
Class template to define any hadroniser as a general object with defined methods.
Definition Hadroniser.h:32
static ParametersDescription description()
Interface to the Pythia 6 algorithm.
void readString(const std::string &param) override
Parse a configuration string.
Pythia6Hadroniser(const ParametersList &params)
static ParametersDescription description()
bool run(Event &ev, double &weight, bool fast) override
Modify an event.
Interface to the Pythia 6 event content.
Kinematics
Type of scattering.
Definition Modes.h:28
@ ElasticElastic
proton-proton elastic case
void pygive(const std::string &line)
std::string s(const std::string &word, float num, bool show_number)
Add a trailing "s" when needed.
Definition String.cpp:228
Common namespace for this Monte Carlo generator.