source: trunk/examples/novice/N05/src/ExN05PhysicsList.cc @ 1143

Last change on this file since 1143 was 807, checked in by garnier, 16 years ago

update

File size: 10.8 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: ExN05PhysicsList.cc,v 1.14 2007/11/30 18:08:42 mverderi Exp $
28// GEANT4 tag $Name:  $
29//
30//
31
32#include "ExN05PhysicsList.hh"
33
34#include "globals.hh"
35#include "G4ParticleDefinition.hh"
36#include "G4ProcessManager.hh"
37#include "G4ProcessVector.hh"
38#include "G4ParticleTypes.hh"
39#include "G4ParticleTable.hh"
40#include "G4Material.hh"
41#include "G4MaterialTable.hh"
42#include "G4ios.hh"
43#include <iomanip>  
44
45#include "G4FastSimulationManagerProcess.hh"
46
47
48ExN05PhysicsList::ExN05PhysicsList():  G4VUserPhysicsList()
49{
50  SetVerboseLevel(1);
51}
52
53ExN05PhysicsList::~ExN05PhysicsList()
54{
55}
56
57void ExN05PhysicsList::ConstructParticle()
58{
59  // In this method, static member functions should be called
60  // for all particles which you want to use.
61  // This ensures that objects of these particle types will be
62  // created in the program.
63
64  ConstructBosons();
65  ConstructLeptons();
66  ConstructMesons();
67  ConstructBaryons();
68  ConstructIons();
69}
70
71void ExN05PhysicsList::ConstructBosons()
72{
73  // pseudo-particles
74  G4Geantino::GeantinoDefinition();
75  G4ChargedGeantino::ChargedGeantinoDefinition();
76
77  // gamma
78  G4Gamma::GammaDefinition();
79
80  // optical photon
81  G4OpticalPhoton::OpticalPhotonDefinition();
82}
83
84#include "G4LeptonConstructor.hh"
85void ExN05PhysicsList::ConstructLeptons()
86{
87  // Construct all leptons
88  G4LeptonConstructor pConstructor;
89  pConstructor.ConstructParticle();
90}
91
92#include "G4MesonConstructor.hh"
93void ExN05PhysicsList::ConstructMesons()
94{
95  //  Construct all mesons
96  G4MesonConstructor pConstructor;
97  pConstructor.ConstructParticle();
98}
99
100#include "G4BaryonConstructor.hh"
101void ExN05PhysicsList::ConstructBaryons()
102{
103  //  Construct all barions
104  G4BaryonConstructor  pConstructor;
105  pConstructor.ConstructParticle(); 
106}
107
108#include "G4IonConstructor.hh"
109void ExN05PhysicsList::ConstructIons()
110{
111  //  Construct light ions
112  G4IonConstructor pConstructor;
113  pConstructor.ConstructParticle(); 
114}
115
116void ExN05PhysicsList::ConstructProcess()
117{
118  AddTransportation();
119  AddParameterisation();
120
121  ConstructEM();
122  ConstructGeneral();
123}
124
125void ExN05PhysicsList::AddTransportation()
126{
127  G4VUserPhysicsList::AddTransportation();
128}
129
130#include "G4ComptonScattering.hh"
131#include "G4GammaConversion.hh"
132#include "G4PhotoElectricEffect.hh"
133
134#include "G4MultipleScattering.hh"
135
136#include "G4eIonisation.hh"
137#include "G4eBremsstrahlung.hh"
138#include "G4eplusAnnihilation.hh"
139
140#include "G4MuIonisation.hh"
141#include "G4MuBremsstrahlung.hh"
142#include "G4MuPairProduction.hh"
143
144#include "G4hIonisation.hh"
145void ExN05PhysicsList::ConstructEM()
146{
147  theParticleIterator->reset();
148  while( (*theParticleIterator)() ){
149    G4ParticleDefinition* particle = theParticleIterator->value();
150    G4ProcessManager* pmanager = particle->GetProcessManager();
151    G4String particleName = particle->GetParticleName();
152     
153    if (particleName == "gamma") {
154    // gamma
155      // Construct processes for gamma
156      pmanager->AddDiscreteProcess(new G4GammaConversion());
157      pmanager->AddDiscreteProcess(new G4ComptonScattering());     
158      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
159
160    } else if (particleName == "e-") {
161    //electron
162      // Construct processes for electron
163      G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
164      G4VProcess* theeminusIonisation = new G4eIonisation();
165      G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
166      // add processes
167      pmanager->AddProcess(theeminusMultipleScattering);
168      pmanager->AddProcess(theeminusIonisation);
169      pmanager->AddProcess(theeminusBremsstrahlung);     
170      // set ordering for AlongStepDoIt
171      pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,  1);
172      pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,  2);
173      // set ordering for PostStepDoIt
174      pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
175      pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
176      pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
177
178    } else if (particleName == "e+") {
179    //positron
180      // Construct processes for positron
181      G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
182      G4VProcess* theeplusIonisation = new G4eIonisation();
183      G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
184      G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
185      // add processes
186      pmanager->AddProcess(theeplusMultipleScattering);
187      pmanager->AddProcess(theeplusIonisation);
188      pmanager->AddProcess(theeplusBremsstrahlung);
189      pmanager->AddProcess(theeplusAnnihilation);
190      // set ordering for AtRestDoIt
191      pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
192      // set ordering for AlongStepDoIt
193      pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,  1);
194      pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,  2);
195      // set ordering for PostStepDoIt
196      pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
197      pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
198      pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
199      pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
200 
201    } else if( particleName == "mu+" || 
202               particleName == "mu-"    ) {
203    //muon 
204     // Construct processes for muon+
205     G4VProcess* aMultipleScattering = new G4MultipleScattering();
206     G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
207     G4VProcess* aPairProduction = new G4MuPairProduction();
208     G4VProcess* anIonisation = new G4MuIonisation();
209      // add processes
210     pmanager->AddProcess(anIonisation);
211     pmanager->AddProcess(aMultipleScattering);
212     pmanager->AddProcess(aBremsstrahlung);
213     pmanager->AddProcess(aPairProduction);
214     // set ordering for AlongStepDoIt
215     pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
216     pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
217     // set ordering for PostStepDoIt
218     pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
219     pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
220     pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
221     pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
222     
223   } else if ((!particle->IsShortLived()) &&
224              (particle->GetPDGCharge() != 0.0) && 
225              (particle->GetParticleName() != "chargedgeantino")) {
226     // all others charged particles except geantino
227     G4VProcess* aMultipleScattering = new G4MultipleScattering();
228     G4VProcess* anIonisation = new G4hIonisation();
229     // add processes
230     pmanager->AddProcess(anIonisation);
231     pmanager->AddProcess(aMultipleScattering);
232     // set ordering for AlongStepDoIt
233     pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
234     pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
235     // set ordering for PostStepDoIt
236     pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
237     pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
238    }
239  }
240}
241
242
243#include "G4Decay.hh"
244void ExN05PhysicsList::ConstructGeneral()
245{
246  // Add Decay Process
247  G4Decay* theDecayProcess = new G4Decay();
248  theParticleIterator->reset();
249  while( (*theParticleIterator)() ){
250    G4ParticleDefinition* particle = theParticleIterator->value();
251    G4ProcessManager* pmanager = particle->GetProcessManager();
252    if (theDecayProcess->IsApplicable(*particle)) { 
253      pmanager ->AddProcess(theDecayProcess);
254      // set ordering for PostStepDoIt and AtRestDoIt
255      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
256      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
257    }
258  } 
259}
260
261void ExN05PhysicsList::AddParameterisation()
262{
263  // -- Fast simulation manager process for "mass geometry":
264  G4FastSimulationManagerProcess* fastSimProcess_massGeom     = new G4FastSimulationManagerProcess("G4FSMP_massGeom");
265  // -- Fast simulation manager process for "parallel geometry":
266  G4FastSimulationManagerProcess* fastSimProcess_parallelGeom = new G4FastSimulationManagerProcess("G4FSMP_parallelGeom", "pionGhostWorld");
267  theParticleIterator->reset();
268  while( (*theParticleIterator)() )
269    {
270      G4ParticleDefinition* particle = theParticleIterator->value();
271      G4ProcessManager* pmanager = particle->GetProcessManager();
272      // -- For the mass geometry, G4FSMP is a PostStep process, ordering does not matter:
273      if (particle->GetParticleName() == "e+"  || 
274          particle->GetParticleName() == "e-"  ||
275          particle->GetParticleName() == "gamma")  pmanager->AddDiscreteProcess(fastSimProcess_massGeom);
276      // -- For the parallel geometry, G4FSMP is an Along+PostStep process, and ordering matters:
277      if (particle->GetParticleName() == "pi+" || 
278          particle->GetParticleName() == "pi-") 
279        {
280          pmanager->AddProcess(fastSimProcess_parallelGeom);
281          pmanager->SetProcessOrdering(fastSimProcess_parallelGeom, idxAlongStep, 1);
282          pmanager->SetProcessOrdering(fastSimProcess_parallelGeom, idxPostStep);
283        }
284    }
285}
286
287void ExN05PhysicsList::SetCuts()
288{
289  if (verboseLevel >1){
290    G4cout << "ExN05PhysicsList::SetCuts:";
291  } 
292  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
293  //   the default cut value for all particle types
294  SetCutsWithDefault();   
295}
296
297
Note: See TracBrowser for help on using the repository browser.