source: trunk/examples/novice/N07/src/ExN07PhysicsList.cc@ 1331

Last change on this file since 1331 was 1313, checked in by garnier, 15 years ago

geant4.9.4 beta rc0

File size: 11.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: ExN07PhysicsList.cc,v 1.8 2010/03/18 00:19:12 asaim Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-cand-00 $
29//
30
31#include "ExN07PhysicsList.hh"
32
33#include "G4ParticleDefinition.hh"
34#include "G4ProcessManager.hh"
35#include "G4ProcessVector.hh"
36#include "G4ParticleTypes.hh"
37#include "G4ParticleTable.hh"
38#include "G4ios.hh"
39
40ExN07PhysicsList::ExN07PhysicsList(): G4VUserPhysicsList()
41{
42 defaultCutValue = 1.0*mm;
43 SetVerboseLevel(1);
44}
45
46ExN07PhysicsList::~ExN07PhysicsList()
47{}
48
49void ExN07PhysicsList::ConstructParticle()
50{
51 // In this method, static member functions should be called
52 // for all particles which you want to use.
53 // This ensures that objects of these particle types will be
54 // created in the program.
55
56 ConstructBosons();
57 ConstructLeptons();
58 ConstructMesons();
59 ConstructBaryons();
60}
61
62void ExN07PhysicsList::ConstructBosons()
63{
64 // pseudo-particles
65 G4Geantino::GeantinoDefinition();
66 G4ChargedGeantino::ChargedGeantinoDefinition();
67
68 // gamma
69 G4Gamma::GammaDefinition();
70}
71
72void ExN07PhysicsList::ConstructLeptons()
73{
74 // leptons
75 G4Electron::ElectronDefinition();
76 G4Positron::PositronDefinition();
77 G4MuonPlus::MuonPlusDefinition();
78 G4MuonMinus::MuonMinusDefinition();
79
80 G4NeutrinoE::NeutrinoEDefinition();
81 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
82 G4NeutrinoMu::NeutrinoMuDefinition();
83 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
84}
85
86void ExN07PhysicsList::ConstructMesons()
87{
88 // mesons
89 G4PionPlus::PionPlusDefinition();
90 G4PionMinus::PionMinusDefinition();
91 G4PionZero::PionZeroDefinition();
92 G4Eta::EtaDefinition();
93 G4EtaPrime::EtaPrimeDefinition();
94 G4KaonPlus::KaonPlusDefinition();
95 G4KaonMinus::KaonMinusDefinition();
96 G4KaonZero::KaonZeroDefinition();
97 G4AntiKaonZero::AntiKaonZeroDefinition();
98 G4KaonZeroLong::KaonZeroLongDefinition();
99 G4KaonZeroShort::KaonZeroShortDefinition();
100}
101
102void ExN07PhysicsList::ConstructBaryons()
103{
104// barions
105 G4Proton::ProtonDefinition();
106 G4AntiProton::AntiProtonDefinition();
107 G4Neutron::NeutronDefinition();
108 G4AntiNeutron::AntiNeutronDefinition();
109}
110
111void ExN07PhysicsList::ConstructProcess()
112{
113 AddTransportation();
114 ConstructGeneral();
115 ConstructEM();
116}
117
118#include "G4ComptonScattering.hh"
119#include "G4GammaConversion.hh"
120#include "G4PhotoElectricEffect.hh"
121
122#include "G4eMultipleScattering.hh"
123#include "G4MuMultipleScattering.hh"
124#include "G4hMultipleScattering.hh"
125
126#include "G4eIonisation.hh"
127#include "G4eBremsstrahlung.hh"
128#include "G4eplusAnnihilation.hh"
129
130#include "G4MuIonisation.hh"
131#include "G4MuBremsstrahlung.hh"
132#include "G4MuPairProduction.hh"
133
134#include "G4hIonisation.hh"
135
136void ExN07PhysicsList::ConstructEM()
137{
138 G4bool displacementFlg = true; // for multiple scattering
139 theParticleIterator->reset();
140 while( (*theParticleIterator)() ){
141 G4ParticleDefinition* particle = theParticleIterator->value();
142 G4ProcessManager* pmanager = particle->GetProcessManager();
143 G4String particleName = particle->GetParticleName();
144
145 if (particleName == "gamma") {
146 // gamma
147 pmanager->AddDiscreteProcess(new G4GammaConversion());
148 pmanager->AddDiscreteProcess(new G4ComptonScattering());
149 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
150
151 } else if (particleName == "e-") {
152 //electron
153 G4eMultipleScattering* theeminusMultipleScattering = new G4eMultipleScattering();
154 theeminusMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
155 G4VProcess* theeminusIonisation = new G4eIonisation();
156 G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
157 //
158 // add processes
159 pmanager->AddProcess(theeminusMultipleScattering);
160 pmanager->AddProcess(theeminusIonisation);
161 pmanager->AddProcess(theeminusBremsstrahlung);
162 //
163 // set ordering for AlongStepDoIt
164 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
165 pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2);
166 pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxAlongStep,3);
167 //
168 // set ordering for PostStepDoIt
169 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
170 pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
171 pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
172
173 } else if (particleName == "e+") {
174 //positron
175 G4eMultipleScattering* theeplusMultipleScattering = new G4eMultipleScattering();
176 theeplusMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
177 G4VProcess* theeplusIonisation = new G4eIonisation();
178 G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
179 G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
180 //
181 // add processes
182 pmanager->AddProcess(theeplusMultipleScattering);
183 pmanager->AddProcess(theeplusIonisation);
184 pmanager->AddProcess(theeplusBremsstrahlung);
185 pmanager->AddProcess(theeplusAnnihilation);
186 //
187 // set ordering for AtRestDoIt
188 pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
189 //
190 // set ordering for AlongStepDoIt
191 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
192 pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
193 pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxAlongStep,3);
194 //
195 // set ordering for PostStepDoIt
196 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
197 pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2);
198 pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3);
199 pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4);
200
201 } else if( particleName == "mu+" ||
202 particleName == "mu-" ) {
203 //muon
204 G4MuMultipleScattering* aMultipleScattering = new G4MuMultipleScattering();
205 aMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
206 G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
207 G4VProcess* aPairProduction = new G4MuPairProduction();
208 G4VProcess* anIonisation = new G4MuIonisation();
209 //
210 // add processes
211 pmanager->AddProcess(anIonisation);
212 pmanager->AddProcess(aMultipleScattering);
213 pmanager->AddProcess(aBremsstrahlung);
214 pmanager->AddProcess(aPairProduction);
215 //
216 // set ordering for AlongStepDoIt
217 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
218 pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
219 pmanager->SetProcessOrdering(aBremsstrahlung, idxAlongStep,3);
220 pmanager->SetProcessOrdering(aPairProduction, idxAlongStep,4);
221
222 //
223 // set ordering for PostStepDoIt
224 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
225 pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
226 pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3);
227 pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4);
228
229 } else if ((!particle->IsShortLived()) &&
230 (particle->GetPDGCharge() != 0.0) &&
231 (particle->GetParticleName() != "chargedgeantino")) {
232 // all others charged particles except geantino
233 G4hMultipleScattering* aMultipleScattering = new G4hMultipleScattering();
234 aMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
235 G4VProcess* anIonisation = new G4hIonisation();
236 //
237 // add processes
238 pmanager->AddProcess(anIonisation);
239 pmanager->AddProcess(aMultipleScattering);
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 }
249 }
250}
251
252#include "G4Decay.hh"
253#include "G4ParallelWorldScoringProcess.hh"
254
255void ExN07PhysicsList::ConstructGeneral()
256{
257 // Add Decay Process and Parallel world Scoring Process
258 G4Decay* theDecayProcess = new G4Decay();
259 G4ParallelWorldScoringProcess* theParallelWorldScoringProcess
260 = new G4ParallelWorldScoringProcess("ParaWorldScoringProc");
261 theParallelWorldScoringProcess->SetParallelWorld("ParallelScoringWorld");
262
263 theParticleIterator->reset();
264 while( (*theParticleIterator)() ){
265 G4ParticleDefinition* particle = theParticleIterator->value();
266 G4ProcessManager* pmanager = particle->GetProcessManager();
267 if (theDecayProcess->IsApplicable(*particle)) {
268 pmanager ->AddProcess(theDecayProcess);
269 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
270 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
271 }
272 pmanager->AddProcess(theParallelWorldScoringProcess);
273 pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
274 pmanager->SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1);
275 pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
276 }
277}
278
279#include "G4Region.hh"
280#include "G4RegionStore.hh"
281#include "G4ProductionCuts.hh"
282
283void ExN07PhysicsList::SetCuts()
284{
285 if (verboseLevel >0){
286 G4cout << "ExN07PhysicsList::SetCuts: default cut length : "
287 << G4BestUnit(defaultCutValue,"Length") << G4endl;
288 }
289
290 // These values are used as the default production thresholds
291 // for the world volume.
292 SetCutsWithDefault();
293
294
295 // Production thresholds for detector regions
296 G4String regName[] = {"Calor-A","Calor-B","Calor-C"};
297 G4double fuc = 1.;
298 for(G4int i=0;i<3;i++)
299 {
300 G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName[i]);
301 G4ProductionCuts* cuts = new G4ProductionCuts;
302 cuts->SetProductionCut(defaultCutValue*fuc);
303 reg->SetProductionCuts(cuts);
304 fuc *= 10.;
305 }
306}
307
308
Note: See TracBrowser for help on using the repository browser.