File indexing completed on 2025-01-31 09:21:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #include "G4String.hh"
0044 #include "G4VModularPhysicsList.hh"
0045 #include "G4PhysListFactoryAlt.hh"
0046 #include "G4PhysicsConstructorRegistry.hh"
0047 #include "G4PhysListRegistry.hh"
0048 #include "G4OpticalParameters.hh"
0049 #include "G4NeutronTrackingCut.hh"
0050 #include "G4StepLimiter.hh"
0051 #include "G4StepLimiterPhysics.hh"
0052 #include "G4SystemOfUnits.hh"
0053
0054 #include "PhysicsConfigurator.hh"
0055 #include "ConfigurationManager.hh"
0056
0057 #include <stdlib.h>
0058 PhysicsConfigurator* PhysicsConfigurator::instance = 0;
0059
0060 G4VModularPhysicsList* PhysicsConfigurator::Construct(G4String physName)
0061 {
0062
0063
0064
0065 G4PhysicsConstructorRegistry* g4pcr =
0066 G4PhysicsConstructorRegistry::Instance();
0067 G4PhysListRegistry* g4plr = G4PhysListRegistry::Instance();
0068 G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
0069 if(verbose)
0070 {
0071 G4cout << "Available Physics Constructors: "
0072 << g4pcr->AvailablePhysicsConstructors().size() << G4endl;
0073 G4cout << "Available Physics Lists: "
0074 << g4plr->AvailablePhysLists().size() << G4endl;
0075 G4cout << "Available Physics Extensions: "
0076 << g4plr->AvailablePhysicsExtensions().size() << G4endl;
0077 G4cout << "Available Physics Lists Em: "
0078 << g4plr->AvailablePhysListsEM().size() << G4endl;
0079 g4plr->SetVerbose(1);
0080 }
0081 else
0082 {
0083 g4plr->SetVerbose(0);
0084 }
0085 g4plr->AddPhysicsExtension("OPTICAL", "G4OpticalPhysics");
0086 g4plr->AddPhysicsExtension("STEPLIMIT", "G4StepLimiterPhysics");
0087 g4plr->AddPhysicsExtension("NEUTRONLIMIT", "G4NeutronTrackingCut");
0088 if(verbose)
0089 {
0090 g4pcr->PrintAvailablePhysicsConstructors();
0091 g4plr->PrintAvailablePhysLists();
0092 }
0093 g4alt::G4PhysListFactory factory;
0094 G4VModularPhysicsList* phys = nullptr;
0095 if(verbose)
0096 G4cout << "Physics configuration: " << physName << G4endl;
0097
0098
0099
0100
0101
0102
0103
0104 if(factory.IsReferencePhysList(physName))
0105 {
0106 phys = factory.GetReferencePhysList(physName);
0107 }
0108 else
0109 {
0110 G4cout << "Not a reference physics list" << G4endl;
0111 g4plr->PrintAvailablePhysLists();
0112 exit(EXIT_FAILURE);
0113 }
0114 if(verbose)
0115 {
0116 G4cout << phys->GetPhysicsTableDirectory() << G4endl;
0117 }
0118 G4OpticalParameters::Instance()->SetProcessActivation("Cerenkov", true);
0119 G4OpticalParameters::Instance()->SetProcessActivation("Scintillation", true);
0120 G4OpticalParameters::Instance()->SetProcessActivation("OpAbsorption", true);
0121 G4OpticalParameters::Instance()->SetProcessActivation("OpRayleigh", true);
0122 G4OpticalParameters::Instance()->SetProcessActivation("OpMieHG", false);
0123 G4OpticalParameters::Instance()->SetProcessActivation("OpWLS", true);
0124 G4OpticalParameters::Instance()->SetProcessActivation("OpWLS2", false);
0125
0126 G4OpticalParameters::Instance()->SetCerenkovStackPhotons(false);
0127 G4OpticalParameters::Instance()->SetScintStackPhotons(false);
0128 G4OpticalParameters::Instance()->SetScintTrackSecondariesFirst(
0129 true);
0130 G4OpticalParameters::Instance()->SetCerenkovTrackSecondariesFirst(
0131 true);
0132 G4OpticalParameters::Instance()->SetCerenkovMaxPhotonsPerStep(100);
0133 G4OpticalParameters::Instance()->SetCerenkovMaxBetaChange(10.0);
0134 if(verbose)
0135 {
0136 phys->DumpList();
0137 }
0138 return phys;
0139 }
0140
0141 PhysicsConfigurator* PhysicsConfigurator::getInstance()
0142 {
0143 if(instance == 0)
0144 instance = new PhysicsConfigurator();
0145 return instance;
0146 }