cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
cepgenEventConverter.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 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/EventFilter/EventExporter.h
"
22
#include "
CepGen/EventFilter/EventImporter.h
"
23
#include "
CepGen/Generator.h
"
24
#include "
CepGen/Modules/EventExporterFactory.h
"
25
#include "
CepGen/Modules/EventImporterFactory.h
"
26
#include "
CepGen/Utils/ArgumentsParser.h
"
27
#include "
CepGen/Utils/Filesystem.h
"
28
#include "
CepGen/Utils/String.h
"
29
30
using namespace
std;
31
32
int
main
(
int
argc,
char
* argv[]) {
33
string
input_file, output_file;
34
35
cepgen::ArgumentsParser
parser(argc, argv);
36
parser.
addArgument
(
"input,i"
,
"input event file"
, &input_file)
37
.
addArgument
(
"output,o"
,
"output event file"
, &output_file)
38
.
parse
();
39
40
cepgen::initialise
();
41
42
auto
params =
cepgen::RunParameters
{};
43
44
auto
reader = cepgen::EventImporterFactory::get().build(input_file);
45
reader->initialise(params);
46
auto
writer = cepgen::EventExporterFactory::get().build(output_file);
47
writer->initialise(params);
48
49
writer->setCrossSection(reader->crossSection());
50
51
cepgen::Event
buf;
52
size_t
num_events_converted = 0;
53
while
((*reader) >> buf) {
54
(*writer) << buf;
55
++num_events_converted;
56
}
57
58
CG_LOG
<<
"Successfully converted "
<<
cepgen::utils::s
(
"event"
, num_events_converted,
true
) <<
"."
;
59
60
return
0;
61
}
ArgumentsParser.h
EventExporterFactory.h
EventExporter.h
EventImporterFactory.h
EventImporter.h
Exception.h
Filesystem.h
Generator.h
CG_LOG
#define CG_LOG
Definition
Message.h:212
RunParameters.h
String.h
cepgen::ArgumentsParser
A generic command line arguments parser.
Definition
ArgumentsParser.h:31
cepgen::ArgumentsParser::addArgument
ArgumentsParser & addArgument(Args &&... args)
Add a parameter required for the parser.
Definition
ArgumentsParser.h:39
cepgen::ArgumentsParser::parse
ArgumentsParser & parse()
Associate command-line arguments to parameters.
Definition
ArgumentsParser.cpp:106
cepgen::Event
Container for the information on the in- and outgoing particles' kinematics.
Definition
Event.h:28
cepgen::RunParameters
List of parameters used to start and run the simulation job.
Definition
RunParameters.h:41
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::initialise
void initialise(bool safe_mode)
Definition
GlobalFunctions.cpp:91
main
int main()
Definition
pythia6_decay.cc:9
src
utils
cepgenEventConverter.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7