File indexing completed on 2025-10-16 08:08:31
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
0044
0045
0046
0047
0048
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4RunManager.hh"
0051 #include "G4Region.hh"
0052 #include "G4RegionStore.hh"
0053 #include "HadrontherapyPhysicsList.hh"
0054 #include "HadrontherapyPhysicsListMessenger.hh"
0055 #include "HadrontherapyStepMax.hh"
0056 #include "G4PhysListFactory.hh"
0057 #include "G4VPhysicsConstructor.hh"
0058 #include "G4HadronPhysicsQGSP_BIC_HP.hh"
0059 #include "G4HadronPhysicsQGSP_BIC.hh"
0060 #include "G4EmStandardPhysics_option4.hh"
0061 #include "G4EmStandardPhysics.hh"
0062 #include "G4EmExtraPhysics.hh"
0063 #include "G4StoppingPhysics.hh"
0064 #include "G4DecayPhysics.hh"
0065 #include "G4HadronElasticPhysics.hh"
0066 #include "G4HadronElasticPhysicsHP.hh"
0067 #include "G4RadioactiveDecayPhysics.hh"
0068 #include "G4IonBinaryCascadePhysics.hh"
0069 #include "G4DecayPhysics.hh"
0070 #include "G4NeutronTrackingCut.hh"
0071 #include "G4LossTableManager.hh"
0072 #include "G4UnitsTable.hh"
0073 #include "G4ProcessManager.hh"
0074 #include "G4IonFluctuations.hh"
0075 #include "G4IonParametrisedLossModel.hh"
0076 #include "G4EmParameters.hh"
0077 #include "G4ParallelWorldPhysics.hh"
0078 #include "G4EmLivermorePhysics.hh"
0079 #include "G4AutoDelete.hh"
0080 #include "G4HadronPhysicsQGSP_BIC_AllHP.hh"
0081 #include "QGSP_BIC_HP.hh"
0082 #include "QGSP_BIC.hh"
0083 #include "G4HadronPhysicsQGSP_BERT.hh"
0084 #include "G4HadronPhysicsQGSP_BERT_HP.hh"
0085 #include "G4ParallelWorldPhysics.hh"
0086
0087 #include "QBBC.hh"
0088 #include "QGSP_BIC.hh"
0089 #include "Shielding.hh"
0090 #include "QGSP_BERT.hh"
0091 #include "QGSP_BIC_AllHP.hh"
0092 #include "QGSP_BIC_HP.hh"
0093
0094
0095
0096
0097 HadrontherapyPhysicsList::HadrontherapyPhysicsList() : G4VModularPhysicsList()
0098 {
0099 G4LossTableManager::Instance();
0100 defaultCutValue = 1.*mm;
0101 cutForGamma = defaultCutValue;
0102 cutForElectron = defaultCutValue;
0103 cutForPositron = defaultCutValue;
0104
0105 pMessenger = new HadrontherapyPhysicsListMessenger(this);
0106 SetVerboseLevel(1);
0107 decay_List = new G4DecayPhysics();
0108
0109
0110 emPhysicsList = new G4EmStandardPhysics_option4();
0111 }
0112
0113
0114 HadrontherapyPhysicsList::~HadrontherapyPhysicsList()
0115 {
0116 delete pMessenger;
0117 delete emPhysicsList;
0118 delete decay_List;
0119
0120 hadronPhys.clear();
0121 for(size_t i=0; i<hadronPhys.size(); i++)
0122 {
0123 delete hadronPhys[i];
0124 }
0125 }
0126
0127
0128 void HadrontherapyPhysicsList::ConstructParticle()
0129 {
0130 decay_List -> ConstructParticle();
0131
0132 }
0133
0134
0135 void HadrontherapyPhysicsList::ConstructProcess()
0136 {
0137
0138
0139 AddTransportation();
0140
0141 decay_List -> ConstructProcess();
0142 emPhysicsList -> ConstructProcess();
0143
0144
0145
0146
0147
0148
0149 for(size_t i=0; i < hadronPhys.size(); i++)
0150 {
0151 hadronPhys[i] -> ConstructProcess();
0152 }
0153
0154
0155
0156 AddStepMax();
0157
0158
0159
0160 G4ParallelWorldPhysics* pWorld = new G4ParallelWorldPhysics("DetectorROGeometry");
0161 pWorld->ConstructProcess();
0162
0163 return;
0164 }
0165
0166
0167 void HadrontherapyPhysicsList::AddPhysicsList(const G4String& name)
0168 {
0169 if (verboseLevel>1) {
0170 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0171 }
0172 if (name == emName) return;
0173
0174
0175
0176
0177 if (name == "standard_opt4") {
0178 emName = name;
0179 delete emPhysicsList;
0180 hadronPhys.clear();
0181 emPhysicsList = new G4EmStandardPhysics_option4();
0182 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0183 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option4" << G4endl;
0184
0185
0186
0187
0188
0189 } else if (name == "HADRONTHERAPY_1") {
0190
0191 AddPhysicsList("standard_opt4");
0192 hadronPhys.push_back( new G4DecayPhysics());
0193 hadronPhys.push_back( new G4RadioactiveDecayPhysics());
0194 hadronPhys.push_back( new G4IonBinaryCascadePhysics());
0195 hadronPhys.push_back( new G4EmExtraPhysics());
0196 hadronPhys.push_back( new G4HadronElasticPhysicsHP());
0197 hadronPhys.push_back( new G4StoppingPhysics());
0198 hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC_HP());
0199 hadronPhys.push_back( new G4NeutronTrackingCut());
0200
0201 G4cout << "HADRONTHERAPY_1 PHYSICS LIST has been activated" << G4endl;
0202 }
0203
0204 else if (name == "HADRONTHERAPY_2") {
0205
0206 AddPhysicsList("standard_opt4");
0207 hadronPhys.push_back( new G4DecayPhysics());
0208 hadronPhys.push_back( new G4RadioactiveDecayPhysics());
0209 hadronPhys.push_back( new G4IonBinaryCascadePhysics());
0210 hadronPhys.push_back( new G4EmExtraPhysics());
0211 hadronPhys.push_back( new G4HadronElasticPhysics());
0212 hadronPhys.push_back( new G4StoppingPhysics());
0213 hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC_AllHP());
0214 hadronPhys.push_back( new G4NeutronTrackingCut());
0215
0216 G4cout << "HADRONTHERAPY_2 PHYSICS LIST has been activated" << G4endl;
0217
0218 }
0219
0220 else if (name == "QGSP_BIC"){
0221 auto physicsList = new QGSP_BIC;
0222 G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
0223 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0224 physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
0225 }
0226
0227 else if (name == "QGSP_BERT"){
0228 auto physicsList = new QGSP_BERT;
0229 G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
0230 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0231 physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
0232 }
0233
0234 else if (name == "QGSP_BIC_AllHP"){
0235 auto physicsList = new QGSP_BIC_AllHP;
0236 G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
0237 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0238 physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
0239 }
0240
0241 else if (name == "QGSP_BIC_HP"){
0242 auto physicsList = new QGSP_BIC_HP;
0243 G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
0244 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0245 physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
0246 }
0247
0248 else if (name == "Shielding"){
0249 auto physicsList = new Shielding;
0250 G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
0251 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0252 physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
0253 }
0254
0255 else if (name == "QBBC"){
0256 auto physicsList = new QBBC;
0257 G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
0258 G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0259 physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
0260 }
0261
0262 else {
0263 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0264 << " is not defined"
0265 << G4endl;
0266 }
0267
0268 }
0269
0270
0271 void HadrontherapyPhysicsList::AddStepMax()
0272 {
0273
0274
0275
0276 HadrontherapyStepMax* stepMaxProcess = new HadrontherapyStepMax();
0277
0278
0279 auto particleIterator = GetParticleIterator();
0280 particleIterator->reset();
0281 while ((*particleIterator)()){
0282 G4ParticleDefinition* particle = particleIterator->value();
0283 G4ProcessManager* pmanager = particle->GetProcessManager();
0284
0285 if (stepMaxProcess->IsApplicable(*particle) && pmanager)
0286 {
0287 pmanager ->AddDiscreteProcess(stepMaxProcess);
0288 }
0289 }
0290 }