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 <any>
15#include <map>
16#include <memory>
17#include <string>
18
19/*~~~~~~~~~~~~~~~*/
20/* Framework */
21/*~~~~~~~~~~~~~~~*/
22#include "Framework/Configure/Parameters.h"
24#include "SimCore/ConditionsInterface.h"
25#include "SimCore/DetectorConstruction.h"
26#include "SimCore/RunManager.h"
27#include "SimCore/SimulatorBase.h"
28
29/*~~~~~~~~~~~~~~~*/
30/* Framework */
31/*~~~~~~~~~~~~~~~*/
32#include "Framework/EventFile.h"
33#include "Framework/Process.h"
35#include "Framework/Version.h" //for LDMX_INSTALL path
36
37/*~~~~~~~~~~~~~*/
38/* SimCore */
39/*~~~~~~~~~~~~~*/
41#include "SimCore/BiasOperators/XsecBiasingOperator.h"
42#include "SimCore/DetectorConstruction.h"
43#include "SimCore/Event/HepMC3GenEvent.h"
44#include "SimCore/G4Session.h"
46#include "SimCore/G4User/UserEventInformation.h"
48#include "SimCore/SDs/SensitiveDetector.h"
49
50/*~~~~~~~~~~~~~~*/
51/* Geant4 */
52/*~~~~~~~~~~~~~~*/
53#include "G4BiasingProcessInterface.hh"
54#include "G4CascadeParameters.hh"
55#include "G4Electron.hh"
56#include "G4GDMLParser.hh"
57#include "G4GeometryManager.hh"
58#include "G4UImanager.hh"
59#include "G4UIsession.hh"
60#include "Randomize.hh"
61
62namespace genie {
63class Interaction;
64}
65
66namespace ldmx {
67class HepMC3GenEvent;
68}
69
70class G4UImanager;
71class G4UIsession;
72class G4RunManager;
73class G4GDMLParser;
74class G4GDMLMessenger;
75class G4CascadeParameters;
76
77namespace simcore {
78
87class Simulator : public SimulatorBase {
88 public:
99 Simulator(const std::string& name, framework::Process& process);
100
105 virtual ~Simulator() = default;
106
113 void configure(framework::config::Parameters& parameters) override;
114
122 void beforeNewRun(ldmx::RunHeader& header) override;
123
130 void onNewRun(const ldmx::RunHeader& header) override;
131
137 virtual void produce(framework::Event& event) override;
138
140 void onProcessEnd() override;
141
142 private:
150 void setSeeds(std::vector<int> seeds);
151
152 private:
155
158
160 int run_{-1};
161};
162} // namespace simcore
163
164#endif /* SIMCORE_SIMULATOR_H */
Class which defines basic APrime physics.
Base classes for all user event processing components to extend.
Classes which redirect the output of G4cout and G4cerr.
Header file for PrimaryGenerator.
Class which represents the process under execution.
Conditions object for random number seeds.
Class providing a Geant4 run manager implementation.
Class which implements the user tracking action.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:36
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:29
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:57
Producer that runs Geant4 simulation inside of ldmx-app.
Definition Simulator.h:87
void configure(framework::config::Parameters &parameters) override
Callback for the processor to configure itself from the given set of parameters.
Definition Simulator.cxx:15
Simulator(const std::string &name, framework::Process &process)
Constructor.
Definition Simulator.cxx:12
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:19
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.
Definition Simulator.cxx:86
virtual void produce(framework::Event &event) override
Run simulation and export results to output event.
Definition Simulator.cxx:98
int num_events_began_
Number of events started.
Definition Simulator.h:154
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:160
int num_events_completed_
Number of events completed.
Definition Simulator.h:157
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...