source: trunk/examples/extended/field/field01/src/F01PhysicsList.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: 10.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: F01PhysicsList.cc,v 1.15 2010/04/08 14:09:44 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30
31#include "G4Timer.hh"
32   
33#include "F01PhysicsList.hh"
34#include "F01DetectorConstruction.hh"
35#include "F01PhysicsListMessenger.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 "G4EnergyLossTables.hh"
45#include "G4UnitsTable.hh"
46#include "G4ios.hh"
47#include <iomanip>
48
49
50
51/////////////////////////////////////////////////////////////
52//
53//
54
55F01PhysicsList::F01PhysicsList(F01DetectorConstruction* p)
56:  G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
57   thePhotoElectricEffect(0), theComptonScattering(0),
58   theGammaConversion(0), theeminusIonisation(0),
59   theeminusBremsstrahlung(0), theeplusIonisation(0),
60   theeplusBremsstrahlung(0), theeplusAnnihilation(0),
61   theeminusStepCut(0),theeplusStepCut(0)
62{
63  pDet = p;
64
65  defaultCutValue = 1.000*mm ;
66
67  cutForGamma = defaultCutValue ;
68  cutForElectron = defaultCutValue ;
69
70  SetVerboseLevel(1);
71  physicsListMessenger = new F01PhysicsListMessenger(this);
72}
73
74/////////////////////////////////////////////////////////////////////////
75//
76//
77
78F01PhysicsList::~F01PhysicsList()
79{
80  delete physicsListMessenger; 
81}
82
83///////////////////////////////////////////////////////////////////////////
84//
85//
86
87void F01PhysicsList::ConstructParticle()
88{
89  // In this method, static member functions should be called
90  // for all particles which you want to use.
91  // This ensures that objects of these particle types will be
92  // created in the program.
93
94  ConstructBosons();
95  ConstructLeptons();
96  ConstructMesons();
97  ConstructBarions();
98}
99
100////////////////////////////////////////////////////////////////////////////
101//
102//
103
104void F01PhysicsList::ConstructBosons()
105{
106  // gamma
107
108  G4Gamma::GammaDefinition();
109
110  // charged geantino
111
112  G4ChargedGeantino::ChargedGeantinoDefinition();
113
114
115}
116
117void F01PhysicsList::ConstructLeptons()
118{
119  // leptons
120
121  G4Electron::ElectronDefinition();
122  G4Positron::PositronDefinition();
123  G4MuonPlus::MuonPlusDefinition();
124  G4MuonMinus::MuonMinusDefinition();
125
126  G4NeutrinoE::NeutrinoEDefinition();
127  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
128  G4NeutrinoMu::NeutrinoMuDefinition();
129  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
130}
131
132void F01PhysicsList::ConstructMesons()
133{
134 //  mesons
135
136  G4PionPlus::PionPlusDefinition();
137  G4PionMinus::PionMinusDefinition();
138  G4PionZero::PionZeroDefinition();
139  G4KaonPlus::KaonPlusDefinition();
140  G4KaonMinus::KaonMinusDefinition();
141}
142
143
144void F01PhysicsList::ConstructBarions()
145{
146//  barions
147
148  G4Proton::ProtonDefinition();
149  G4AntiProton::AntiProtonDefinition();
150}
151
152
153///////////////////////////////////////////////////////////////////////
154//
155//
156
157void F01PhysicsList::ConstructProcess()
158{
159  AddTransportation();
160  // AddParameterisation();
161
162  ConstructEM();
163  ConstructGeneral();
164}
165
166/////////////////////////////////////////////////////////////////////////////
167//
168//
169
170#include "G4ComptonScattering.hh"
171#include "G4GammaConversion.hh"
172#include "G4PhotoElectricEffect.hh"
173
174#include "G4eMultipleScattering.hh"
175#include "G4MuMultipleScattering.hh"
176#include "G4hMultipleScattering.hh"
177
178#include "G4eIonisation.hh"
179#include "G4eBremsstrahlung.hh"
180#include "G4eplusAnnihilation.hh"
181
182#include "G4MuIonisation.hh"
183#include "G4MuBremsstrahlung.hh"
184#include "G4MuPairProduction.hh"
185
186#include "G4hIonisation.hh"
187
188#include "F01StepCut.hh"
189
190void F01PhysicsList::ConstructEM()
191{
192  theParticleIterator->reset();
193
194  while( (*theParticleIterator)() )
195  {
196    G4ParticleDefinition* particle = theParticleIterator->value();
197    G4ProcessManager* pmanager = particle->GetProcessManager();
198    G4String particleName = particle->GetParticleName();
199
200    if (particleName == "gamma") 
201    {
202      // Construct processes for gamma
203
204      thePhotoElectricEffect = new G4PhotoElectricEffect();     
205      theComptonScattering   = new G4ComptonScattering();
206      theGammaConversion     = new G4GammaConversion();
207     
208      pmanager->AddDiscreteProcess(thePhotoElectricEffect);
209      pmanager->AddDiscreteProcess(theComptonScattering);
210
211      pmanager->AddDiscreteProcess(theGammaConversion);
212     
213    } 
214    else if (particleName == "e-") 
215    {
216      // Construct processes for electron
217
218      // theeminusMultipleScattering = new G4eMultipleScattering();
219     theeminusIonisation = new G4eIonisation();
220     theeminusBremsstrahlung = new G4eBremsstrahlung();
221
222
223      theeminusStepCut = new F01StepCut();
224
225      //  pmanager->AddProcess(theeminusMultipleScattering,-1,1,1);
226
227      pmanager->AddProcess(theeminusIonisation,-1,2,2);
228
229
230      pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3); 
231
232     
233      pmanager->AddProcess(theeminusStepCut,-1,-1,4);
234      theeminusStepCut->SetMaxStep(MaxChargedStep) ;
235
236    } 
237    else if (particleName == "e+") 
238    {
239      // Construct processes for positron
240
241      //   theeplusMultipleScattering = new G4eMultipleScattering();
242      theeplusIonisation = new G4eIonisation();
243      theeplusBremsstrahlung = new G4eBremsstrahlung();
244      // theeplusAnnihilation = new G4eplusAnnihilation();
245
246
247      theeplusStepCut = new F01StepCut();
248     
249      //  pmanager->AddProcess(theeplusMultipleScattering,-1,1,1);
250      pmanager->AddProcess(theeplusIonisation,-1,2,2);
251      pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
252      //  pmanager->AddProcess(theeplusAnnihilation,0,-1,4);
253     
254
255      pmanager->AddProcess(theeplusStepCut,-1,-1,5);
256      theeplusStepCut->SetMaxStep(MaxChargedStep) ;
257
258    } 
259    else if( particleName == "mu+" || 
260               particleName == "mu-"    ) 
261    {
262     // Construct processes for muon+
263
264      F01StepCut* muonStepCut = new F01StepCut();
265
266      G4MuIonisation* themuIonisation = new G4MuIonisation() ;
267     pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
268     pmanager->AddProcess(themuIonisation,-1,2,2);
269     pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
270     pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4); 
271     
272     pmanager->AddProcess( muonStepCut,-1,-1,3);
273     muonStepCut->SetMaxStep(MaxChargedStep) ;
274
275    } 
276    else if (
277                particleName == "proton" 
278               || particleName == "antiproton" 
279               || particleName == "pi+"
280               || particleName == "pi-" 
281               || particleName == "kaon+" 
282               || particleName == "kaon-" 
283              )
284    {
285        F01StepCut* thehadronStepCut = new F01StepCut();
286
287      G4hIonisation* thehIonisation = new G4hIonisation() ; 
288      G4hMultipleScattering* thehMultipleScattering =
289                     new G4hMultipleScattering() ;
290
291
292      pmanager->AddProcess(thehMultipleScattering,-1,1,1);
293      pmanager->AddProcess(thehIonisation,-1,2,2);
294
295
296        pmanager->AddProcess( thehadronStepCut,-1,-1,3);
297        thehadronStepCut->SetMaxStep(MaxChargedStep) ;
298      thehadronStepCut->SetMaxStep(10*mm) ;
299     
300    }
301  }
302}
303
304
305#include "G4Decay.hh"
306
307void F01PhysicsList::ConstructGeneral()
308{
309  // Add Decay Process
310
311   G4Decay* theDecayProcess = new G4Decay();
312  theParticleIterator->reset();
313
314  while( (*theParticleIterator)() )
315  {
316    G4ParticleDefinition* particle = theParticleIterator->value();
317    G4ProcessManager* pmanager = particle->GetProcessManager();
318
319    if (theDecayProcess->IsApplicable(*particle))
320    { 
321      pmanager ->AddProcess(theDecayProcess);
322
323      // set ordering for PostStepDoIt and AtRestDoIt
324
325      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
326      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
327    }
328  }
329}
330
331
332
333/////////////////////////////////////////////////////////////////////////////
334
335void F01PhysicsList::SetCuts()
336{
337  G4Timer theTimer ;
338  theTimer.Start() ;
339  if (verboseLevel >0)
340  {
341    G4cout << "F01PhysicsList::SetCuts:";
342    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
343  }
344  // set cut values for gamma at first and for e- second and next for e+,
345  // because some processes for e+/e- need cut values for gamma
346
347   SetCutValue(cutForGamma,"gamma");
348
349   SetCutValue(cutForElectron,"e-");
350   SetCutValue(cutForElectron,"e+");
351
352  if (verboseLevel>1)     DumpCutValuesTable();
353
354  theTimer.Stop();
355  G4cout.precision(6);
356  G4cout << G4endl ;
357  G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
358
359}
360
361///////////////////////////////////////////////////////////////////////////
362
363void F01PhysicsList::SetGammaCut(G4double val)
364{
365  cutForGamma = val;
366}
367
368///////////////////////////////////////////////////////////////////////////
369
370void F01PhysicsList::SetElectronCut(G4double val)
371{
372  cutForElectron = val;
373}
374
375
376////////////////////////////////////////////////////////////////////////////
377
378void F01PhysicsList::SetMaxStep(G4double step)
379{
380  MaxChargedStep = step ;
381  G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
382  G4cout << G4endl;
383}
Note: See TracBrowser for help on using the repository browser.