source: trunk/examples/novice/N03/src/ExN03PhysicsList.cc @ 1209

Last change on this file since 1209 was 1209, checked in by garnier, 15 years ago

CVS update

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