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/*~~~~~~~~~~~~~*/
42#include "SimCore/BiasOperators/XsecBiasingOperator.h"
43#include "SimCore/DetectorConstruction.h"
44#include "SimCore/Event/HepMC3GenEvent.h"
45#include "SimCore/G4Session.h"
47#include "SimCore/G4User/UserEventInformation.h"
49#include "SimCore/SDs/SensitiveDetector.h"
50
51/*~~~~~~~~~~~~~~*/
52/* Geant4 */
53/*~~~~~~~~~~~~~~*/
54#include "G4BiasingProcessInterface.hh"
55#include "G4CascadeParameters.hh"
56#include "G4Electron.hh"
57#include "G4GDMLParser.hh"
58#include "G4GeometryManager.hh"
59#include "G4UImanager.hh"
60#include "G4UIsession.hh"
61#include "Randomize.hh"
62
63namespace genie {
64class Interaction;
65}
66
67namespace ldmx {
68class HepMC3GenEvent;
69}
70
71class G4UImanager;
72class G4UIsession;
73class G4RunManager;
74class G4GDMLParser;
75class G4GDMLMessenger;
76class G4CascadeParameters;
77
78namespace simcore {
79
88class Simulator : public SimulatorBase {
89 public:
100 Simulator(const std::string& name, framework::Process& process);
101
106 virtual ~Simulator() = default;
107
114 void configure(framework::config::Parameters& parameters) override;
115
123 void beforeNewRun(ldmx::RunHeader& header) override;
124
131 void onNewRun(const ldmx::RunHeader& header) override;
132
138 virtual void produce(framework::Event& event) override;
139
141 void onProcessEnd() override;
142
143 private:
151 void setSeeds(std::vector<int> seeds);
152
153 private:
156
159
161 int run_{-1};
162};
163} // namespace simcore
164
165#endif /* SIMCORE_SIMULATOR_H */
Class which defines basic APrime physics.
Thread-local storage for cascade histories during simulation.
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:37
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:88
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:155
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:161
int num_events_completed_
Number of events completed.
Definition Simulator.h:158
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...