source: trunk/examples/extended/electromagnetic/TestEm16/src/PhysicsList.cc @ 1309

Last change on this file since 1309 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 7.5 KB
Line 
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: PhysicsList.cc,v 1.5 2009/11/19 18:12:32 maire Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "PhysicsList.hh"
33#include "PhysicsListMessenger.hh"
34
35#include "G4ParticleDefinition.hh"
36#include "G4ProcessManager.hh"
37#include "G4ParticleTypes.hh"
38#include "G4ParticleTable.hh"
39
40#include "G4ComptonScattering.hh"
41#include "G4GammaConversion.hh"
42#include "G4PhotoElectricEffect.hh"
43
44#include "G4eMultipleScattering.hh"
45#include "G4eIonisation.hh"
46#include "G4eBremsstrahlung.hh"
47#include "G4eplusAnnihilation.hh"
48
49#include "G4MuMultipleScattering.hh"
50#include "G4MuIonisation.hh"
51#include "G4MuBremsstrahlung.hh"
52#include "G4MuPairProduction.hh"
53
54#include "G4SynchrotronRadiation.hh"
55#include "G4SynchrotronRadiationInMat.hh"
56
57#include "G4StepLimiter.hh"
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
61PhysicsList::PhysicsList()
62: G4VUserPhysicsList()
63{
64  defaultCutValue = 1.*km;
65 
66  SRType = true; 
67  pMes = new PhysicsListMessenger(this);
68}
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71
72PhysicsList::~PhysicsList()
73{ 
74  delete pMes;
75}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78
79void PhysicsList::ConstructParticle()
80{
81  // In this method, static member functions should be called
82  // for all particles which you want to use.
83  // This ensures that objects of these particle types will be
84  // created in the program.
85
86  ConstructBosons();
87  ConstructLeptons();
88}
89
90//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91
92void PhysicsList::ConstructBosons()
93{
94  // pseudo-particles
95  G4Geantino::GeantinoDefinition();
96  G4ChargedGeantino::ChargedGeantinoDefinition();
97
98  // gamma
99  G4Gamma::GammaDefinition();
100}
101
102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103
104void PhysicsList::ConstructLeptons()
105{
106  // leptons
107  G4Electron::ElectronDefinition();
108  G4Positron::PositronDefinition();
109  G4MuonPlus::MuonPlusDefinition();
110  G4MuonMinus::MuonMinusDefinition();
111
112  G4NeutrinoE::NeutrinoEDefinition();
113  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
114  G4NeutrinoMu::NeutrinoMuDefinition();
115  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
116}
117
118//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119
120void PhysicsList::ConstructProcess()
121{
122  AddTransportation();
123  ConstructEM();
124  ConstructGeneral();
125}
126
127//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
128
129void PhysicsList::ConstructEM()
130{
131  theParticleIterator->reset();
132  while( (*theParticleIterator)() ){
133    G4ParticleDefinition* particle = theParticleIterator->value();
134    G4ProcessManager* pmanager = particle->GetProcessManager();
135    G4String particleName = particle->GetParticleName();
136
137    if (particleName == "gamma") {
138      // gamma
139      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
140      pmanager->AddDiscreteProcess(new G4ComptonScattering);
141      pmanager->AddDiscreteProcess(new G4GammaConversion);
142           
143    } else if (particleName == "e-") {
144      //electron
145      pmanager->AddProcess(new G4eMultipleScattering,       -1, 1, 1);
146      pmanager->AddProcess(new G4eIonisation,               -1, 2, 2);
147      pmanager->AddProcess(new G4eBremsstrahlung,           -1, 3, 3);
148      if (SRType)
149      pmanager->AddProcess(new G4SynchrotronRadiation,      -1,-1, 4);
150      else
151      pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 4); 
152      pmanager->AddProcess(new G4StepLimiter,               -1,-1, 5);
153     
154    } else if (particleName == "e+") {
155      //positron
156      pmanager->AddProcess(new G4eMultipleScattering,       -1, 1, 1);
157      pmanager->AddProcess(new G4eIonisation,               -1, 2, 2);
158      pmanager->AddProcess(new G4eBremsstrahlung,           -1, 3, 3);
159      pmanager->AddProcess(new G4eplusAnnihilation,          0,-1, 4);
160      if (SRType)
161      pmanager->AddProcess(new G4SynchrotronRadiation,      -1,-1, 5);
162      else
163      pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5);       
164      pmanager->AddProcess(new G4StepLimiter,               -1,-1, 6);
165     
166    } else if( particleName == "mu+" ||
167               particleName == "mu-"    ) {
168      //muon
169      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
170      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
171      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
172      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
173     
174    }
175  }
176}
177
178//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179
180#include "G4Decay.hh"
181
182void PhysicsList::ConstructGeneral()
183{
184  // Add Decay Process
185  G4Decay* theDecayProcess = new G4Decay();
186  theParticleIterator->reset();
187  while ((*theParticleIterator)()){
188      G4ParticleDefinition* particle = theParticleIterator->value();
189      G4ProcessManager* pmanager = particle->GetProcessManager();
190      if (theDecayProcess->IsApplicable(*particle)) {
191        pmanager ->AddProcess(theDecayProcess);
192        // set ordering for PostStepDoIt and AtRestDoIt
193        pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
194        pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
195      }
196  }
197}
198
199//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
200
201void PhysicsList::SetCuts()
202{
203  if (verboseLevel >0){
204    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
205  }
206
207  // set cut values for gamma at first and for e- second and next for e+,
208  // because some processes for e+/e- need cut values for gamma
209  SetCutValue(defaultCutValue, "gamma");
210  SetCutValue(defaultCutValue, "e-");
211  SetCutValue(defaultCutValue, "e+");
212
213  if (verboseLevel>0) DumpCutValuesTable();
214}
215
216//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.