7 #include "G4VUserPhysicsList.hh"
8 #include "G4StateManager.hh"
9 #include "G4RunManager.hh"
10 #include "G4EmParameters.hh"
11 #include "G4UImanager.hh"
12 #include "G4PhysListFactory.hh"
13 #include "G4AntiNeutron.hh"
14 #include "G4HadronicProcessStore.hh"
16 #include "CLHEP/Units/PhysicalConstants.h"
23 : base_class(
name,pSvcLocator)
45 return StatusCode::SUCCESS;
53 G4PhysListFactory factory;
58 G4HadronicProcessStore::Instance()->SetVerbose(0);
75 throw "PhysicsListInitializationError";
82 std::vector<IPhysicsOptionTool*> sortedPhysicsOptions;
89 sortedPhysicsOptions.push_back(&*physOptTool);
96 sortedPhysicsOptions.push_back(&*physOptTool);
103 sortedPhysicsOptions.push_back(&*physOptTool);
110 sortedPhysicsOptions.push_back(&*physOptTool);
117 ATH_MSG_ERROR(physOptTool->name() <<
"set as UnknownType. This tool will not be used to modify the physics list of this job.");
123 for (
auto& physOptTool: sortedPhysicsOptions)
126 m_physicsList->RegisterPhysics(physOptTool->GetPhysicsOption().release());
132 m_physicsList->RegisterPhysics(physDecayTool->GetPhysicsOption().release());
156 G4RunManager::GetRunManager()->SetUserInitialization(
m_physicsList);
164 ATH_MSG_WARNING(
"Physics list not initialized before calling ConstructProcess()");
173 std::vector<std::string> g4commands;
176 std::ostringstream oss;
178 g4commands.push_back(oss.str());
183 std::ostringstream oss;
185 g4commands.push_back(oss.str());
188 if(!g4commands.empty()) {
191 G4UImanager* ui = G4UImanager::GetUIpointer();
192 for (
const auto& g4command : g4commands) {
193 int returnCode = ui->ApplyCommand( g4command );
198 G4EmParameters* emp = G4EmParameters::Instance();
204 emp->SetApplyCuts(
true);
208 G4AntiNeutron::Definition()->SetPDGStable(
false);
218 case 0: {
ATH_MSG_DEBUG(
"G4 Command: " << commandString <<
" - Command Succeeded"); }
break;
219 case 100: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Command Not Found!"); }
break;
221 auto* stateManager = G4StateManager::GetStateManager();
222 ATH_MSG_DEBUG(
"G4 Command: " << commandString <<
" - Illegal Application State (" <<
223 stateManager->GetStateString(stateManager->GetCurrentState()) <<
")!");
225 case 300: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Parameter Out of Range!"); }
break;
226 case 400: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Parameter Unreadable!"); }
break;
227 case 500: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Parameter Out of Candidates!"); }
break;
228 case 600: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Alias Not Found!"); }
break;
229 default: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Unknown Status!"); }
break;