LDMX Software
PrimaryGenerator.h
Go to the documentation of this file.
1
6#ifndef SIMCORE_PRIMARYGENERATOR_H
7#define SIMCORE_PRIMARYGENERATOR_H
8
9/*~~~~~~~~~~~~~~~~*/
10/* C++ StdLib */
11/*~~~~~~~~~~~~~~~~*/
12#include <string>
13
14/*~~~~~~~~~~~~*/
15/* Geant4 */
16/*~~~~~~~~~~~~*/
17#include "G4VPrimaryGenerator.hh"
18
19/*~~~~~~~~~~~~~~~*/
20/* Framework */
21/*~~~~~~~~~~~~~~~*/
22#include "Framework/Configure/Parameters.h"
23#include "Framework/Event.h"
24#include "Framework/Factory.h"
25#include "Framework/RunHeader.h"
26
27// Forward Declarations
28class G4Event;
29class G4PrimaryVertex;
30
31namespace simcore {
32
40class PrimaryGenerator : public G4VPrimaryGenerator {
41 public:
47 PrimaryGenerator(const std::string& name,
48 const framework::config::Parameters& parameters);
49
51 std::shared_ptr<PrimaryGenerator>,
52 const std::string&,
54
56 virtual ~PrimaryGenerator() = default;
57
71 virtual void prepEvent(const framework::Event& event) {}
72
78 virtual void GeneratePrimaryVertex(G4Event*) = 0;
79
86 // NOLINTNEXTLINE
87 virtual void RecordConfig(const std::string& id, ldmx::RunHeader& rh) = 0;
88
89 std::string name() { return name_; }
90
99 void smearBeamspot(G4PrimaryVertex* primary_vertex);
100
106 bool useBeamspot() const { return use_beamspot_; }
107
108 protected:
110 std::string name_{""};
111
113 bool use_beamspot_{false};
114
117
120
123}; // PrimaryGenerator
124
125} // namespace simcore
126
134#define DECLARE_GENERATOR(CLASS) \
135 FACTORY_REGISTRATION(simcore::PrimaryGenerator, CLASS)
136
137#endif // SIMCORE_PRIMARYGENERATOR_H
Class implementing an event buffer system for storing event data.
Header holding Factory class and supporting macros.
#define DECLARE_FACTORY_WITH_WAREHOUSE(...)
This macro is used in the public portion of your prototype class declaration.
Definition Factory.h:395
Implements an event buffer system for storing event data.
Definition Event.h:42
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
Interface that defines a simulation primary generator.
virtual ~PrimaryGenerator()=default
Destructor.
virtual void GeneratePrimaryVertex(G4Event *)=0
Generate a Primary Vertex.
std::string name_
Name of the PrimaryGenerator.
double beamspot_y_size_
Extent of the beamspot in y [mm].
virtual void prepEvent(const framework::Event &event)
Prepare to generate a new primary vertex given the input event context.
double beamspot_x_size_
Extent of the beamspot in x [mm].
virtual void RecordConfig(const std::string &id, ldmx::RunHeader &rh)=0
Record the configuration of the primary generator into the run header.
PrimaryGenerator(const std::string &name, const framework::config::Parameters &parameters)
Constructor.
double beamspot_z_size_
Extent of the beamspot in z [mm].
bool useBeamspot() const
Check if beam spot smearing is enabled for this generator.
bool use_beamspot_
Flag denoting whether beam spot smearing is enabled for this generator.
void smearBeamspot(G4PrimaryVertex *primary_vertex)
Apply beam spot smearing to a primary vertex.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...