source: trunk/examples/novice/N02/src/ExN02PhysicsList.cc @ 1333

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

update to geant4.9.3

File size: 9.6 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//
27// $Id: ExN02PhysicsList.cc,v 1.27 2009/11/15 14:27:30 maire Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "globals.hh"
34#include "ExN02PhysicsList.hh"
35
36#include "G4ProcessManager.hh"
37#include "G4ParticleTypes.hh"
38
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
41ExN02PhysicsList::ExN02PhysicsList():  G4VUserPhysicsList()
42{
43  defaultCutValue = 1.0*cm;
44   SetVerboseLevel(1);
45}
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48
49ExN02PhysicsList::~ExN02PhysicsList()
50{}
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
54void ExN02PhysicsList::ConstructParticle()
55{
56  // In this method, static member functions should be called
57  // for all particles which you want to use.
58  // This ensures that objects of these particle types will be
59  // created in the program.
60
61  ConstructBosons();
62  ConstructLeptons();
63  ConstructMesons();
64  ConstructBaryons();
65}
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
69void ExN02PhysicsList::ConstructBosons()
70{
71  // pseudo-particles
72  G4Geantino::GeantinoDefinition();
73  G4ChargedGeantino::ChargedGeantinoDefinition();
74
75  // gamma
76  G4Gamma::GammaDefinition();
77}
78
79//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80
81void ExN02PhysicsList::ConstructLeptons()
82{
83  // leptons
84  //  e+/-
85  G4Electron::ElectronDefinition();
86  G4Positron::PositronDefinition();
87  // mu+/-
88  G4MuonPlus::MuonPlusDefinition();
89  G4MuonMinus::MuonMinusDefinition();
90  // nu_e
91  G4NeutrinoE::NeutrinoEDefinition();
92  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
93  // nu_mu
94  G4NeutrinoMu::NeutrinoMuDefinition();
95  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
96}
97
98//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99
100void ExN02PhysicsList::ConstructMesons()
101{
102  //  mesons
103  //    light mesons
104  G4PionPlus::PionPlusDefinition();
105  G4PionMinus::PionMinusDefinition();
106  G4PionZero::PionZeroDefinition();
107  G4Eta::EtaDefinition();
108  G4EtaPrime::EtaPrimeDefinition();
109  G4KaonPlus::KaonPlusDefinition();
110  G4KaonMinus::KaonMinusDefinition();
111  G4KaonZero::KaonZeroDefinition();
112  G4AntiKaonZero::AntiKaonZeroDefinition();
113  G4KaonZeroLong::KaonZeroLongDefinition();
114  G4KaonZeroShort::KaonZeroShortDefinition();
115}
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118
119void ExN02PhysicsList::ConstructBaryons()
120{
121  //  barions
122  G4Proton::ProtonDefinition();
123  G4AntiProton::AntiProtonDefinition();
124
125  G4Neutron::NeutronDefinition();
126  G4AntiNeutron::AntiNeutronDefinition();
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130
131void ExN02PhysicsList::ConstructProcess()
132{
133  AddTransportation();
134  ConstructEM();
135  ConstructGeneral();
136  AddStepMax();
137}
138
139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140
141#include "G4ComptonScattering.hh"
142#include "G4GammaConversion.hh"
143#include "G4PhotoElectricEffect.hh"
144
145#include "G4eMultipleScattering.hh"
146#include "G4eIonisation.hh"
147#include "G4eBremsstrahlung.hh"
148#include "G4eplusAnnihilation.hh"
149
150#include "G4MuMultipleScattering.hh"
151#include "G4MuIonisation.hh"
152#include "G4MuBremsstrahlung.hh"
153#include "G4MuPairProduction.hh"
154
155#include "G4hMultipleScattering.hh"
156#include "G4hIonisation.hh"
157#include "G4hBremsstrahlung.hh"
158#include "G4hPairProduction.hh"
159
160#include "G4ionIonisation.hh"
161
162//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
163
164void ExN02PhysicsList::ConstructEM()
165{
166  theParticleIterator->reset();
167  while( (*theParticleIterator)() ){
168    G4ParticleDefinition* particle = theParticleIterator->value();
169    G4ProcessManager* pmanager = particle->GetProcessManager();
170    G4String particleName = particle->GetParticleName();
171     
172    if (particleName == "gamma") {
173      // gamma         
174      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
175      pmanager->AddDiscreteProcess(new G4ComptonScattering);
176      pmanager->AddDiscreteProcess(new G4GammaConversion);
177     
178    } else if (particleName == "e-") {
179      //electron
180      pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
181      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
182      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);     
183
184    } else if (particleName == "e+") {
185      //positron
186      pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
187      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
188      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
189      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
190
191    } else if( particleName == "mu+" || 
192               particleName == "mu-"    ) {
193      //muon 
194      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
195      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
196      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
197      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);       
198             
199    } else if( particleName == "proton" ||
200               particleName == "pi-" ||
201               particleName == "pi+"    ) {
202      //proton 
203      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
204      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
205      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
206      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
207     
208    } else if( particleName == "alpha" || 
209               particleName == "He3" )     {
210      //alpha
211      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
212      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
213     
214    } else if( particleName == "GenericIon" ) { 
215      //Ions
216      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
217      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
218                 
219    } else if ((!particle->IsShortLived()) &&
220               (particle->GetPDGCharge() != 0.0) && 
221               (particle->GetParticleName() != "chargedgeantino")) {
222      //all others charged particles except geantino
223      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
224      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
225    }
226  }
227}
228
229//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
230
231#include "G4Decay.hh"
232
233void ExN02PhysicsList::ConstructGeneral()
234{
235  // Add Decay Process
236  G4Decay* theDecayProcess = new G4Decay();
237  theParticleIterator->reset();
238  while( (*theParticleIterator)() ){
239    G4ParticleDefinition* particle = theParticleIterator->value();
240    G4ProcessManager* pmanager = particle->GetProcessManager();
241    if (theDecayProcess->IsApplicable(*particle)) { 
242      pmanager ->AddProcess(theDecayProcess);
243      // set ordering for PostStepDoIt and AtRestDoIt
244      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
245      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
246    }
247  }
248}
249 
250//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
251
252#include "G4StepLimiter.hh"
253#include "G4UserSpecialCuts.hh"
254
255void ExN02PhysicsList::AddStepMax()
256{
257  // Step limitation seen as a process
258  G4StepLimiter* stepLimiter = new G4StepLimiter();
259  ////G4UserSpecialCuts* userCuts = new G4UserSpecialCuts();
260 
261  theParticleIterator->reset();
262  while ((*theParticleIterator)()){
263      G4ParticleDefinition* particle = theParticleIterator->value();
264      G4ProcessManager* pmanager = particle->GetProcessManager();
265
266      if (particle->GetPDGCharge() != 0.0)
267        {
268          pmanager ->AddDiscreteProcess(stepLimiter);
269          ////pmanager ->AddDiscreteProcess(userCuts);
270        }
271  }
272}
273
274//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
275
276void ExN02PhysicsList::SetCuts()
277{
278  //G4VUserPhysicsList::SetCutsWithDefault method sets
279  //the default cut value for all particle types
280  //
281  SetCutsWithDefault();
282     
283  if (verboseLevel>0) DumpCutValuesTable();
284}
285
286//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
287
Note: See TracBrowser for help on using the repository browser.