source: trunk/examples/extended/g3tog4/cltog4/src/G3toG4PhysicsList.cc @ 1287

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

update to geant4.9.3

File size: 9.3 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: G3toG4PhysicsList.cc,v 1.5 2006/06/29 17:21:00 gunter 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 "G3toG4PhysicsList.hh"
36
37#include "G4ParticleDefinition.hh"
38#include "G4ParticleWithCuts.hh"
39#include "G4ProcessManager.hh"
40#include "G4ProcessVector.hh"
41#include "G4ParticleTypes.hh"
42#include "G4ParticleTable.hh"
43#include "G4LossTableManager.hh"
44#include "G4Material.hh"
45#include "G4ios.hh"
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48
49G3toG4PhysicsList::G3toG4PhysicsList():  G4VUserPhysicsList()
50{
51  currentDefaultCut = defaultCutValue = 2.0*mm;
52  cutForGamma       = defaultCutValue;
53  cutForElectron    = defaultCutValue;
54  cutForProton      = defaultCutValue;
55
56  SetVerboseLevel(1);
57  G4LossTableManager::Instance()->SetVerbose(1);
58}
59
60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
61
62G3toG4PhysicsList::~G3toG4PhysicsList()
63{}
64
65//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
66
67void G3toG4PhysicsList::ConstructParticle()
68{
69  // In this method, static member functions should be called
70  // for all particles which you want to use.
71  // This ensures that objects of these particle types will be
72  // created in the program.
73
74  ConstructBosons();
75  ConstructLeptons();
76  ConstructMesons();
77  ConstructBaryons();
78}
79
80//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
81
82void G3toG4PhysicsList::ConstructBosons()
83{
84  // pseudo-particles
85  G4Geantino::GeantinoDefinition();
86  G4ChargedGeantino::ChargedGeantinoDefinition();
87
88  // gamma
89  G4Gamma::GammaDefinition();
90
91  // optical photon
92  G4OpticalPhoton::OpticalPhotonDefinition();
93}
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95
96void G3toG4PhysicsList::ConstructLeptons()
97{
98  // leptons
99  G4Electron::ElectronDefinition();
100  G4Positron::PositronDefinition();
101  G4MuonPlus::MuonPlusDefinition();
102  G4MuonMinus::MuonMinusDefinition();
103
104  G4NeutrinoE::NeutrinoEDefinition();
105  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
106  G4NeutrinoMu::NeutrinoMuDefinition();
107  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
108}
109
110//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
111
112void G3toG4PhysicsList::ConstructMesons()
113{
114 //  mesons
115  G4PionPlus::PionPlusDefinition();
116  G4PionMinus::PionMinusDefinition();
117  G4PionZero::PionZeroDefinition();
118  G4Eta::EtaDefinition();
119  G4EtaPrime::EtaPrimeDefinition();
120  G4KaonPlus::KaonPlusDefinition();
121  G4KaonMinus::KaonMinusDefinition();
122  G4KaonZero::KaonZeroDefinition();
123  G4AntiKaonZero::AntiKaonZeroDefinition();
124  G4KaonZeroLong::KaonZeroLongDefinition();
125  G4KaonZeroShort::KaonZeroShortDefinition();
126}
127
128//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
129
130void G3toG4PhysicsList::ConstructBaryons()
131{
132//  barions
133  G4Proton::ProtonDefinition();
134  G4AntiProton::AntiProtonDefinition();
135  G4Neutron::NeutronDefinition();
136  G4AntiNeutron::AntiNeutronDefinition();
137}
138
139
140//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141
142void G3toG4PhysicsList::ConstructProcess()
143{
144  AddTransportation();
145  ConstructEM();
146  ConstructGeneral();
147}
148
149//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
150
151#include "G4ComptonScattering.hh"
152#include "G4GammaConversion.hh"
153#include "G4PhotoElectricEffect.hh"
154
155#include "G4MultipleScattering.hh"
156
157#include "G4eIonisation.hh"
158#include "G4eBremsstrahlung.hh"
159#include "G4eplusAnnihilation.hh"
160
161#include "G4MuIonisation.hh"
162#include "G4MuBremsstrahlung.hh"
163#include "G4MuPairProduction.hh"
164
165#include "G4hIonisation.hh"
166
167//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168
169void G3toG4PhysicsList::ConstructEM()
170{
171  theParticleIterator->reset();
172  while( (*theParticleIterator)() ){
173    G4ParticleDefinition* particle = theParticleIterator->value();
174    G4ProcessManager* pmanager = particle->GetProcessManager();
175    G4String particleName = particle->GetParticleName();
176     
177    if (particleName == "gamma") {
178      //gamma     
179      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
180      pmanager->AddDiscreteProcess(new G4ComptonScattering());
181      pmanager->AddDiscreteProcess(new G4GammaConversion());
182     
183    } else if (particleName == "e-") {
184      //electron
185      pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
186      pmanager->AddProcess(new G4eIonisation(),       -1, 2,2);
187      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3,3);     
188
189    } else if (particleName == "e+") {
190      //positron     
191      pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
192      pmanager->AddProcess(new G4eIonisation(),       -1, 2,2);
193      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3,3);
194      pmanager->AddProcess(new G4eplusAnnihilation(),  0,-1,4);     
195 
196    } else if( particleName == "mu+" || 
197               particleName == "mu-"    ) {
198     //muon 
199     pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
200     pmanager->AddProcess(new G4MuIonisation(),      -1, 2,2);
201     pmanager->AddProcess(new G4MuBremsstrahlung(),  -1, 3,3);
202     pmanager->AddProcess(new G4MuPairProduction(),  -1, 4,4);       
203     
204    } else if ((!particle->IsShortLived()) &&
205               (particle->GetPDGCharge() != 0.0) && 
206               (particle->GetParticleName() != "chargedgeantino")) {
207      //all others charged particles except geantino
208      pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
209      pmanager->AddProcess(new G4hIonisation(),       -1,2,2);
210    }
211  }
212}
213
214
215#include "G4Decay.hh"
216
217void G3toG4PhysicsList::ConstructGeneral()
218{
219  // Add Decay Process
220   G4Decay* theDecayProcess = new G4Decay();
221  theParticleIterator->reset();
222  while( (*theParticleIterator)() ){
223    G4ParticleDefinition* particle = theParticleIterator->value();
224    G4ProcessManager* pmanager = particle->GetProcessManager();
225    if (theDecayProcess->IsApplicable(*particle)) {
226      pmanager ->AddProcess(theDecayProcess);
227      // set ordering for PostStepDoIt and AtRestDoIt
228      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
229      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
230    }
231  }
232}
233
234//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
235
236void G3toG4PhysicsList::SetCuts()
237{
238  // reactualise cutValues
239  if (currentDefaultCut != defaultCutValue)
240    {
241     if(cutForGamma    == currentDefaultCut) cutForGamma    = defaultCutValue;
242     if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
243     currentDefaultCut = defaultCutValue;
244    }
245
246  if (verboseLevel >0){
247    G4cout << "G3toG4PhysicsList::SetCuts:";
248    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
249  }
250
251  // set cut values for gamma at first and for e- second and next for e+,
252  // because some processes for e+/e- need cut values for gamma
253  SetCutValue(cutForGamma, "gamma");
254  SetCutValue(cutForElectron, "e-");
255  SetCutValue(cutForElectron, "e+");
256
257
258  if (verboseLevel>0) DumpCutValuesTable();
259}
260
261//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
262
263
264void      G3toG4PhysicsList::SetCutForGamma(G4double cut)
265{
266  ResetCuts();
267  cutForGamma = cut;
268}
269
270void      G3toG4PhysicsList::SetCutForElectron(G4double cut)
271{
272  ResetCuts();
273  cutForElectron = cut;
274}
275
276void      G3toG4PhysicsList::SetCutForProton(G4double cut)
277{
278  ResetCuts();
279  cutForProton = cut;
280}
281
282G4double  G3toG4PhysicsList::GetCutForGamma() const
283{
284  return cutForGamma;
285}
286
287G4double  G3toG4PhysicsList::GetCutForElectron() const
288{
289  return cutForElectron;
290}
291
292G4double  G3toG4PhysicsList::GetCutForProton() const
293{
294  return cutForGamma;
295}
296
297
298
299
300
301
302
303
304
305
306
307
Note: See TracBrowser for help on using the repository browser.