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

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

update ti head

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.7 2010/08/16 08:23:41 kurasige Exp $
28// GEANT4 tag $Name: examples-V09-03-09 $
29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34
35#include "G3toG4PhysicsList.hh"
36
37#include "G4ProcessManager.hh"
38#include "G4ProcessVector.hh"
39#include "G4ParticleTypes.hh"
40#include "G4ParticleTable.hh"
41#include "G4LossTableManager.hh"
42#include "G4Material.hh"
43#include "G4ios.hh"
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47G3toG4PhysicsList::G3toG4PhysicsList(): G4VUserPhysicsList()
48{
49 currentDefaultCut = defaultCutValue = 2.0*mm;
50 cutForGamma = defaultCutValue;
51 cutForElectron = defaultCutValue;
52 cutForProton = defaultCutValue;
53
54 SetVerboseLevel(1);
55 G4LossTableManager::Instance()->SetVerbose(1);
56}
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59
60G3toG4PhysicsList::~G3toG4PhysicsList()
61{}
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64
65void G3toG4PhysicsList::ConstructParticle()
66{
67 // In this method, static member functions should be called
68 // for all particles which you want to use.
69 // This ensures that objects of these particle types will be
70 // created in the program.
71
72 ConstructBosons();
73 ConstructLeptons();
74 ConstructMesons();
75 ConstructBaryons();
76}
77
78//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
79
80void G3toG4PhysicsList::ConstructBosons()
81{
82 // pseudo-particles
83 G4Geantino::GeantinoDefinition();
84 G4ChargedGeantino::ChargedGeantinoDefinition();
85
86 // gamma
87 G4Gamma::GammaDefinition();
88
89 // optical photon
90 G4OpticalPhoton::OpticalPhotonDefinition();
91}
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93
94void G3toG4PhysicsList::ConstructLeptons()
95{
96 // leptons
97 G4Electron::ElectronDefinition();
98 G4Positron::PositronDefinition();
99 G4MuonPlus::MuonPlusDefinition();
100 G4MuonMinus::MuonMinusDefinition();
101
102 G4NeutrinoE::NeutrinoEDefinition();
103 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
104 G4NeutrinoMu::NeutrinoMuDefinition();
105 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
106}
107
108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
109
110void G3toG4PhysicsList::ConstructMesons()
111{
112 // mesons
113 G4PionPlus::PionPlusDefinition();
114 G4PionMinus::PionMinusDefinition();
115 G4PionZero::PionZeroDefinition();
116 G4Eta::EtaDefinition();
117 G4EtaPrime::EtaPrimeDefinition();
118 G4KaonPlus::KaonPlusDefinition();
119 G4KaonMinus::KaonMinusDefinition();
120 G4KaonZero::KaonZeroDefinition();
121 G4AntiKaonZero::AntiKaonZeroDefinition();
122 G4KaonZeroLong::KaonZeroLongDefinition();
123 G4KaonZeroShort::KaonZeroShortDefinition();
124}
125
126//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127
128void G3toG4PhysicsList::ConstructBaryons()
129{
130// barions
131 G4Proton::ProtonDefinition();
132 G4AntiProton::AntiProtonDefinition();
133 G4Neutron::NeutronDefinition();
134 G4AntiNeutron::AntiNeutronDefinition();
135}
136
137
138//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
139
140void G3toG4PhysicsList::ConstructProcess()
141{
142 AddTransportation();
143 ConstructEM();
144 ConstructGeneral();
145}
146
147//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
148
149#include "G4ComptonScattering.hh"
150#include "G4GammaConversion.hh"
151#include "G4PhotoElectricEffect.hh"
152
153#include "G4eMultipleScattering.hh"
154#include "G4MuMultipleScattering.hh"
155#include "G4hMultipleScattering.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 G4eMultipleScattering(),-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 G4eMultipleScattering(),-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 G4MuMultipleScattering(),-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 G4hMultipleScattering(),-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 if (verboseLevel>0) DumpCutValuesTable();
258}
259
260//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
261
262
263void G3toG4PhysicsList::SetCutForGamma(G4double cut)
264{
265 ResetCuts();
266 cutForGamma = cut;
267}
268
269void G3toG4PhysicsList::SetCutForElectron(G4double cut)
270{
271 ResetCuts();
272 cutForElectron = cut;
273}
274
275void G3toG4PhysicsList::SetCutForProton(G4double cut)
276{
277 ResetCuts();
278 cutForProton = cut;
279}
280
281G4double G3toG4PhysicsList::GetCutForGamma() const
282{
283 return cutForGamma;
284}
285
286G4double G3toG4PhysicsList::GetCutForElectron() const
287{
288 return cutForElectron;
289}
290
291G4double G3toG4PhysicsList::GetCutForProton() const
292{
293 return cutForGamma;
294}
295
296
297
298
299
300
301
302
303
304
305
306
Note: See TracBrowser for help on using the repository browser.