cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic central exclusive processes event generator
Loading...
Searching...
No Matches
Generator.h
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
16#ifndef CepGen_Generator_h
17#define CepGen_Generator_h
18
19#include <functional>
20#include <memory>
21
22#include "CepGen/Utils/Value.h"
23
25namespace cepgen {
26 class Event;
27 class Integrator;
28 class GeneratorWorker;
29 class RunParameters;
30 namespace proc {
31 class Process;
32 }
33
34 static std::vector<std::string> loaded_libraries;
35 static std::vector<std::string> invalid_libraries;
36 static std::vector<std::string> search_paths;
38 bool callPath(const std::string&, bool (*callback)(const std::string&));
39 bool loadLibrary(const std::string&, bool match = false);
42 void initialise(bool safe_mode = false);
43 void printHeader();
44
48 class Generator {
49 public:
52 explicit Generator(bool safe_mode = false);
53 explicit Generator(RunParameters*);
54 ~Generator();
55
56 void parseRunParameters(const std::string&);
57 const RunParameters& runParameters() const;
59 void setRunParameters(std::unique_ptr<RunParameters>&);
60
61 void setIntegrator(std::unique_ptr<Integrator>);
62 void integrate();
63
68 [[deprecated("Please use the parameters-less version")]] void computeXsection(double& cross_section, double& err);
69 double crossSection() const { return xsect_; }
70 double crossSectionError() const { return xsect_.uncertainty(); }
71
72 void generate(size_t num_events, const std::function<void(const Event&, size_t)>&);
73 void generate(size_t num_events, const std::function<void(const proc::Process&)>& = nullptr);
74 const Event& next();
75
79 double computePoint(const std::vector<double>& x);
80
81 private:
82 void initialise();
83 void clearRun();
84 void resetIntegrator();
85
86 std::unique_ptr<RunParameters> parameters_;
87 std::unique_ptr<GeneratorWorker> worker_;
88 std::unique_ptr<Integrator> integrator_;
89 bool initialised_{false};
90 Value xsect_{-1., -1.};
91 };
92} // namespace cepgen
93
94#endif
Container for the information on the in- and outgoing particles' kinematics.
Definition Event.h:28
Core generator object allowing for process definition, cross section computation, and event generatio...
Definition Generator.h:48
void generate(size_t num_events, const std::function< void(const Event &, size_t)> &)
Generate events.
double computePoint(const std::vector< double > &x)
Compute one single point from the total phase space.
Definition Generator.cpp:90
void integrate()
Integrate the functional over the phase space of interest.
void parseRunParameters(const std::string &)
Read a steering card to populate the run parameters block.
Definition Generator.cpp:72
void setIntegrator(std::unique_ptr< Integrator >)
Specify an integrator algorithm configuration.
const Event & next()
Generate one single event.
void setRunParameters(std::unique_ptr< RunParameters > &)
Feed the generator with a RunParameters object.
Definition Generator.cpp:88
double crossSectionError() const
Last error on the cross section computed.
Definition Generator.h:70
double crossSection() const
Last cross section computed by the generator.
Definition Generator.h:69
const RunParameters & runParameters() const
Pointer to the parameters block.
Definition Generator.cpp:76
Value computeXsection()
Compute the cross section and uncertainty, in pb, for the run parameters Compute the cross section fo...
List of parameters used to start and run the simulation job.
A scalar value with its uncertainty.
Definition Value.h:26
double uncertainty() const
Absolute uncertainty around the central value.
Definition Value.h:35
Class template to define any process to compute using this MC integrator/events generator.
Definition Process.h:34
Common namespace for this Monte Carlo generator.
static std::vector< std::string > invalid_libraries
Collection of libraries tested not to work with RTE.
Definition Generator.h:35
bool loadLibrary(const std::string &path, bool match)
Import a shared library in RTE Launch the initialisation procedure.
void printHeader()
Dump this program's header into the standard output stream.
void initialise(bool safe_mode)
static std::vector< std::string > search_paths
Collection of search paths to build RTE Execute an action on a path if found in search paths collecti...
Definition Generator.h:36
static std::vector< std::string > loaded_libraries
Collection of libraries loaded in RTE.
Definition Generator.h:34
bool callPath(const std::string &local_path, bool(*callback)(const std::string &))