GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSHEPEvtGeneratorAction.cpp
Go to the documentation of this file.
1 /*
2  * GGSHEPEvtGeneratorAction.cpp
3  *
4  * Created on: 10 Oct 2013
5  * Author: Nicola Mori
6  */
7 
12 
13 #include "G4HEPEvtInterface.hh"
14 
16 
18  : _hepEvtGenerator(nullptr), _messenger(this, "/GGS/generatorActions/hepEvt/"), _hepEvtPos(0., 0., 0.),
19  _hepEvtTime(0.) {
20 
21  _messenger.DeclareProperty("file", _hepEvtFile, "File containing the generated events in the HEPEvt format.")
22  .SetStates(G4State_Idle);
23  _messenger.DeclareProperty("position", _hepEvtPos, "Position of generation vertex.")
24  .SetDefaultUnit("cm")
25  .SetStates(G4State_Idle);
26  _messenger.DeclareProperty("time", _hepEvtTime, "Time of event generation.")
27  .SetDefaultUnit("ns")
28  .SetStates(G4State_Idle);
29 }
30 
32  if (!_hepEvtGenerator) {
33  _hepEvtGenerator = std::make_unique<G4HEPEvtInterface>(_hepEvtFile);
34  _hepEvtGenerator->SetParticlePosition(_hepEvtPos);
35  _hepEvtGenerator->SetParticleTime(_hepEvtTime);
36  }
37  _hepEvtGenerator->GeneratePrimaryVertex(anEvent);
38 }
39 
41  GGSParameters params;
42  params.SetParam("generator", std::string("hepEvt"));
43  return params;
44 }
GGSParameters GetParameters() const
Gets the generation parameters.
A generator action to produce particles using the HEPEvt generator.
void SetParam(const std::string &name, T value)
Sets a parameter.
Class for storing parameters.
Definition: GGSParameters.h:29
#define RegisterGA(gaClassName, gaName)
Macro for registration of user generator actions.
void GeneratePrimaries(G4Event *anEvent)
Generate primaries with GPS generator.