Loading...
Searching...
No Matches
F04PhysicsList.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27/// \file field/field04/src/F04PhysicsList.cc
28/// \brief Implementation of the F04PhysicsList class
29//
30
31#include "F04PhysicsList.hh"
33
34#include "G4StepLimiterPhysics.hh"
35#include "G4OpticalPhysics.hh"
36
37#include "G4LossTableManager.hh"
38
39#include "G4ProcessManager.hh"
40#include "G4ParticleTypes.hh"
41#include "G4ParticleTable.hh"
42
43//#include "G4PhysListFactory.hh"
44#include "FTFP_BERT.hh"
45#include "QGSP_BERT.hh"
46
47#include "G4Gamma.hh"
48#include "G4Electron.hh"
49#include "G4Positron.hh"
50
51#include "F04StepMax.hh"
52
53#include "G4ProcessTable.hh"
54
55#include "G4PionDecayMakeSpin.hh"
56#include "G4DecayWithSpin.hh"
57
58#include "G4DecayTable.hh"
59#include "G4MuonDecayChannelWithSpin.hh"
60#include "G4MuonRadiativeDecayChannelWithSpin.hh"
61
62#include "G4MuonMinusCapture.hh"
63#include "G4MuMinusCapturePrecompound.hh"
64
65#include "G4SystemOfUnits.hh"
66#include "G4AutoDelete.hh"
67
68G4ThreadLocal F04StepMax* F04PhysicsList::fStepMaxProcess = nullptr;
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71
73{
74 G4LossTableManager::Instance();
75
76 defaultCutValue = 1.*mm;
77
79
80 SetVerboseLevel(1);
81
82// G4PhysListFactory factory;
83 G4VModularPhysicsList* phys = nullptr;
84 if (physName == "QGSP_BERT") {
85 phys = new QGSP_BERT;
86 } else {
87 phys = new FTFP_BERT;
88 }
89
90// if (factory.IsReferencePhysList(physName))
91// phys =factory.GetReferencePhysList(physName);
92
93 // Physics List is defined via environment variable PHYSLIST
94// if (!phys) phys = factory.ReferencePhysList();
95
96 if (!phys) G4Exception("F04PhysicsList::F04PhysicsList","InvalidSetup",
97 FatalException,"PhysicsList does not exist");
98
99 for (G4int i = 0; ; ++i) {
100 auto elem =
101 const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
102 if (elem == nullptr) break;
103 G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
104 RegisterPhysics(elem);
105 }
106
107 RegisterPhysics(new G4StepLimiterPhysics());
108 RegisterPhysics(new G4OpticalPhysics());
109}
110
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
112
114{
115 delete fMessenger;
116
117 //delete fStepMaxProcess;
118}
119
120//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121
123{
124 G4VModularPhysicsList::ConstructParticle();
125
126 G4GenericIon::GenericIonDefinition();
127
128 auto muonPlusDecayTable = new G4DecayTable();
129 muonPlusDecayTable -> Insert(new
130 G4MuonDecayChannelWithSpin("mu+",0.986));
131 muonPlusDecayTable -> Insert(new
133 G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(muonPlusDecayTable);
134
135 auto muonMinusDecayTable = new G4DecayTable();
136 muonMinusDecayTable -> Insert(new
137 G4MuonDecayChannelWithSpin("mu-",0.986));
138 muonMinusDecayTable -> Insert(new
140 G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(muonMinusDecayTable);
141}
142
143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144
146{
147 G4VModularPhysicsList::ConstructProcess();
148
150 G4AutoDelete::Register(fStepMaxProcess);
151
152 auto decayWithSpin = new G4DecayWithSpin();
153
154 G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
155
157 decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
158
159 G4ProcessManager* pmanager;
160 pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
161
162 if (pmanager) {
163 if (decay) pmanager->RemoveProcess(decay);
164 pmanager->AddProcess(decayWithSpin);
165 // set ordering for PostStepDoIt and AtRestDoIt
166 pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
167 pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
168 }
169
170 decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
171
172 pmanager = G4MuonMinus::MuonMinus()->GetProcessManager();
173
174 if (pmanager) {
175 if (decay) pmanager->RemoveProcess(decay);
176 pmanager->AddProcess(decayWithSpin);
177 // set ordering for PostStepDoIt and AtRestDoIt
178 pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
179 pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
180 }
181
182 G4VProcess* process = processTable->
183 FindProcess("muMinusCaptureAtRest",G4MuonMinus::MuonMinus());
184
185 if (pmanager) {
186 if (process) pmanager->RemoveProcess(process);
188 pmanager->AddRestProcess(process);
189 }
190
191 auto poldecay = new G4PionDecayMakeSpin();
192
193 decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
194
195 pmanager = G4PionPlus::PionPlus()->GetProcessManager();
196
197 if (pmanager) {
198 if (decay) pmanager->RemoveProcess(decay);
199 pmanager->AddProcess(poldecay);
200 // set ordering for PostStepDoIt and AtRestDoIt
201 pmanager ->SetProcessOrdering(poldecay, idxPostStep);
202 pmanager ->SetProcessOrdering(poldecay, idxAtRest);
203 }
204
205 decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
206
207 pmanager = G4PionMinus::PionMinus()->GetProcessManager();
208
209 if (pmanager) {
210 if (decay) pmanager->RemoveProcess(decay);
211 pmanager->AddProcess(poldecay);
212 // set ordering for PostStepDoIt and AtRestDoIt
213 pmanager ->SetProcessOrdering(poldecay, idxPostStep);
214 pmanager ->SetProcessOrdering(poldecay, idxAtRest);
215 }
216
217 AddStepMax();
218}
219
220/*
221//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
222
223void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
224{
225 G4bool success = false;
226 for (G4PhysConstVector::iterator p = physicsVector->begin();
227 p != physicsVector->end(); ++p) {
228 G4VPhysicsConstructor* e = (*p);
229 if (e->GetPhysicsName() == name) {
230 physicsVector->erase(p);
231 success = true;
232 break;
233 }
234 }
235 if (!success) {
236 std::ostringstream message;
237 message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
238 G4Exception(message.str().c_str());
239 }
240}
241
242//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
243
244void F04PhysicsList::ClearPhysics()
245{
246 for (G4PhysConstVector::iterator p = physicsVector->begin();
247 p != physicsVector->end(); ++p) {
248 delete (*p);
249 }
250 physicsVector->clear();
251}
252*/
253
254//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
255
261
262//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263
268
269//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
270
272{
273 // Step limitation seen as a process
274
275 auto particleIterator=GetParticleIterator();
276 particleIterator->reset();
277 while ((*particleIterator)()){
278 G4ParticleDefinition* particle = particleIterator->value();
279 G4ProcessManager* pmanager = particle->GetProcessManager();
280
281 if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
282 {
283 if (pmanager) pmanager ->AddDiscreteProcess(fStepMaxProcess);
284 }
285 }
286}
Definition of the F04PhysicsListMessenger class.
Definition of the F04PhysicsList class.
Definition of the F04StepMax class.
Provide control of the physics list and cut parameters.
~F04PhysicsList() override
void ConstructProcess() override
F04StepMax * GetStepMaxProcess()
F04PhysicsList(G4String)
F04PhysicsListMessenger * fMessenger
G4double fMaxChargedStep
void SetStepMax(G4double)
void ConstructParticle() override
static G4ThreadLocal F04StepMax * fStepMaxProcess
G4bool IsApplicable(const G4ParticleDefinition &) override
Definition F04StepMax.cc:48
void SetStepMax(G4double)
Definition F04StepMax.cc:55
ParticleList decay(Cluster *const c)

Applications | User Support | Publications | Collaboration