Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // $Id: F04PhysicsList.cc 100252 2016-10-17 07:50:45Z gcosmo $
27 //
30 //
31 
32 #include "F04PhysicsList.hh"
34 
35 #include "G4StepLimiterPhysics.hh"
36 #include "G4OpticalPhysics.hh"
37 
38 #include "G4LossTableManager.hh"
39 
40 #include "G4ProcessManager.hh"
41 #include "G4ParticleTypes.hh"
42 #include "G4ParticleTable.hh"
43 
44 //#include "G4PhysListFactory.hh"
45 #include "FTFP_BERT.hh"
46 #include "QGSP_BERT.hh"
47 
48 #include "G4Gamma.hh"
49 #include "G4Electron.hh"
50 #include "G4Positron.hh"
51 
52 #include "F04StepMax.hh"
53 
54 #include "G4ProcessTable.hh"
55 
56 #include "G4PionDecayMakeSpin.hh"
57 #include "G4DecayWithSpin.hh"
58 
59 #include "G4DecayTable.hh"
62 
63 #include "G4MuonMinusCapture.hh"
65 
66 #include "G4SystemOfUnits.hh"
67 #include "G4AutoDelete.hh"
68 
69 G4ThreadLocal F04StepMax* F04PhysicsList::fStepMaxProcess = 0;
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
74 {
76 
77  defaultCutValue = 1.*mm;
78  fCutForGamma = defaultCutValue;
79  fCutForElectron = defaultCutValue;
80  fCutForPositron = defaultCutValue;
81 
82  fMessenger = new F04PhysicsListMessenger(this);
83 
84  SetVerboseLevel(1);
85 
86 // G4PhysListFactory factory;
87  G4VModularPhysicsList* phys = NULL;
88  if (physName == "QGSP_BERT") {
89  phys = new QGSP_BERT;
90  } else {
91  phys = new FTFP_BERT;
92  }
93 
94 // if (factory.IsReferencePhysList(physName))
95 // phys =factory.GetReferencePhysList(physName);
96 
97  // Physics List is defined via environment variable PHYSLIST
98 // if (!phys) phys = factory.ReferencePhysList();
99 
100  if (!phys) G4Exception("WLSPhysicsList::WLSPhysicsList","InvalidSetup",
101  FatalException,"PhysicsList does not exist");
102 
103  for (G4int i = 0; ; ++i) {
104  G4VPhysicsConstructor* elem =
105  const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
106  if (elem == NULL) break;
107  G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
108  RegisterPhysics(elem);
109  }
110 
113 
114  fMaxChargedStep = DBL_MAX;
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118 
120 {
121  delete fMessenger;
122 
123  //delete fStepMaxProcess;
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127 
129 {
131 
133 
134  G4DecayTable* muonPlusDecayTable = new G4DecayTable();
135  muonPlusDecayTable -> Insert(new
136  G4MuonDecayChannelWithSpin("mu+",0.986));
137  muonPlusDecayTable -> Insert(new
139  G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(muonPlusDecayTable);
140 
141  G4DecayTable* muonMinusDecayTable = new G4DecayTable();
142  muonMinusDecayTable -> Insert(new
143  G4MuonDecayChannelWithSpin("mu-",0.986));
144  muonMinusDecayTable -> Insert(new
146  G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(muonMinusDecayTable);
147 }
148 
149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
150 
152 {
154 
155  fStepMaxProcess = new F04StepMax();
156  G4AutoDelete::Register(fStepMaxProcess);
157 
158  G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
159 
161 
162  G4VProcess* decay;
163  decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
164 
165  G4ProcessManager* pmanager;
166  pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
167 
168  if (pmanager) {
169  if (decay) pmanager->RemoveProcess(decay);
170  pmanager->AddProcess(decayWithSpin);
171  // set ordering for PostStepDoIt and AtRestDoIt
172  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
173  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
174  }
175 
176  decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
177 
179 
180  if (pmanager) {
181  if (decay) pmanager->RemoveProcess(decay);
182  pmanager->AddProcess(decayWithSpin);
183  // set ordering for PostStepDoIt and AtRestDoIt
184  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
185  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
186  }
187 
188  G4VProcess* process = processTable->
189  FindProcess("muMinusCaptureAtRest",G4MuonMinus::MuonMinus());
190 
191  if (pmanager) {
192  if (process) pmanager->RemoveProcess(process);
193  process = new G4MuonMinusCapture(new G4MuMinusCapturePrecompound());
194  pmanager->AddRestProcess(process);
195  }
196 
197  G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
198 
199  decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
200 
201  pmanager = G4PionPlus::PionPlus()->GetProcessManager();
202 
203  if (pmanager) {
204  if (decay) pmanager->RemoveProcess(decay);
205  pmanager->AddProcess(poldecay);
206  // set ordering for PostStepDoIt and AtRestDoIt
207  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
208  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
209  }
210 
211  decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
212 
214 
215  if (pmanager) {
216  if (decay) pmanager->RemoveProcess(decay);
217  pmanager->AddProcess(poldecay);
218  // set ordering for PostStepDoIt and AtRestDoIt
219  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
220  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
221  }
222 
223  AddStepMax();
224 }
225 
226 /*
227 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
228 
229 void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
230 {
231  G4bool success = false;
232  for (G4PhysConstVector::iterator p = physicsVector->begin();
233  p != physicsVector->end(); ++p) {
234  G4VPhysicsConstructor* e = (*p);
235  if (e->GetPhysicsName() == name) {
236  physicsVector->erase(p);
237  success = true;
238  break;
239  }
240  }
241  if (!success) {
242  std::ostringstream message;
243  message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
244  G4Exception(message.str().c_str());
245  }
246 }
247 
248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
249 
250 void F04PhysicsList::ClearPhysics()
251 {
252  for (G4PhysConstVector::iterator p = physicsVector->begin();
253  p != physicsVector->end(); ++p) {
254  delete (*p);
255  }
256  physicsVector->clear();
257 }
258 */
259 
260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
261 
263 {
264  if (verboseLevel >0) {
265  G4cout << "F04PhysicsList::SetCuts:";
266  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length")
267  << G4endl;
268  }
269 
270  // set cut values for gamma at first and for e- second and next for e+,
271  // because some processes for e+/e- need cut values for gamma
272  SetCutValue(fCutForGamma, "gamma");
273  SetCutValue(fCutForElectron, "e-");
274  SetCutValue(fCutForPositron, "e+");
275 
277 }
278 
279 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
280 
282 {
283  fCutForGamma = cut;
284  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
285 }
286 
287 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
288 
290 {
291  fCutForElectron = cut;
292  SetParticleCuts(fCutForElectron, G4Electron::Electron());
293 }
294 
295 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
296 
298 {
299  fCutForPositron = cut;
300  SetParticleCuts(fCutForPositron, G4Positron::Positron());
301 }
302 
303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304 
306 {
307  fMaxChargedStep = step ;
308  fStepMaxProcess->SetStepMax(fMaxChargedStep);
309 }
310 
311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
312 
314 {
315  return fStepMaxProcess;
316 }
317 
318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
319 
321 {
322  // Step limitation seen as a process
323 
325  particleIterator->reset();
326  while ((*particleIterator)()){
327  G4ParticleDefinition* particle = particleIterator->value();
328  G4ProcessManager* pmanager = particle->GetProcessManager();
329 
330  if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
331  {
332  if (pmanager) pmanager ->AddDiscreteProcess(fStepMaxProcess);
333  }
334  }
335 }
void SetStepMax(G4double)
Definition: F04StepMax.cc:64
static G4GenericIon * GenericIonDefinition()
Definition: G4GenericIon.cc:88
static G4MuonPlus * MuonPlus()
Definition: G4MuonPlus.cc:99
TQGSP_BERT< G4VModularPhysicsList > QGSP_BERT
Definition: QGSP_BERT.hh:63
void RegisterPhysics(G4VPhysicsConstructor *)
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
static G4LossTableManager * Instance()
static constexpr double mm
Definition: G4SIunits.hh:115
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: F04StepMax.cc:57
void SetCutValue(G4double aCut, const G4String &pname)
virtual void SetCuts()
virtual ~F04PhysicsList()
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
Definition of the F04PhysicsListMessenger class.
Provide control of the physics list and cut parameters.
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
void SetCutForGamma(G4double)
void Register(T *inst)
Definition: G4AutoDelete.hh:65
void SetCutForElectron(G4double)
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
const G4VPhysicsConstructor * GetPhysics(G4int index) const
void SetCutForPositron(G4double)
ParticleList decay(Cluster *const c)
Carries out a cluster decay.
virtual void ConstructProcess()
void Insert(const PVNodeID *pvPath, size_t pathLength, G4int index, Node *node)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
Definition of the F04StepMax class.
const G4String & GetPhysicsName() const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
void SetStepMax(G4double)
Definition of the F04PhysicsList class.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4Positron * Positron()
Definition: G4Positron.cc:94
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void ConstructParticle()
G4ProcessManager * GetProcessManager() const
F04PhysicsList(G4String)
F04StepMax * GetStepMaxProcess()
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
static G4MuonMinus * MuonMinus()
Definition: G4MuonMinus.cc:100
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
#define G4endl
Definition: G4ios.hh:61
G4int AddRestProcess(G4VProcess *aProcess, G4int ord=ordDefault)
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
G4VProcess * RemoveProcess(G4VProcess *aProcess)
static G4ProcessTable * GetProcessTable()
G4VProcess * FindProcess(const G4String &processName, const G4String &particleName) const