LDMX Software
Simulator.h
Go to the documentation of this file.
1
8#ifndef _SIMCORE_SIMULATOR_H_
9#define _SIMCORE_SIMULATOR_H_
10
11/*~~~~~~~~~~~~~~~~*/
12/* C++ StdLib */
13/*~~~~~~~~~~~~~~~~*/
14#include <string>
15
16/*~~~~~~~~~~~~~~~*/
17/* Framework */
18/*~~~~~~~~~~~~~~~*/
19#include "Framework/Configure/Parameters.h"
21#include "SimCore/SimulatorBase.h"
22
23/*~~~~~~~~~~~~~~~*/
24/* Framework */
25/*~~~~~~~~~~~~~~~*/
26#include "Framework/EventFile.h"
27#include "Framework/Process.h"
28
29/*~~~~~~~~~~~~~*/
30/* SimCore */
31/*~~~~~~~~~~~~~*/
32
33/*~~~~~~~~~~~~~~*/
34/* Geant4 */
35/*~~~~~~~~~~~~~~*/
36
37namespace genie {
38class Interaction;
39}
40
41namespace ldmx {
42class HepMC3GenEvent;
43}
44
45class G4UImanager;
46class G4UIsession;
47class G4RunManager;
48class G4GDMLParser;
49class G4GDMLMessenger;
50class G4CascadeParameters;
51
52namespace simcore {
53
62class Simulator : public SimulatorBase {
63 public:
74 Simulator(const std::string& name, framework::Process& process);
75
80 virtual ~Simulator() = default;
81
88 void configure(framework::config::Parameters& parameters) override;
89
97 void beforeNewRun(ldmx::RunHeader& header) override;
98
105 void onNewRun(const ldmx::RunHeader& header) override;
106
112 virtual void produce(framework::Event& event) override;
113
115 void onProcessEnd() override;
116
117 private:
125 void setSeeds(std::vector<int> seeds);
126
127 private:
130
133
135 int run_{-1};
136};
137} // namespace simcore
138
139#endif /* SIMCORE_SIMULATOR_H */
Base classes for all user event processing components to extend.
Class which represents the process under execution.
Implements an event buffer system for storing event data.
Definition Event.h:40
Class which represents the process under execution.
Definition Process.h:34
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:68
Producer that runs Geant4 simulation inside of ldmx-app.
Definition Simulator.h:62
void configure(framework::config::Parameters &parameters) override
Callback for the processor to configure itself from the given set of parameters.
Definition Simulator.cxx:30
Simulator(const std::string &name, framework::Process &process)
Constructor.
Definition Simulator.cxx:27
void beforeNewRun(ldmx::RunHeader &header) override
Given a non-const reference to the new RunHeader, we can add parameters from the simulation here befo...
Definition Simulator.cxx:34
void setSeeds(std::vector< int > seeds)
Set the seeds to be used by the Geant4 random engine.
void onNewRun(const ldmx::RunHeader &header) override
Before the run starts (but after the conditions are configured) set up the random seeds for this run.
virtual void produce(framework::Event &event) override
Run simulation and export results to output event.
int num_events_began_
Number of events started.
Definition Simulator.h:129
void onProcessEnd() override
Callback called once processing is complete.
virtual ~Simulator()=default
Destructor.
int run_
the run number (for accessing the run header in onFileClose
Definition Simulator.h:135
int num_events_completed_
Number of events completed.
Definition Simulator.h:132
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...