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);
76 throw "PhysicsListInitializationError";
83 std::vector<IPhysicsOptionTool*> sortedPhysicsOptions;
89 if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::BSMPhysics) {
90 sortedPhysicsOptions.push_back(&*physOptTool);
96 if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::QS_ExtraParticles) {
97 sortedPhysicsOptions.push_back(&*physOptTool);
103 if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::QS_ExtraProc) {
104 sortedPhysicsOptions.push_back(&*physOptTool);
110 if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::GlobalProcesses) {
111 sortedPhysicsOptions.push_back(&*physOptTool);
117 if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::UnknownType) {
118 ATH_MSG_ERROR(physOptTool->name() <<
"set as UnknownType. This tool will not be used to modify the physics list of this job.");
124 for (
auto& physOptTool: sortedPhysicsOptions)
127 m_physicsList->RegisterPhysics(physOptTool->GetPhysicsOption().release());
133 m_physicsList->RegisterPhysics(physDecayTool->GetPhysicsOption().release());
157 G4RunManager::GetRunManager()->SetUserInitialization(
m_physicsList);
165 ATH_MSG_WARNING(
"Physics list not initialized before calling ConstructProcess()");
174 std::vector<std::string> g4commands;
177 std::ostringstream oss;
179 g4commands.push_back(oss.str());
184 std::ostringstream oss;
186 g4commands.push_back(oss.str());
189 if(!g4commands.empty()) {
192 G4UImanager* ui = G4UImanager::GetUIpointer();
193 for (
const auto& g4command : g4commands) {
194 int returnCode = ui->ApplyCommand( g4command );
199 G4EmParameters* emp = G4EmParameters::Instance();
205 emp->SetApplyCuts(
true);
209 G4AntiNeutron::Definition()->SetPDGStable(
false);
219 case 0: {
ATH_MSG_DEBUG(
"G4 Command: " << commandString <<
" - Command Succeeded"); }
break;
220 case 100: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Command Not Found!"); }
break;
222 auto* stateManager = G4StateManager::GetStateManager();
223 ATH_MSG_DEBUG(
"G4 Command: " << commandString <<
" - Illegal Application State (" <<
224 stateManager->GetStateString(stateManager->GetCurrentState()) <<
")!");
226 case 300: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Parameter Out of Range!"); }
break;
227 case 400: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Parameter Unreadable!"); }
break;
228 case 500: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Parameter Out of Candidates!"); }
break;
229 case 600: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Alias Not Found!"); }
break;
230 default: {
ATH_MSG_ERROR(
"G4 Command: " << commandString <<
" - Unknown Status!"); }
break;
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
void SetMultipleStepsInMSCTransport(G4bool val)
void SetVerbose(G4int val)
G4bool IsReferencePhysList(const G4String &)
Gaudi::Property< double > m_neutronEnergyCut
!< Time cut for neutrons (in the neutron killer process)
Gaudi::Property< double > m_emMaxEnergy
!< A general cut - this isn't normally used in our simulation
ToolHandleArray< IPhysicsOptionTool > m_phys_option
virtual void SetPhysicsOptions() override
Gaudi::Property< double > m_emMinEnergy
!< Maximum energy of the pre-calculated EM cross-section tables
Gaudi::Property< double > m_neutronTimeCut
!< Name for the physics list (property to be set in the tool)
Gaudi::Property< bool > m_applyEMCuts
!< Number of bins per Energy decade. Used for both DeDx and for the Lambda binning.
virtual void SetPhysicsList() override
Gaudi::Property< bool > m_multipleStepsInMSCTransport
!< Switch for the G4 "apply cuts" EM physics flag
Gaudi::Property< int > m_emNumberOfBinsPerDecade
!< Minimum energy of the pre-calculated EM cross-section tables
ToolHandle< IPhysicsOptionTool > m_fastSimulationConstructor
virtual StatusCode initialize() override
Gaudi::Property< bool > m_unstableAntiNeutrons
PhysicsListSvc(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_quietMode
virtual G4VUserPhysicsList * GetPhysicsList() override
ToolHandleArray< IPhysicsOptionTool > m_phys_decay
Gaudi::Property< std::string > m_physicsListName
!< Handle on the physics list
G4VModularPhysicsList * m_physicsList
virtual void CreatePhysicsList() override
void CommandLog(int returnCode, const std::string &commandString) const
This command prints a message about a G4Command depending on its returnCode.
Gaudi::Property< double > m_generalCut
!< Energy cut for neutrons (in the neutron killer process)