source: trunk/examples/extended/parameterisations/gflash/src/ExGflashPhysicsList.cc@ 850

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

update

File size: 12.1 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#include "ExGflashPhysicsList.hh"
27
28#include "globals.hh"
29#include "G4ParticleDefinition.hh"
30#include "G4ParticleWithCuts.hh"
31#include "G4ProcessManager.hh"
32#include "G4ProcessVector.hh"
33#include "G4ParticleTypes.hh"
34#include "G4ParticleTable.hh"
35#include "G4Material.hh"
36#include "G4MaterialTable.hh"
37#include "G4ios.hh"
38#include <iomanip>
39
40#include "G4FastSimulationManagerProcess.hh"
41
42
43ExGflashPhysicsList::ExGflashPhysicsList(): G4VUserPhysicsList()
44{
45 SetVerboseLevel(0);
46}
47
48ExGflashPhysicsList::~ExGflashPhysicsList()
49{
50}
51
52void ExGflashPhysicsList::ConstructParticle()
53{
54 // In this method, static member functions should be called
55 // for all particles which you want to use.
56 // This ensures that objects of these particle types will be
57 // created in the program.
58
59 std::cout<<"start construct particle"<<std::endl;
60 ConstructBosons();
61 ConstructLeptons();
62 ConstructMesons();
63 ConstructBaryons();
64 ConstructIons();
65 std::cout<<"end construct particle"<<std::endl;
66}
67
68void ExGflashPhysicsList::ConstructBosons()
69{
70 // pseudo-particles
71 G4Geantino::GeantinoDefinition();
72 G4ChargedGeantino::ChargedGeantinoDefinition();
73
74 // gamma
75 G4Gamma::GammaDefinition();
76
77 // optical photon
78 G4OpticalPhoton::OpticalPhotonDefinition();
79}
80
81#include "G4LeptonConstructor.hh"
82void ExGflashPhysicsList::ConstructLeptons()
83{
84 // Construct all leptons
85 G4LeptonConstructor pConstructor;
86 pConstructor.ConstructParticle();
87}
88
89#include "G4MesonConstructor.hh"
90void ExGflashPhysicsList::ConstructMesons()
91{
92 // Construct all mesons
93 G4MesonConstructor pConstructor;
94 pConstructor.ConstructParticle();
95}
96
97#include "G4BaryonConstructor.hh"
98void ExGflashPhysicsList::ConstructBaryons()
99{
100 // Construct all barions
101 G4BaryonConstructor pConstructor;
102 pConstructor.ConstructParticle();
103}
104
105#include "G4IonConstructor.hh"
106void ExGflashPhysicsList::ConstructIons()
107{
108 // Construct light ions
109 G4IonConstructor pConstructor;
110 pConstructor.ConstructParticle();
111}
112
113void ExGflashPhysicsList::ConstructProcess()
114{
115 // std::cout<<"1111"<<std::endl;
116 AddTransportation();
117 // std::cout<<"2222"<<std::endl;
118 AddParameterisation();
119 std::cout<<"AddParameterisation"<<std::endl;
120
121 ConstructEM();
122 std::cout<<"ConstructEM"<<std::endl;
123 ConstructGeneral();
124 // std::cout<<"5555"<<std::endl;
125}
126
127
128void ExGflashPhysicsList::AddTransportation()
129{
130 G4VUserPhysicsList::AddTransportation();
131}
132
133#include "G4ComptonScattering.hh"
134#include "G4GammaConversion.hh"
135#include "G4PhotoElectricEffect.hh"
136
137#include "G4MultipleScattering.hh"
138
139#include "G4eIonisation.hh"
140#include "G4eBremsstrahlung.hh"
141#include "G4eplusAnnihilation.hh"
142
143#include "G4UserLimits.hh"
144
145#include "G4MuIonisation.hh"
146#include "G4MuBremsstrahlung.hh"
147#include "G4MuPairProduction.hh"
148
149#include "G4hIonisation.hh"
150void ExGflashPhysicsList::ConstructEM()
151{
152
153 cout<<"Physics List constructor"<<endl;
154 SetCuts();
155 theParticleIterator->reset();
156 while( (*theParticleIterator)() ){
157 G4ParticleDefinition* particle = theParticleIterator->value();
158 G4ProcessManager* pmanager = particle->GetProcessManager();
159 G4String particleName = particle->GetParticleName();
160
161 if (particleName == "gamma") {
162 // gamma
163 // Construct processes for gamma
164 G4VProcess* theGammaConversion = new G4GammaConversion();
165 G4VProcess* theComptonScattering = new G4ComptonScattering();
166 G4VProcess* thePhotoElectricEffect = new G4PhotoElectricEffect();
167 // G4VProcess* thegammacut = new G4UserLimits();
168 // thegammacut->SetUserMinEkine(1.0*MeV);
169
170 pmanager->AddDiscreteProcess(theGammaConversion);
171 pmanager->AddDiscreteProcess(theComptonScattering);
172 pmanager->AddDiscreteProcess(thePhotoElectricEffect);
173 // pmanager->AddProcess(thegammacut);
174 // G4cout <<"theGammaConversion" << theGammaConversion <<endl;
175 //G4cout <<"theComptonScattering" << theComptonScattering <<endl;
176 //G4cout <<"thePhotoElectricEffect" << thePhotoElectricEffect <<endl;
177
178 } else if (particleName == "e-") {
179 //electron
180 // Construct processes for electron
181 G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
182 G4VProcess* theeminusIonisation = new G4eIonisation();
183 G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
184 // G4VProcess* theeminuscut = new G4UserLimits();
185 // theeminuscut->SetUserMinEkine(1.0*MeV);
186 // add processes
187 pmanager->AddProcess(theeminusMultipleScattering);
188 pmanager->AddProcess(theeminusIonisation);
189 pmanager->AddProcess(theeminusBremsstrahlung);
190
191 // pmanager->AddProcess( theeminuscut);
192
193
194
195 // set ordering for AlongStepDoIt
196 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep, 1);
197 pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep, 2);
198 // set ordering for PostStepDoIt
199 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
200 pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
201 pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
202
203 //G4cout <<"theeminusMultipleScattering" << theeminusMultipleScattering <<endl;
204 //G4cout <<"theeminusIonisation" << theeminusIonisation <<endl;
205 //G4cout <<"theeminusBremsstrahlung" << theeminusBremsstrahlung <<endl;
206
207 } else if (particleName == "e+") {
208 //positron
209 // Construct processes for positron
210 G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
211 G4VProcess* theeplusIonisation = new G4eIonisation();
212 G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
213 G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
214 // add processes
215 pmanager->AddProcess(theeplusMultipleScattering);
216 pmanager->AddProcess(theeplusIonisation);
217 pmanager->AddProcess(theeplusBremsstrahlung);
218 pmanager->AddProcess(theeplusAnnihilation);
219 // set ordering for AtRestDoIt
220 pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
221 // set ordering for AlongStepDoIt
222 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1);
223 pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2);
224 // set ordering for PostStepDoIt
225 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
226 pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
227 pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
228 pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
229
230 //G4cout <<"theeplusMultipleScattering" << theeplusMultipleScattering <<endl;
231 //G4cout <<"theeplusIonisation" << theeplusIonisation <<endl;
232 //G4cout <<"theeplusBremsstrahlung" << theeplusBremsstrahlung <<endl;
233
234 } else if( particleName == "mu+" ||
235 particleName == "mu-" ) {
236 //muon
237 // Construct processes for muon+
238 G4VProcess* aMultipleScattering = new G4MultipleScattering();
239 G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
240 G4VProcess* aPairProduction = new G4MuPairProduction();
241 G4VProcess* anIonisation = new G4MuIonisation();
242 // add processes
243 pmanager->AddProcess(anIonisation);
244 pmanager->AddProcess(aMultipleScattering);
245 pmanager->AddProcess(aBremsstrahlung);
246 pmanager->AddProcess(aPairProduction);
247 // set ordering for AlongStepDoIt
248 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
249 pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
250 // set ordering for PostStepDoIt
251 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
252 pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
253 pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
254 pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
255
256 } else if ((!particle->IsShortLived()) &&
257 (particle->GetPDGCharge() != 0.0) &&
258 (particle->GetParticleName() != "chargedgeantino")) {
259 // all others charged particles except geantino
260 G4VProcess* aMultipleScattering = new G4MultipleScattering();
261 G4VProcess* anIonisation = new G4hIonisation();
262 // add processes
263 pmanager->AddProcess(anIonisation);
264 pmanager->AddProcess(aMultipleScattering);
265 // set ordering for AlongStepDoIt
266 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
267 pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
268 // set ordering for PostStepDoIt
269 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
270 pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
271 }
272 }
273}
274
275
276#include "G4Decay.hh"
277void ExGflashPhysicsList::ConstructGeneral()
278{
279 // Add Decay Process
280 G4Decay* theDecayProcess = new G4Decay();
281 //G4cout << "decay" <<theDecayProcess<<endl;
282 theParticleIterator->reset();
283 while( (*theParticleIterator)() ){
284 G4ParticleDefinition* particle = theParticleIterator->value();
285 G4ProcessManager* pmanager = particle->GetProcessManager();
286 if (theDecayProcess->IsApplicable(*particle)) {
287 pmanager ->AddProcess(theDecayProcess);
288 // set ordering for PostStepDoIt and AtRestDoIt
289 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
290 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
291 }
292 }
293}
294
295// WARNING: This methode is mandatory if U want to use GFLASH
296void ExGflashPhysicsList::AddParameterisation()
297{
298 G4FastSimulationManagerProcess*
299 theFastSimulationManagerProcess =
300 new G4FastSimulationManagerProcess();
301 G4cout << "FastSimulationManagerProcess" <<endl;
302 theParticleIterator->reset();
303 //std::cout<<"---"<<std::endl;
304 while( (*theParticleIterator)() ){
305 //std::cout<<"+++"<<std::endl;
306
307 G4ParticleDefinition* particle = theParticleIterator->value();
308 // std::cout<<"--- particle "<<particle->GetParticleName()<<std::endl;
309 G4ProcessManager* pmanager = particle->GetProcessManager();
310 // The fast simulation process becomes a discrete process only since 9.0:
311 pmanager->AddDiscreteProcess(theFastSimulationManagerProcess);
312 }
313}
314
315void ExGflashPhysicsList::SetCuts()
316{
317 if (verboseLevel >1){
318 G4cout << "ExGflashPhysicsList::SetCuts:";
319 }
320 // " G4VUserPhysicsList::SetCutsWithDefault" method sets
321 // the default cut value for all particle types
322 DumpCutValuesTable();
323 SetCutsWithDefault();
324 // SetCutValue(100*mm, "gamma");
325// SetCutValue(0*mm, "e-");
326// SetCutValue(0*mm, "e+");
327
328// SetCutValue(62*mm, "gamma");
329// SetCutValue(0.73*mm, "e-");
330// SetCutValue(0.78*mm, "e+");
331
332
333
334
335
336 DumpCutValuesTable();
337}
338
339
340
341
342
343
344
345
346
Note: See TracBrowser for help on using the repository browser.