source: trunk/examples/extended/field/field03/src/F03PhysicsList.cc @ 812

Last change on this file since 812 was 807, checked in by garnier, 16 years ago

update

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