File indexing completed on 2026-05-23 07:41:13
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 #include "F04PhysicsList.hh"
0030
0031 #include "F04PhysicsListMessenger.hh"
0032
0033 #include "G4LossTableManager.hh"
0034 #include "G4OpticalPhysics.hh"
0035 #include "G4ParticleTable.hh"
0036 #include "G4ParticleTypes.hh"
0037 #include "G4ProcessManager.hh"
0038 #include "G4StepLimiterPhysics.hh"
0039
0040 #include "F04StepMax.hh"
0041 #include "FTFP_BERT.hh"
0042 #include "QGSP_BERT.hh"
0043
0044 #include "G4DecayTable.hh"
0045 #include "G4DecayWithSpin.hh"
0046 #include "G4Electron.hh"
0047 #include "G4Gamma.hh"
0048 #include "G4MuMinusCapturePrecompound.hh"
0049 #include "G4MuonDecayChannelWithSpin.hh"
0050 #include "G4MuonMinusCapture.hh"
0051 #include "G4MuonRadiativeDecayChannelWithSpin.hh"
0052 #include "G4PionDecayMakeSpin.hh"
0053 #include "G4Positron.hh"
0054 #include "G4ProcessTable.hh"
0055 #include "G4SystemOfUnits.hh"
0056
0057 G4ThreadLocal F04StepMax* F04PhysicsList::fStepMaxProcess = nullptr;
0058
0059
0060
0061 F04PhysicsList::F04PhysicsList(const G4String& physName) : G4VModularPhysicsList()
0062 {
0063 G4LossTableManager::Instance();
0064
0065 defaultCutValue = 1. * mm;
0066
0067 fMessenger = new F04PhysicsListMessenger(this);
0068
0069 SetVerboseLevel(1);
0070
0071
0072 G4VModularPhysicsList* phys = nullptr;
0073 if (physName == "QGSP_BERT") {
0074 phys = new QGSP_BERT;
0075 }
0076 else {
0077 phys = new FTFP_BERT;
0078 }
0079
0080
0081
0082
0083
0084
0085
0086 if (!phys)
0087 G4Exception("F04PhysicsList::F04PhysicsList", "InvalidSetup", FatalException,
0088 "PhysicsList does not exist");
0089
0090 for (G4int i = 0;; ++i) {
0091 auto elem = const_cast<G4VPhysicsConstructor*>(phys->GetPhysics(i));
0092 if (elem == nullptr) break;
0093 G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
0094 RegisterPhysics(elem);
0095 }
0096
0097 RegisterPhysics(new G4StepLimiterPhysics());
0098 RegisterPhysics(new G4OpticalPhysics());
0099 }
0100
0101
0102
0103 F04PhysicsList::~F04PhysicsList()
0104 {
0105 delete fMessenger;
0106 }
0107
0108
0109
0110 void F04PhysicsList::ConstructParticle()
0111 {
0112 G4VModularPhysicsList::ConstructParticle();
0113
0114 G4GenericIon::GenericIonDefinition();
0115
0116 auto muonPlusDecayTable = new G4DecayTable();
0117 muonPlusDecayTable->Insert(new G4MuonDecayChannelWithSpin("mu+", 0.986));
0118 muonPlusDecayTable->Insert(new G4MuonRadiativeDecayChannelWithSpin("mu+", 0.014));
0119 G4MuonPlus::MuonPlusDefinition()->SetDecayTable(muonPlusDecayTable);
0120
0121 auto muonMinusDecayTable = new G4DecayTable();
0122 muonMinusDecayTable->Insert(new G4MuonDecayChannelWithSpin("mu-", 0.986));
0123 muonMinusDecayTable->Insert(new G4MuonRadiativeDecayChannelWithSpin("mu-", 0.014));
0124 G4MuonMinus::MuonMinusDefinition()->SetDecayTable(muonMinusDecayTable);
0125 }
0126
0127
0128
0129 void F04PhysicsList::ConstructProcess()
0130 {
0131 G4VModularPhysicsList::ConstructProcess();
0132
0133 fStepMaxProcess = new F04StepMax();
0134
0135 auto decayWithSpin = new G4DecayWithSpin();
0136
0137 G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
0138
0139 G4VProcess* decay;
0140 decay = processTable->FindProcess("Decay", G4MuonPlus::MuonPlus());
0141
0142 G4ProcessManager* pmanager;
0143 pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
0144
0145 if (pmanager) {
0146 if (decay) pmanager->RemoveProcess(decay);
0147 pmanager->AddProcess(decayWithSpin);
0148
0149 pmanager->SetProcessOrdering(decayWithSpin, idxPostStep);
0150 pmanager->SetProcessOrdering(decayWithSpin, idxAtRest);
0151 }
0152
0153 decay = processTable->FindProcess("Decay", G4MuonMinus::MuonMinus());
0154
0155 pmanager = G4MuonMinus::MuonMinus()->GetProcessManager();
0156
0157 if (pmanager) {
0158 if (decay) pmanager->RemoveProcess(decay);
0159 pmanager->AddProcess(decayWithSpin);
0160
0161 pmanager->SetProcessOrdering(decayWithSpin, idxPostStep);
0162 pmanager->SetProcessOrdering(decayWithSpin, idxAtRest);
0163 }
0164
0165 G4VProcess* process = processTable->FindProcess("muMinusCaptureAtRest", G4MuonMinus::MuonMinus());
0166
0167 if (pmanager) {
0168 if (process) pmanager->RemoveProcess(process);
0169 process = new G4MuonMinusCapture(new G4MuMinusCapturePrecompound());
0170 pmanager->AddRestProcess(process);
0171 }
0172
0173 auto poldecay = new G4PionDecayMakeSpin();
0174
0175 decay = processTable->FindProcess("Decay", G4PionPlus::PionPlus());
0176
0177 pmanager = G4PionPlus::PionPlus()->GetProcessManager();
0178
0179 if (pmanager) {
0180 if (decay) pmanager->RemoveProcess(decay);
0181 pmanager->AddProcess(poldecay);
0182
0183 pmanager->SetProcessOrdering(poldecay, idxPostStep);
0184 pmanager->SetProcessOrdering(poldecay, idxAtRest);
0185 }
0186
0187 decay = processTable->FindProcess("Decay", G4PionMinus::PionMinus());
0188
0189 pmanager = G4PionMinus::PionMinus()->GetProcessManager();
0190
0191 if (pmanager) {
0192 if (decay) pmanager->RemoveProcess(decay);
0193 pmanager->AddProcess(poldecay);
0194
0195 pmanager->SetProcessOrdering(poldecay, idxPostStep);
0196 pmanager->SetProcessOrdering(poldecay, idxAtRest);
0197 }
0198
0199 AddStepMax();
0200 }
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238 void F04PhysicsList::SetStepMax(G4double step)
0239 {
0240 fMaxChargedStep = step;
0241 fStepMaxProcess->SetStepMax(fMaxChargedStep);
0242 }
0243
0244
0245
0246 F04StepMax* F04PhysicsList::GetStepMaxProcess() const
0247 {
0248 return fStepMaxProcess;
0249 }
0250
0251
0252
0253 void F04PhysicsList::AddStepMax()
0254 {
0255
0256
0257 auto particleIterator = GetParticleIterator();
0258 particleIterator->reset();
0259 while ((*particleIterator)()) {
0260 G4ParticleDefinition* particle = particleIterator->value();
0261 G4ProcessManager* pmanager = particle->GetProcessManager();
0262
0263 if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0264 if (pmanager) pmanager->AddDiscreteProcess(fStepMaxProcess);
0265 }
0266 }
0267 }