cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
EventExporter.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2016-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 <iomanip>
20#include <sstream>
21
26#include "CepGen/Utils/String.h"
27#include "CepGen/Version.h"
28
29namespace cepgen {
31
32 std::string EventExporter::banner(const std::string& prep) const {
33 const size_t len = 45 + version::tag.size();
34 std::ostringstream os;
35 os << prep << "******* Sample generated with CepGen " << version::tag << " *******\n";
36 if (runParameters().hasProcess()) {
37 os << prep << " Process: " << runParameters().processName() << " ("
38 << runParameters().kinematics().incomingBeams().mode() << ")\n";
39 if (runParameters().kinematics().incomingBeams().mode() != mode::Kinematics::ElasticElastic)
40 os << prep << " Structure functions: " << runParameters().kinematics().incomingBeams().structureFunctions()
41 << "\n";
42 }
43 if (!runParameters().eventModifiersSequence().empty()) {
44 os << prep << " " << utils::s("Event modifier", runParameters().eventModifiersSequence().size()) << ": ";
45 std::string sep;
46 for (const auto& mod : runParameters().eventModifiersSequence())
47 os << sep << mod->name(), sep = ", ";
48 os << "\n";
49 }
50 if (runParameters().hasProcess()) {
51 const auto& cuts = runParameters().kinematics().cuts();
52 auto dump_cuts = [&os, &prep](const auto& obj) {
53 for (const auto& lim : obj.parameters().template keysOf<Limits>()) {
54 const auto& limit = obj.parameters().template get<Limits>(lim);
55 if (limit.valid() && obj.description().has(lim))
56 os << prep << " " << obj.description().get(lim).description() << ": " << limit << "\n";
57 }
58 };
59 os << prep << std::left << std::setw(len) << std::setfill('*') << "*** Incoming state "
60 << "\n";
61 dump_cuts(cuts.initial);
62 os << prep << std::setw(len) << std::setfill('*') << "*** Central system "
63 << "\n";
64 dump_cuts(cuts.central);
65 if (runParameters().kinematics().incomingBeams().mode() != mode::Kinematics::ElasticElastic) {
66 os << prep << std::setw(len) << std::setfill('*') << "*** Remnants states "
67 << "\n";
68 dump_cuts(cuts.remnants);
69 }
70 }
71 os << prep << std::string(45 + version::tag.size(), '*');
72 return os.str();
73 }
74} // namespace cepgen
std::string banner(const std::string &prep="") const
Print a banner containing runtime parameters.
EventExporter(const ParametersList &)
Class template for modules interacting with events.
const RunParameters & runParameters() const
List of run parameters.
const ParametersList & structureFunctions() const
Structure functions parameters.
mode::Kinematics mode() const
Type of kinematics to consider for the phase space.
CutsList & cuts()
Phase space cuts.
Definition Kinematics.h:41
IncomingBeams & incomingBeams()
Beam/primary particle kinematics.
Definition Kinematics.h:36
const Kinematics & kinematics() const
Events kinematics for phase space definition.
std::string processName() const
Name of the process considered.
bool hasProcess() const
Is this parameters collection holding any physics process?
EventModifiersSequence & eventModifiersSequence()
List of event modification algos List of event modification algos.
const ParametersList & parameters() const override
Module user-defined parameters.
@ ElasticElastic
proton-proton elastic case
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.
static const std::string tag
CepGen version.
Definition Version.h:28