16 #include <FTFP_BERT.hh>
17 #include <FTFP_BERT_ATL.hh>
18 #include <G4EmParameters.hh>
19 #include <G4HadronicParameters.hh>
20 #include <G4HadronicProcessStore.hh>
21 #include <G4Profiler.hh>
22 #include <G4RunManager.hh>
23 #include <G4RunManagerFactory.hh>
24 #include <G4UserEventAction.hh>
25 #include <G4UserRunAction.hh>
26 #include <G4UserSteppingAction.hh>
27 #include <G4UserTrackingAction.hh>
28 #include <G4VUserDetectorConstruction.hh>
29 #include <G4VUserPhysicsList.hh>
30 #include <G4VUserPrimaryGeneratorAction.hh>
31 #include <G4Version.hh>
33 namespace ActsExamples {
36 std::unique_ptr<G4RunManager> _runManager,
37 std::unique_ptr<G4VUserPhysicsList> _physicsList,
40 runManager(std::
move(_runManager)),
41 physicsList(_physicsList.release()),
42 physicsListName(std::
move(_physicsListName)) {
44 std::invalid_argument(
"runManager cannot be null");
47 std::invalid_argument(
"physicsList cannot be null");
66 runManager.SetVerboseLevel(level);
67 G4EventManager::GetEventManager()->SetVerboseLevel(level);
68 G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(
70 G4EventManager::GetEventManager()->GetStackManager()->SetVerboseLevel(level);
73 #if G4VERSION_NUMBER >= 1100
74 G4HadronicParameters::Instance()->SetVerboseLevel(0);
75 G4HadronicProcessStore::Instance()->SetVerbose(0);
76 G4EmParameters::Instance()->SetIsPrintedFlag(
true);
90 int logLevel, std::unique_ptr<G4VUserPhysicsList> physicsList,
93 throw std::runtime_error(
"creating a second handle is prohibited");
96 throw std::runtime_error(
97 "creating a new handle is prohibited. you have to hold onto the "
101 auto runManager = std::unique_ptr<G4RunManager>(
102 G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly));
114 std::string name, std::shared_ptr<PhysicsListFactory> physicsListFactory) {
116 throw std::invalid_argument(
"name already mapped");
126 throw std::invalid_argument(
"name not mapped");
128 return it->second->factorize();
131 const std::unordered_map<std::string, std::shared_ptr<PhysicsListFactory>>&
138 "FTFP_BERT", std::make_shared<PhysicsListFactoryFunction>(
139 []() {
return std::make_unique<FTFP_BERT>(); }));
141 "FTFP_BERT_ATL", std::make_shared<PhysicsListFactoryFunction>(
142 []() {
return std::make_unique<FTFP_BERT_ATL>(); }));