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/RunHeader.h"
24#include "SimCore/Factory.h"
25
26// Forward Declarations
27class G4Event;
28
29namespace simcore {
30
38class PrimaryGenerator : public G4VPrimaryGenerator {
39 public:
45 PrimaryGenerator(const std::string& name,
46 const framework::config::Parameters& parameters);
47
49 using Factory =
51 const std::string&,
53
55 virtual ~PrimaryGenerator() = default;
56
62 virtual void GeneratePrimaryVertex(G4Event*) = 0;
63
70 virtual void RecordConfig(const std::string& id, ldmx::RunHeader& rh) = 0;
71
72 protected:
74 std::string name_{""};
75}; // PrimaryGenerator
76
77} // namespace simcore
78
86#define DECLARE_GENERATOR(CLASS) \
87 namespace { \
88 auto v = ::simcore::PrimaryGenerator::Factory::get().declare<CLASS>(); \
89 }
90
91#endif // SIMCORE_PRIMARYGENERATOR_H
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:54
Factory to dynamically create objects derived from a specific prototype class.
Definition Factory.h:197
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.
virtual void RecordConfig(const std::string &id, ldmx::RunHeader &rh)=0
Record the configuration of the primary generator into the run header.