GGS(GenericGEANT4Simulation)Software  2.6.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 
15 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
16 
18 
19 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
20 
22  _hepEvtGenerator(NULL), _hepEvtPos(0., 0., 0.), _hepEvtTime(0.) {
23 
24  _messenger = new G4GenericMessenger(this, "/GGS/generatorActions/hepEvt/");
25  _messenger->DeclareProperty("file", _hepEvtFile, "File containing the generated events in the HEPEvt format.").SetStates(
26  G4State_Idle);
27  _messenger->DeclareProperty("position", _hepEvtPos, "Position of generation vertex.").SetDefaultUnit("cm").SetStates(
28  G4State_Idle);
29  _messenger->DeclareProperty("time", _hepEvtTime, "Time of event generation.").SetDefaultUnit("ns").SetStates(
30  G4State_Idle);
31 }
32 
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
36  delete _hepEvtGenerator;
37  delete _messenger;
38 }
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
43  if (!_hepEvtGenerator) {
44  _hepEvtGenerator = new G4HEPEvtInterface(_hepEvtFile);
45  _hepEvtGenerator->SetParticlePosition(_hepEvtPos);
46  _hepEvtGenerator->SetParticleTime(_hepEvtTime);
47  }
48  _hepEvtGenerator->GeneratePrimaryVertex(anEvent);
49 }
A generator action to produce particles using the HEPEvt generator.
#define RegisterGA(gaClassName, gaName)
Macro for registration of user generator actions.
void GeneratePrimaries(G4Event *anEvent)
Generate primaries with GPS generator.