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