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/Factory.h"
24#include "Framework/RunHeader.h"
25
26// Forward Declarations
27class G4Event;
28class G4PrimaryVertex;
29
30namespace simcore {
31
39class PrimaryGenerator : public G4VPrimaryGenerator {
40 public:
46 PrimaryGenerator(const std::string& name,
47 const framework::config::Parameters& parameters);
48
50 std::shared_ptr<PrimaryGenerator>,
51 const std::string&,
53
55 virtual ~PrimaryGenerator() = default;
56
62 virtual void GeneratePrimaryVertex(G4Event*) = 0;
63
70 // NOLINTNEXTLINE
71 virtual void RecordConfig(const std::string& id, ldmx::RunHeader& rh) = 0;
72
73 std::string name() { return name_; }
74
83 void smearBeamspot(G4PrimaryVertex* primary_vertex);
84
90 bool useBeamspot() const { return use_beamspot_; }
91
92 protected:
94 std::string name_{""};
95
97 bool use_beamspot_{false};
98
101
104
107}; // PrimaryGenerator
108
109} // namespace simcore
110
118#define DECLARE_GENERATOR(CLASS) \
119 FACTORY_REGISTRATION(simcore::PrimaryGenerator, CLASS)
120
121#endif // SIMCORE_PRIMARYGENERATOR_H
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
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].
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 ...