Geant4  10.02.p02
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 85915 2014-11-06 09:05:23Z gcosmo $
27 //
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 #include "G4AutoDelete.hh"
65 
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {
73 
74  defaultCutValue = 1.*mm;
78 
80 
81  SetVerboseLevel(1);
82 
83 // G4PhysListFactory factory;
84  G4VModularPhysicsList* phys = NULL;
85  if (physName == "QGSP_BERT") {
86  phys = new QGSP_BERT;
87  } else {
88  phys = new FTFP_BERT;
89  }
90 
91 // if (factory.IsReferencePhysList(physName))
92 // phys =factory.GetReferencePhysList(physName);
93 
94  // Physics List is defined via environment variable PHYSLIST
95 // if (!phys) phys = factory.ReferencePhysList();
96 
97  if (!phys) G4Exception("WLSPhysicsList::WLSPhysicsList","InvalidSetup",
98  FatalException,"PhysicsList does not exist");
99 
100  for (G4int i = 0; ; ++i) {
101  G4VPhysicsConstructor* elem =
102  const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
103  if (elem == NULL) break;
104  G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
105  RegisterPhysics(elem);
106  }
107 
110 
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
117 {
118  delete fMessenger;
119 
120  //delete fStepMaxProcess;
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
126 {
128 
130 
131  G4DecayTable* muonPlusDecayTable = new G4DecayTable();
132  muonPlusDecayTable -> Insert(new
133  G4MuonDecayChannelWithSpin("mu+",0.986));
134  muonPlusDecayTable -> Insert(new
136  G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(muonPlusDecayTable);
137 
138  G4DecayTable* muonMinusDecayTable = new G4DecayTable();
139  muonMinusDecayTable -> Insert(new
140  G4MuonDecayChannelWithSpin("mu-",0.986));
141  muonMinusDecayTable -> Insert(new
143  G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(muonMinusDecayTable);
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147 
149 {
151 
152  fStepMaxProcess = new F04StepMax();
154 
155  G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
156 
158 
159  G4VProcess* decay;
160  decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
161 
162  G4ProcessManager* pmanager;
163  pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
164 
165  if (pmanager) {
166  if (decay) pmanager->RemoveProcess(decay);
167  pmanager->AddProcess(decayWithSpin);
168  // set ordering for PostStepDoIt and AtRestDoIt
169  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
170  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
171  }
172 
173  decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
174 
176 
177  if (pmanager) {
178  if (decay) pmanager->RemoveProcess(decay);
179  pmanager->AddProcess(decayWithSpin);
180  // set ordering for PostStepDoIt and AtRestDoIt
181  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
182  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
183  }
184 
185  G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
186 
187  decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
188 
189  pmanager = G4PionPlus::PionPlus()->GetProcessManager();
190 
191  if (pmanager) {
192  if (decay) pmanager->RemoveProcess(decay);
193  pmanager->AddProcess(poldecay);
194  // set ordering for PostStepDoIt and AtRestDoIt
195  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
196  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
197  }
198 
199  decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
200 
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  AddStepMax();
212 }
213 
214 /*
215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216 
217 void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
218 {
219  G4bool success = false;
220  for (G4PhysConstVector::iterator p = physicsVector->begin();
221  p != physicsVector->end(); ++p) {
222  G4VPhysicsConstructor* e = (*p);
223  if (e->GetPhysicsName() == name) {
224  physicsVector->erase(p);
225  success = true;
226  break;
227  }
228  }
229  if (!success) {
230  std::ostringstream message;
231  message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
232  G4Exception(message.str().c_str());
233  }
234 }
235 
236 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
237 
238 void F04PhysicsList::ClearPhysics()
239 {
240  for (G4PhysConstVector::iterator p = physicsVector->begin();
241  p != physicsVector->end(); ++p) {
242  delete (*p);
243  }
244  physicsVector->clear();
245 }
246 */
247 
248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
249 
251 {
252  if (verboseLevel >0) {
253  G4cout << "F04PhysicsList::SetCuts:";
254  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length")
255  << G4endl;
256  }
257 
258  // set cut values for gamma at first and for e- second and next for e+,
259  // because some processes for e+/e- need cut values for gamma
260  SetCutValue(fCutForGamma, "gamma");
263 
265 }
266 
267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
268 
270 {
271  fCutForGamma = cut;
273 }
274 
275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
276 
278 {
279  fCutForElectron = cut;
281 }
282 
283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
284 
286 {
287  fCutForPositron = cut;
289 }
290 
291 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
292 
294 {
295  fMaxChargedStep = step ;
297 }
298 
299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
300 
302 {
303  return fStepMaxProcess;
304 }
305 
306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
307 
309 {
310  // Step limitation seen as a process
311 
312  theParticleIterator->reset();
313  while ((*theParticleIterator)()){
314  G4ParticleDefinition* particle = theParticleIterator->value();
315  G4ProcessManager* pmanager = particle->GetProcessManager();
316 
317  if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
318  {
319  if (pmanager) pmanager ->AddDiscreteProcess(fStepMaxProcess);
320  }
321  }
322 }
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()
G4double fCutForGamma
G4double fCutForPositron
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
#define G4ThreadLocal
Definition: tls.hh:89
static G4ThreadLocal F04StepMax * fStepMaxProcess
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
void SetCutForGamma(G4double)
G4double fCutForElectron
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
F04PhysicsListMessenger * fMessenger
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.
G4double fMaxChargedStep
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
static const double mm
Definition: G4SIunits.hh:114
G4VProcess * RemoveProcess(G4VProcess *aProcess)
static G4ProcessTable * GetProcessTable()
G4VProcess * FindProcess(const G4String &processName, const G4String &particleName) const
#define theParticleIterator