cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
GeneratorWorker.h
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2020-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_GeneratorWorker_h
20#define CepGen_Core_GeneratorWorker_h
21
22#include "CepGen/Event/Event.h"
23
24namespace cepgen {
25 class Integrator;
26 class RunParameters;
27 class ProcessIntegrand;
28 namespace proc {
29 class Process;
30 }
32 class GeneratorWorker : public SteeredObject<GeneratorWorker> {
33 public:
34 explicit GeneratorWorker(const ParametersList&);
35 virtual ~GeneratorWorker();
36
38
39 void setRunParameters(const RunParameters*);
40 void setIntegrator(const Integrator* integ);
41
45 void generate(size_t num_events, const std::function<void(const proc::Process&)>&);
46
47 inline ProcessIntegrand& integrand() { return *integrand_; }
48
49 virtual void initialise() = 0;
50 virtual bool next() = 0;
51
52 protected:
55 bool storeEvent();
56
57 // NOT owned
58 const Integrator* integrator_{nullptr};
59 const RunParameters* params_{nullptr};
60
61 std::unique_ptr<ProcessIntegrand> integrand_;
62 std::function<void(const proc::Process&)> callback_proc_{nullptr};
63 };
64} // namespace cepgen
65
66#endif
Event generator worker instance.
std::unique_ptr< ProcessIntegrand > integrand_
Local event weight evaluator.
std::function< void(const proc::Process &)> callback_proc_
Callback function for each new event.
ProcessIntegrand & integrand()
Function evaluator.
const RunParameters * params_
Steering parameters for the event generation.
virtual bool next()=0
Generate a single event.
void setIntegrator(const Integrator *integ)
Specify the integrator instance handled by the mother generator.
void generate(size_t num_events, const std::function< void(const proc::Process &)> &)
Launch the event generation.
bool storeEvent()
Store the event in the output file.
static ParametersDescription description()
const Integrator * integrator_
Pointer to the mother-handled integrator instance.
virtual void initialise()=0
Initialise the generation parameters.
void setRunParameters(const RunParameters *)
Specify the runtime parameters.
Monte-Carlo integration algorithm.
Definition Integrator.h:28
A description object for parameters collection.
Wrapper to the function to be integrated.
List of parameters used to start and run the simulation job.
Base user-steerable object.
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.