source: trunk/examples/extended/g3tog4/clGeometry/src/G3toG4PhysicsList.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 9.4 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.6 2010/03/18 09:44:13 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-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 "G4eMultipleScattering.hh"
156#include "G4MuMultipleScattering.hh"
157#include "G4hMultipleScattering.hh"
158
159#include "G4eIonisation.hh"
160#include "G4eBremsstrahlung.hh"
161#include "G4eplusAnnihilation.hh"
162
163#include "G4MuIonisation.hh"
164#include "G4MuBremsstrahlung.hh"
165#include "G4MuPairProduction.hh"
166
167#include "G4hIonisation.hh"
168
169//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
170
171void G3toG4PhysicsList::ConstructEM()
172{
173  theParticleIterator->reset();
174  while( (*theParticleIterator)() ){
175    G4ParticleDefinition* particle = theParticleIterator->value();
176    G4ProcessManager* pmanager = particle->GetProcessManager();
177    G4String particleName = particle->GetParticleName();
178     
179    if (particleName == "gamma") {
180      //gamma     
181      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
182      pmanager->AddDiscreteProcess(new G4ComptonScattering());
183      pmanager->AddDiscreteProcess(new G4GammaConversion());
184     
185    } else if (particleName == "e-") {
186      //electron
187      pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1);
188      pmanager->AddProcess(new G4eIonisation(),       -1, 2,2);
189      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3,3);     
190
191    } else if (particleName == "e+") {
192      //positron     
193      pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1);
194      pmanager->AddProcess(new G4eIonisation(),       -1, 2,2);
195      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3,3);
196      pmanager->AddProcess(new G4eplusAnnihilation(),  0,-1,4);     
197 
198    } else if( particleName == "mu+" || 
199               particleName == "mu-"    ) {
200     //muon 
201     pmanager->AddProcess(new G4MuMultipleScattering(),-1, 1,1);
202     pmanager->AddProcess(new G4MuIonisation(),      -1, 2,2);
203     pmanager->AddProcess(new G4MuBremsstrahlung(),  -1, 3,3);
204     pmanager->AddProcess(new G4MuPairProduction(),  -1, 4,4);       
205     
206    } else if ((!particle->IsShortLived()) &&
207               (particle->GetPDGCharge() != 0.0) && 
208               (particle->GetParticleName() != "chargedgeantino")) {
209      //all others charged particles except geantino
210      pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
211      pmanager->AddProcess(new G4hIonisation(),       -1,2,2);
212    }
213  }
214}
215
216
217#include "G4Decay.hh"
218
219void G3toG4PhysicsList::ConstructGeneral()
220{
221  // Add Decay Process
222   G4Decay* theDecayProcess = new G4Decay();
223  theParticleIterator->reset();
224  while( (*theParticleIterator)() ){
225    G4ParticleDefinition* particle = theParticleIterator->value();
226    G4ProcessManager* pmanager = particle->GetProcessManager();
227    if (theDecayProcess->IsApplicable(*particle)) {
228      pmanager ->AddProcess(theDecayProcess);
229      // set ordering for PostStepDoIt and AtRestDoIt
230      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
231      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
232    }
233  }
234}
235
236//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
237
238void G3toG4PhysicsList::SetCuts()
239{
240  // reactualise cutValues
241  if (currentDefaultCut != defaultCutValue)
242    {
243     if(cutForGamma    == currentDefaultCut) cutForGamma    = defaultCutValue;
244     if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
245     currentDefaultCut = defaultCutValue;
246    }
247
248  if (verboseLevel >0){
249    G4cout << "G3toG4PhysicsList::SetCuts:";
250    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
251  }
252
253  // set cut values for gamma at first and for e- second and next for e+,
254  // because some processes for e+/e- need cut values for gamma
255  SetCutValue(cutForGamma, "gamma");
256  SetCutValue(cutForElectron, "e-");
257  SetCutValue(cutForElectron, "e+");
258
259  if (verboseLevel>0) DumpCutValuesTable();
260}
261
262//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
263
264
265void      G3toG4PhysicsList::SetCutForGamma(G4double cut)
266{
267  ResetCuts();
268  cutForGamma = cut;
269}
270
271void      G3toG4PhysicsList::SetCutForElectron(G4double cut)
272{
273  ResetCuts();
274  cutForElectron = cut;
275}
276
277void      G3toG4PhysicsList::SetCutForProton(G4double cut)
278{
279  ResetCuts();
280  cutForProton = cut;
281}
282
283G4double  G3toG4PhysicsList::GetCutForGamma() const
284{
285  return cutForGamma;
286}
287
288G4double  G3toG4PhysicsList::GetCutForElectron() const
289{
290  return cutForElectron;
291}
292
293G4double  G3toG4PhysicsList::GetCutForProton() const
294{
295  return cutForGamma;
296}
297
298
299
300
301
302
303
304
305
306
307
308
Note: See TracBrowser for help on using the repository browser.