EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eASTActionInitialization.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eASTActionInitialization.cc
1 // ********************************************************************
2 //
3 // eASTActionInitialization.cc
4 // Action initialization class
5 //
6 // History
7 // May 8th, 2021 : first implementation - Makoto Asai (SLAC)
8 // June 23rd, 2021 : Add HepMC3INterface - Makoto Asai (SLAC)
9 //
10 // ********************************************************************
11 
13 #include "eASTRunAction.hh"
15 #include "eASTTrackingAction.hh"
16 #include "G4GenericMessenger.hh"
17 
18 #ifdef eAST_USE_HepMC3
19 #include "eASTHepMC3Interface.hh"
20 #endif // eAST_USE_HepMC3
21 
23 {
24  filler = new G4TScoreHistFiller<G4AnalysisManager>;
25 
26  generatorMsg = new G4GenericMessenger(this,"/eAST/generator/",
27  "primary particle generator selection");
28 
29  auto& useParticleGunCmd = generatorMsg->DeclareProperty("useParticleGun",
30  useParticleGun, "use Particle Gun");
31  useParticleGunCmd.SetStates(G4State_PreInit);
32  useParticleGunCmd.SetToBeBroadcasted(false);
33  auto& useParticleSourceCmd = generatorMsg->DeclareProperty("useParticleSource",
34  useParticleSource, "use General Particle Source");
35  useParticleSourceCmd.SetStates(G4State_PreInit);
36  useParticleSourceCmd.SetToBeBroadcasted(false);
37 
38 #ifdef eAST_USE_HepMC3
39  auto& useHepMC3InterfaceCmd = generatorMsg->DeclareProperty("useHepMC3",
40  useHepMC3Interface, "use HepMC3 interface");
41  useHepMC3InterfaceCmd.SetStates(G4State_PreInit);
42  useHepMC3InterfaceCmd.SetToBeBroadcasted(false);
43 #endif // eAST_USE_HepMC3
44 }
45 
47 {
48  delete filler;
49  delete generatorMsg;
50 }
51 
53 {
54  SetUserAction(new eASTRunAction);
55 #ifdef eAST_USE_HepMC3
57  {
59  G4cout << "eASTHepMC3Interface is instantiated ########### " << HepMC3 << G4endl;
60  }
61 #endif // eAST_USE_HepMC3
62 }
63 
65 {
66  SetUserAction(new eASTRunAction);
67  SetUserAction(new eASTTrackingAction);
69  {
70  G4ExceptionDescription ed;
71  ed << "No way to generate primary particles!!!\n"
72  << "Use command(s) in /eAST/generator/ to define at least one primary generator.";
73  G4Exception("eASTActionInitialization::Build()","eAST0001",FatalException,ed);
74  }
77 }
78