cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
RunParameters.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 * 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#ifndef CepGen_Core_RunParameters_h
20#define CepGen_Core_RunParameters_h
21
23
24namespace cepgen {
25 class EventExporter;
26 class EventModifier;
27 class ParametersList;
28 namespace proc {
29 class Process;
30 }
31 namespace utils {
32 class Functional;
33 class TimeKeeper;
34 } // namespace utils
35 enum class IntegratorType;
36 typedef std::vector<std::unique_ptr<EventModifier> > EventModifiersSequence;
37 typedef std::vector<std::unique_ptr<EventExporter> > EventExportersSequence;
38 typedef std::vector<std::unique_ptr<utils::Functional> > TamingFunctionsSequence;
39
41 class RunParameters : public SteeredObject<RunParameters> {
42 public:
46 ~RunParameters(); // required for unique_ptr initialisation!
47
49
51
52 friend std::ostream& operator<<(std::ostream&, const RunParameters&);
53
55 utils::TimeKeeper* timeKeeper() { return tmr_.get(); }
56 const utils::TimeKeeper* timeKeeper() const { return tmr_.get(); }
57
58 void initialiseModules();
59
60 ParametersList& integrator() { return integrator_; }
61 const ParametersList& integrator() const { return integrator_; }
62
63 //----- process to compute
64
65 bool hasProcess() const { return !(!process_); }
67 const proc::Process& process() const;
68 std::string processName() const;
69 void clearProcess();
70 void setProcess(std::unique_ptr<proc::Process>);
72
73 //----- events kinematics
74
76 const Kinematics& kinematics() const;
77
78 //----- events generation
79
81 class Generation : public SteeredObject<Generation> {
82 public:
84 explicit Generation(const ParametersList& = ParametersList());
85
87
88 void setTargetLuminosity(double lumi_invpb) { target_lumi_ = lumi_invpb; }
89 double targetLuminosity() const { return target_lumi_; }
90 void setMaxGen(size_t max_gen) { max_gen_ = max_gen; }
91 size_t maxGen() const { return max_gen_; }
92 bool enabled() const { return max_gen_ > 0; }
93 void setPrintEvery(size_t print_every) { gen_print_every_ = print_every; }
94 size_t printEvery() const { return gen_print_every_; }
95 void setSymmetrise(bool sym) { symmetrise_ = sym; }
96 bool symmetrise() const { return symmetrise_; }
97 void setNumThreads(size_t nt) { num_threads_ = nt; }
98 size_t numThreads() const { return num_threads_; }
99 void setNumPoints(size_t np) { num_points_ = np; }
100 size_t numPoints() const { return num_points_; }
101
102 private:
103 int max_gen_, gen_print_every_;
104 double target_lumi_;
105 bool symmetrise_;
106 int num_threads_, num_points_;
107 };
108 Generation& generation() { return generation_; }
109 const Generation& generation() const { return generation_; }
110
111 //----- event modification (e.g. hadronisation, decay) algorithm
112
114 EventModifiersSequence& eventModifiersSequence() { return evt_modifiers_; }
116 const EventModifiersSequence& eventModifiersSequence() const { return evt_modifiers_; }
118 void addModifier(std::unique_ptr<EventModifier>);
120
121 //----- event output algorithms
122
124 EventExportersSequence& eventExportersSequence() { return evt_exporters_; }
125 const EventExportersSequence& eventExportersSequence() const { return evt_exporters_; }
127 void addEventExporter(std::unique_ptr<EventExporter>);
129
130 //----- taming functions
131
133 const TamingFunctionsSequence& tamingFunctions() const { return taming_functions_; }
134 void addTamingFunction(std::unique_ptr<utils::Functional>);
135
136 //----- run operations
137
138 void prepareRun();
139
142 void addGenerationTime(double gen_time);
143 inline double totalGenerationTime() const { return total_gen_time_; }
144 inline unsigned int numGeneratedEvents() const { return num_gen_events_; }
145
146 private:
147 std::unique_ptr<proc::Process> process_;
148 EventModifiersSequence evt_modifiers_;
149 EventExportersSequence evt_exporters_;
150 TamingFunctionsSequence taming_functions_;
151 double total_gen_time_{0.};
152 unsigned long num_gen_events_{0ul};
153 ParametersList integrator_;
154 Generation generation_;
155 std::unique_ptr<utils::TimeKeeper> tmr_;
156 };
157} // namespace cepgen
158
159#endif
Output format handler for events export.
Class template to interface (external/internal) events modification algorithms.
List of kinematic constraints to apply on the process phase space.
Definition Kinematics.h:27
A description object for parameters collection.
Collection of events generation parameters.
void setSymmetrise(bool sym)
Switch the symmetrisation of the z-axis for each event.
size_t numPoints() const
Number of points to "shoot" in each integration bin.
size_t numThreads() const
Number of threads to perform the events generation.
void setPrintEvery(size_t print_every)
Set the events display frequency.
size_t printEvery() const
Frequency at which events are displayed to the user.
void setNumThreads(size_t nt)
Set the number of threads for the events generation.
bool symmetrise() const
Symmetrise events wrt the -axis ?
void setTargetLuminosity(double lumi_invpb)
Set target luminosity, in pb^-1.
size_t maxGen() const
Maximal number of events to generate.
void setNumPoints(size_t np)
Set the number of points to probe in each integration bin.
void setMaxGen(size_t max_gen)
Set the maximal number of events to generate.
double targetLuminosity() const
Target luminosity to reach, in pb^-1.
static ParametersDescription description()
bool enabled() const
Are we generating events?
List of parameters used to start and run the simulation job.
const Kinematics & kinematics() const
Events kinematics for phase space definition.
const EventModifiersSequence & eventModifiersSequence() const
void initialiseModules()
Initialise the event handling modules for an event generation.
proc::Process & process()
Process object for cross-section computation/events generation.
const utils::TimeKeeper * timeKeeper() const
Pointer to a timekeeper instance.
EventExporter & eventExporter(size_t)
Output module.
void clearEventModifiersSequence()
Remove all event modifiers from sequence.
unsigned int numGeneratedEvents() const
Number of events generated in run.
void addModifier(std::unique_ptr< EventModifier >)
Add a new event modification algorithm to the sequence.
EventModifier & eventModifier(size_t)
Event modification algorithm.
EventExportersSequence & eventExportersSequence()
List of output modules.
friend std::ostream & operator<<(std::ostream &, const RunParameters &)
User-readable dump of runtime parameters.
utils::TimeKeeper * timeKeeper()
Pointer to a timekeeper instance.
RunParameters & operator=(RunParameters)
Assignment operator.
const TamingFunctionsSequence & tamingFunctions() const
List of all taming functions definitions.
void prepareRun()
Reset total generation time and number of events generated for this run, prepare kinematics.
const Generation & generation() const
Event generation parameters.
void clearEventExportersSequence()
Remove all output modules from sequence.
void setProcess(std::unique_ptr< proc::Process >)
Set a process configuration.
std::string processName() const
Name of the process considered.
bool hasProcess() const
Is this parameters collection holding any physics process?
void addTamingFunction(std::unique_ptr< utils::Functional >)
Set a new taming function definition.
EventModifiersSequence & eventModifiersSequence()
List of event modification algos List of event modification algos.
void addGenerationTime(double gen_time)
Add a new timing into the total generation time.
void clearProcess()
Remove the process pointer.
static ParametersDescription description()
const ParametersList & integrator() const
Integrator specific user-defined parameters.
ParametersList & integrator()
Integrator specific user-defined parameters.
void addEventExporter(std::unique_ptr< EventExporter >)
Set a new output module definition.
void setTimeKeeper(utils::TimeKeeper *)
Initialise the timekeeper instance.
const EventExportersSequence & eventExportersSequence() const
List of output modules.
Generation & generation()
Event generation parameters.
double totalGenerationTime() const
Total generation time in s for this run.
Base user-steerable object.
Class template to define any process to compute using this MC integrator/events generator.
Definition Process.h:34
Collection of clocks to benchmark execution blocks.
Definition TimeKeeper.h:35
Common namespace for this Monte Carlo generator.
std::vector< std::unique_ptr< EventModifier > > EventModifiersSequence
Event modification algos ordered set.
std::vector< std::unique_ptr< EventExporter > > EventExportersSequence
Event export modules ordered set.
std::vector< std::unique_ptr< utils::Functional > > TamingFunctionsSequence
Taming functions evaluators set.