source: trunk/examples/extended/analysis/AnaEx01/src/AnaEx01PhysicsList.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 12.5 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: AnaEx01PhysicsList.cc,v 1.5 2006/06/29 16:33:55 gunter Exp $
28// GEANT4 tag $Name: $
29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34
35#include "AnaEx01PhysicsList.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 "G4Material.hh"
44#include "G4ios.hh"
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47
48AnaEx01PhysicsList::AnaEx01PhysicsList(): G4VUserPhysicsList()
49{
50 currentDefaultCut = defaultCutValue = 1.0*mm;
51 cutForGamma = defaultCutValue;
52 cutForElectron = defaultCutValue;
53 cutForProton = defaultCutValue;
54
55 SetVerboseLevel(1);
56}
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59
60AnaEx01PhysicsList::~AnaEx01PhysicsList()
61{}
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64
65void AnaEx01PhysicsList::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 AnaEx01PhysicsList::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 AnaEx01PhysicsList::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 AnaEx01PhysicsList::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 AnaEx01PhysicsList::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 AnaEx01PhysicsList::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 "G4MultipleScattering.hh"
154
155#include "G4eIonisation.hh"
156#include "G4eBremsstrahlung.hh"
157#include "G4eplusAnnihilation.hh"
158
159#include "G4MuIonisation.hh"
160#include "G4MuBremsstrahlung.hh"
161#include "G4MuPairProduction.hh"
162
163#include "G4hIonisation.hh"
164
165//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
166
167void AnaEx01PhysicsList::ConstructEM()
168{
169 theParticleIterator->reset();
170 while( (*theParticleIterator)() ){
171 G4ParticleDefinition* particle = theParticleIterator->value();
172 G4ProcessManager* pmanager = particle->GetProcessManager();
173 G4String particleName = particle->GetParticleName();
174
175 if (particleName == "gamma") {
176 // gamma
177 pmanager->AddDiscreteProcess(new G4GammaConversion());
178 pmanager->AddDiscreteProcess(new G4ComptonScattering());
179 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
180
181 } else if (particleName == "e-") {
182 //electron
183 G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
184 G4VProcess* theeminusIonisation = new G4eIonisation();
185 G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
186 //
187 // add processes
188 pmanager->AddProcess(theeminusMultipleScattering);
189 pmanager->AddProcess(theeminusIonisation);
190 pmanager->AddProcess(theeminusBremsstrahlung);
191 //
192 // set ordering for AlongStepDoIt
193 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
194 pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2);
195 //
196 // set ordering for PostStepDoIt
197 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
198 pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
199 pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
200
201 } else if (particleName == "e+") {
202 //positron
203 G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
204 G4VProcess* theeplusIonisation = new G4eIonisation();
205 G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
206 G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
207 //
208 // add processes
209 pmanager->AddProcess(theeplusMultipleScattering);
210 pmanager->AddProcess(theeplusIonisation);
211 pmanager->AddProcess(theeplusBremsstrahlung);
212 pmanager->AddProcess(theeplusAnnihilation);
213 //
214 // set ordering for AtRestDoIt
215 pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
216 //
217 // set ordering for AlongStepDoIt
218 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
219 pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
220 //
221 // set ordering for PostStepDoIt
222 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
223 pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2);
224 pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3);
225 pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4);
226
227 } else if( particleName == "mu+" ||
228 particleName == "mu-" ) {
229 //muon
230 G4VProcess* aMultipleScattering = new G4MultipleScattering();
231 G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
232 G4VProcess* aPairProduction = new G4MuPairProduction();
233 G4VProcess* anIonisation = new G4MuIonisation();
234 //
235 // add processes
236 pmanager->AddProcess(anIonisation);
237 pmanager->AddProcess(aMultipleScattering);
238 pmanager->AddProcess(aBremsstrahlung);
239 pmanager->AddProcess(aPairProduction);
240 //
241 // set ordering for AlongStepDoIt
242 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
243 pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
244 //
245 // set ordering for PostStepDoIt
246 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
247 pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
248 pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3);
249 pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4);
250
251 } else if ((!particle->IsShortLived()) &&
252 (particle->GetPDGCharge() != 0.0) &&
253 (particle->GetParticleName() != "chargedgeantino")) {
254 // all others charged particles except geantino
255 G4VProcess* aMultipleScattering = new G4MultipleScattering();
256 G4VProcess* anIonisation = new G4hIonisation();
257 //
258 // add processes
259 pmanager->AddProcess(anIonisation);
260 pmanager->AddProcess(aMultipleScattering);
261 //
262 // set ordering for AlongStepDoIt
263 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
264 pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
265 //
266 // set ordering for PostStepDoIt
267 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
268 pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
269 }
270 }
271}
272
273//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
274
275#include "G4Decay.hh"
276
277void AnaEx01PhysicsList::ConstructGeneral()
278{
279 // Add Decay Process
280 G4Decay* theDecayProcess = new G4Decay();
281 theParticleIterator->reset();
282 while( (*theParticleIterator)() ){
283 G4ParticleDefinition* particle = theParticleIterator->value();
284 G4ProcessManager* pmanager = particle->GetProcessManager();
285 if (theDecayProcess->IsApplicable(*particle)) {
286 pmanager ->AddProcess(theDecayProcess);
287 // set ordering for PostStepDoIt and AtRestDoIt
288 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
289 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
290 }
291 }
292}
293
294//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
295
296void AnaEx01PhysicsList::SetCuts()
297{
298 // reactualise cutValues
299 if (currentDefaultCut != defaultCutValue)
300 {
301 if(cutForGamma == currentDefaultCut) cutForGamma = defaultCutValue;
302 if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
303 if(cutForProton == currentDefaultCut) cutForProton = defaultCutValue;
304 currentDefaultCut = defaultCutValue;
305 }
306
307 if (verboseLevel >0){
308 G4cout << "AnaEx01PhysicsList::SetCuts:";
309 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
310 }
311
312 // set cut values for gamma at first and for e- second and next for e+,
313 // because some processes for e+/e- need cut values for gamma
314 SetCutValue(cutForGamma, "gamma");
315 SetCutValue(cutForElectron, "e-");
316 SetCutValue(cutForElectron, "e+");
317
318 // set cut values for proton and anti_proton before all other hadrons
319 // because some processes for hadrons need cut values for proton/anti_proton
320 SetCutValue(cutForProton, "proton");
321 SetCutValue(cutForProton, "anti_proton");
322
323 SetCutValueForOthers(defaultCutValue);
324
325 if (verboseLevel>0) DumpCutValuesTable();
326}
327
328//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
329
330
331void AnaEx01PhysicsList::SetCutForGamma(G4double cut)
332{
333 ResetCuts();
334 cutForGamma = cut;
335}
336
337void AnaEx01PhysicsList::SetCutForElectron(G4double cut)
338{
339 ResetCuts();
340 cutForElectron = cut;
341}
342
343void AnaEx01PhysicsList::SetCutForProton(G4double cut)
344{
345 ResetCuts();
346 cutForProton = cut;
347}
348
349G4double AnaEx01PhysicsList::GetCutForGamma() const
350{
351 return cutForGamma;
352}
353
354G4double AnaEx01PhysicsList::GetCutForElectron() const
355{
356 return cutForElectron;
357}
358
359G4double AnaEx01PhysicsList::GetCutForProton() const
360{
361 return cutForGamma;
362}
363
364//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
365
366
367
368
369
370
371
372
373
374
375
Note: See TracBrowser for help on using the repository browser.