source: trunk/examples/extended/field/field02/src/F02PhysicsList.cc @ 1342

Last change on this file since 1342 was 1342, checked in by garnier, 14 years ago

update ti head

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