Geant4.10
 All Data Structures 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 79251 2014-02-20 16:16:23Z gcosmo $
27 //
28 /// \file field/field04/src/F04PhysicsList.cc
29 /// \brief Implementation of the F04PhysicsList class
30 //
31 
32 #include "F04PhysicsList.hh"
34 
35 #include "F04ExtraPhysics.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 "G4SystemOfUnits.hh"
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
68 {
70 
71  defaultCutValue = 1.*mm;
72  fCutForGamma = defaultCutValue;
73  fCutForElectron = defaultCutValue;
74  fCutForPositron = defaultCutValue;
75 
76  fMessenger = new F04PhysicsListMessenger(this);
77 
78  SetVerboseLevel(1);
79 
80 // G4PhysListFactory factory;
81  G4VModularPhysicsList* phys = NULL;
82  if (physName == "QGSP_BERT") {
83  phys = new QGSP_BERT;
84  } else {
85  phys = new FTFP_BERT;
86  }
87 
88 // if (factory.IsReferencePhysList(physName))
89 // phys =factory.GetReferencePhysList(physName);
90 
91  // Physics List is defined via environment variable PHYSLIST
92 // if (!phys) phys = factory.ReferencePhysList();
93 
94  if (!phys) G4Exception("WLSPhysicsList::WLSPhysicsList","InvalidSetup",
95  FatalException,"PhysicsList does not exist");
96 
97  for (G4int i = 0; ; ++i) {
98  G4VPhysicsConstructor* elem =
99  const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
100  if (elem == NULL) break;
101  G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
102  RegisterPhysics(elem);
103  }
104 
107 
108  fStepMaxProcess = new F04StepMax();
109  fMaxChargedStep = DBL_MAX;
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113 
115 {
116  delete fMessenger;
117 
118  delete fStepMaxProcess;
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122 
124 {
126 
128 
129  G4DecayTable* muonPlusDecayTable = new G4DecayTable();
130  muonPlusDecayTable -> Insert(new
131  G4MuonDecayChannelWithSpin("mu+",0.986));
132  muonPlusDecayTable -> Insert(new
134  G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(muonPlusDecayTable);
135 
136  G4DecayTable* muonMinusDecayTable = new G4DecayTable();
137  muonMinusDecayTable -> Insert(new
138  G4MuonDecayChannelWithSpin("mu-",0.986));
139  muonMinusDecayTable -> Insert(new
141  G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(muonMinusDecayTable);
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
147 {
149 
150  G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
151 
153 
154  G4VProcess* decay;
155  decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
156 
157  G4ProcessManager* pmanager;
158  pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
159 
160  if (pmanager) {
161  if (decay) pmanager->RemoveProcess(decay);
162  pmanager->AddProcess(decayWithSpin);
163  // set ordering for PostStepDoIt and AtRestDoIt
164  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
165  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
166  }
167 
168  decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
169 
171 
172  if (pmanager) {
173  if (decay) pmanager->RemoveProcess(decay);
174  pmanager->AddProcess(decayWithSpin);
175  // set ordering for PostStepDoIt and AtRestDoIt
176  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
177  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
178  }
179 
180  G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
181 
182  decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
183 
184  pmanager = G4PionPlus::PionPlus()->GetProcessManager();
185 
186  if (pmanager) {
187  if (decay) pmanager->RemoveProcess(decay);
188  pmanager->AddProcess(poldecay);
189  // set ordering for PostStepDoIt and AtRestDoIt
190  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
191  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
192  }
193 
194  decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
195 
197 
198  if (pmanager) {
199  if (decay) pmanager->RemoveProcess(decay);
200  pmanager->AddProcess(poldecay);
201  // set ordering for PostStepDoIt and AtRestDoIt
202  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
203  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
204  }
205 
206  AddStepMax();
207 }
208 
209 /*
210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
211 
212 void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
213 {
214  G4bool success = false;
215  for (G4PhysConstVector::iterator p = physicsVector->begin();
216  p != physicsVector->end(); ++p) {
217  G4VPhysicsConstructor* e = (*p);
218  if (e->GetPhysicsName() == name) {
219  physicsVector->erase(p);
220  success = true;
221  break;
222  }
223  }
224  if (!success) {
225  std::ostringstream message;
226  message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
227  G4Exception(message.str().c_str());
228  }
229 }
230 
231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232 
233 void F04PhysicsList::ClearPhysics()
234 {
235  for (G4PhysConstVector::iterator p = physicsVector->begin();
236  p != physicsVector->end(); ++p) {
237  delete (*p);
238  }
239  physicsVector->clear();
240 }
241 */
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
244 
246 {
247  if (verboseLevel >0) {
248  G4cout << "F04PhysicsList::SetCuts:";
249  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length")
250  << G4endl;
251  }
252 
253  // set cut values for gamma at first and for e- second and next for e+,
254  // because some processes for e+/e- need cut values for gamma
255  SetCutValue(fCutForGamma, "gamma");
256  SetCutValue(fCutForElectron, "e-");
257  SetCutValue(fCutForPositron, "e+");
258 
260 }
261 
262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263 
265 {
266  fCutForGamma = cut;
267  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
268 }
269 
270 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
271 
273 {
274  fCutForElectron = cut;
275  SetParticleCuts(fCutForElectron, G4Electron::Electron());
276 }
277 
278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
279 
281 {
282  fCutForPositron = cut;
283  SetParticleCuts(fCutForPositron, G4Positron::Positron());
284 }
285 
286 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
287 
289 {
290  fMaxChargedStep = step ;
291  fStepMaxProcess->SetStepMax(fMaxChargedStep);
292 }
293 
294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
295 
297 {
298  return fStepMaxProcess;
299 }
300 
301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
302 
304 {
305  // Step limitation seen as a process
306 
307  theParticleIterator->reset();
308  while ((*theParticleIterator)()){
309  G4ParticleDefinition* particle = theParticleIterator->value();
310  G4ProcessManager* pmanager = particle->GetProcessManager();
311 
312  if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
313  {
314  if (pmanager) pmanager ->AddDiscreteProcess(fStepMaxProcess);
315  }
316  }
317 }
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()
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 F04ExtraPhysics class.
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
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
void SetCutForGamma(G4double)
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()
F04PhysicsList(G4String)
F04StepMax * GetStepMaxProcess()
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
static G4MuonMinus * MuonMinus()
Definition: G4MuonMinus.cc:100
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
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
#define theParticleIterator