source: trunk/source/event/test/GeneralParticleSource/src/ExamplePhysicsList.cc @ 1316

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

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 6.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// GSPMPhysicsList - instantiates all particles
27
28#include "globals.hh"
29#include "ExamplePhysicsList.hh"
30#include "G4ParticleDefinition.hh"
31#include "G4ParticleWithCuts.hh"
32#include "G4ProcessManager.hh"
33#include "G4ProcessVector.hh"
34#include "G4ParticleTypes.hh"
35#include "G4ParticleTable.hh"
36#include "G4BosonConstructor.hh"
37#include "G4LeptonConstructor.hh"
38#include "G4MesonConstructor.hh"
39#include "G4BaryonConstructor.hh"
40#include "G4IonConstructor.hh"
41#include "G4Material.hh"
42#include "G4MaterialTable.hh"
43#include "G4ios.hh"
44//#include <iomanip.h>               
45
46
47ExamplePhysicsList::ExamplePhysicsList():  G4VUserPhysicsList()
48{
49  SetVerboseLevel(1);
50}
51
52ExamplePhysicsList::~ExamplePhysicsList()
53{
54}
55
56void ExamplePhysicsList::ConstructParticle()
57{
58  // In this method, static member functions should be called
59  // for all particles which you want to use.
60  // This ensures that objects of these particle types will be
61  // created in the program.
62
63  ConstructBosons();
64  ConstructLeptons();
65  ConstructMesons();
66  ConstructBaryons();
67  ConstructIons();
68}
69
70void ExamplePhysicsList::ConstructBosons()
71{
72  // Construct all bosons
73  G4BosonConstructor pConstructor;
74  pConstructor.ConstructParticle();
75}
76
77void ExamplePhysicsList::ConstructLeptons()
78{
79  // Construct all leptons
80  G4LeptonConstructor pConstructor;
81  pConstructor.ConstructParticle();
82}
83
84void ExamplePhysicsList::ConstructMesons()
85{
86  //  Construct all mesons
87  G4MesonConstructor pConstructor;
88  pConstructor.ConstructParticle();
89}
90
91void ExamplePhysicsList::ConstructBaryons()
92{
93  //  Construct all baryons
94  G4BaryonConstructor pConstructor;
95  pConstructor.ConstructParticle();
96}
97
98void ExamplePhysicsList::ConstructIons()
99{
100  //  Construct light ions
101  G4IonConstructor pConstructor;
102  pConstructor.ConstructParticle(); 
103}
104
105
106void ExamplePhysicsList::ConstructProcess()
107{
108  AddTransportation();
109  ConstructEM();
110  ConstructLeptHad();
111  ConstructHad();
112  ConstructGeneral();
113}
114
115#include "G4ComptonScattering.hh"
116#include "G4GammaConversion.hh"
117#include "G4PhotoElectricEffect.hh"
118
119#include "G4MultipleScattering.hh"
120
121#include "G4eIonisation.hh"
122#include "G4eBremsstrahlung.hh"
123#include "G4eplusAnnihilation.hh"
124
125#include "G4MuIonisation.hh"
126#include "G4MuBremsstrahlung.hh"
127#include "G4MuPairProduction.hh"
128
129#include "G4hIonisation.hh"
130void ExamplePhysicsList::ConstructEM()
131{
132  theParticleIterator->reset();
133  while( (*theParticleIterator)() ){
134    G4ParticleDefinition* particle = theParticleIterator->value();
135    G4ProcessManager* pmanager = particle->GetProcessManager();
136    G4String particleName = particle->GetParticleName();
137     
138    if (particleName == "gamma") {
139    // gamma
140      // Construct processes for gamma
141      pmanager->AddDiscreteProcess(new G4GammaConversion());
142      pmanager->AddDiscreteProcess(new G4ComptonScattering());     
143      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
144
145    } else if (particleName == "e-") {
146    //electron
147      // Construct processes for electron
148      pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
149      pmanager->AddProcess(new G4eIonisation(),-1,2,2);
150      pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
151 
152    } else if (particleName == "e+") {
153    //positron
154      // Construct processes for positron
155     pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
156     
157     pmanager->AddProcess(new G4eIonisation(),-1,2,2);
158     pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);     
159     pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);
160 
161    } else if( particleName == "mu+" || 
162               particleName == "mu-"    ) {
163    //muon 
164     // Construct processes for muon+
165     pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
166     pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
167     pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
168     pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);       
169     
170    } else { 
171      if ((particle->GetPDGCharge() != 0.0) && 
172          (particle->GetParticleName() != "chargedgeantino")) {
173     // all others charged particles except geantino
174       pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
175       pmanager->AddProcess(new G4hIonisation(),-1,2,2);       
176     }
177    }
178  }
179}
180
181void ExamplePhysicsList::ConstructHad()
182{;}
183
184void ExamplePhysicsList::ConstructLeptHad()
185{;}
186
187#include "G4Decay.hh"
188void ExamplePhysicsList::ConstructGeneral()
189{
190  G4Decay* theDecayProcess = new G4Decay();
191  theParticleIterator->reset();
192  while( (*theParticleIterator)() ){
193    G4ParticleDefinition* particle = theParticleIterator->value();
194    G4ProcessManager* pmanager = particle->GetProcessManager();
195    if (theDecayProcess->IsApplicable(*particle)) { 
196      pmanager->AddProcess(theDecayProcess, INT_MAX, -1, INT_MAX); 
197   }
198  }
199}
200
201void ExamplePhysicsList::SetCuts()
202{
203  if (verboseLevel >0){
204    G4cout << "ExamplePhysicsList::SetCuts:";
205    G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << G4endl;
206  } 
207
208  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
209  //   the default cut value for all particle types
210  SetCutsWithDefault();   
211}
212 
213
214
Note: See TracBrowser for help on using the repository browser.