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

Last change on this file 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: F03PhysicsList.cc,v 1.14 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 "F03PhysicsList.hh"
34#include "F03DetectorConstruction.hh"
35#include "F03PhysicsListMessenger.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
53F03PhysicsList::F03PhysicsList(F03DetectorConstruction* p)
54:  G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
55   thePhotoElectricEffect(0), theComptonScattering(0),
56   theGammaConversion(0), theeminusIonisation(0),
57   theeminusBremsstrahlung(0), theeplusIonisation(0),
58   theeplusBremsstrahlung(0), theeplusAnnihilation(0),
59   theeminusStepCut(0), theeplusStepCut(0)
60{
61  pDet = p;
62
63  defaultCutValue = 1.000*mm ;
64
65  cutForGamma = defaultCutValue ;
66  cutForElectron = defaultCutValue ;
67
68  SetVerboseLevel(1);
69  physicsListMessenger = new F03PhysicsListMessenger(this);
70}
71
72/////////////////////////////////////////////////////////////////////////
73//
74//
75
76F03PhysicsList::~F03PhysicsList()
77{
78  delete physicsListMessenger; 
79}
80
81///////////////////////////////////////////////////////////////////////////
82//
83//
84
85void F03PhysicsList::ConstructParticle()
86{
87  // In this method, static member functions should be called
88  // for all particles which you want to use.
89  // This ensures that objects of these particle types will be
90  // created in the program.
91
92  ConstructBosons();
93  ConstructLeptons();
94  ConstructMesons();
95  ConstructBarions();
96}
97
98////////////////////////////////////////////////////////////////////////////
99//
100//
101
102void F03PhysicsList::ConstructBosons()
103{
104  // gamma
105
106  G4Gamma::GammaDefinition();
107
108  // charged geantino
109
110  G4ChargedGeantino::ChargedGeantinoDefinition();
111
112
113}
114
115void F03PhysicsList::ConstructLeptons()
116{
117  // leptons
118
119  G4Electron::ElectronDefinition();
120  G4Positron::PositronDefinition();
121  G4MuonPlus::MuonPlusDefinition();
122  G4MuonMinus::MuonMinusDefinition();
123
124  G4NeutrinoE::NeutrinoEDefinition();
125  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
126  G4NeutrinoMu::NeutrinoMuDefinition();
127  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
128}
129
130void F03PhysicsList::ConstructMesons()
131{
132 //  mesons
133
134  G4PionPlus::PionPlusDefinition();
135  G4PionMinus::PionMinusDefinition();
136  G4PionZero::PionZeroDefinition();
137  G4KaonPlus::KaonPlusDefinition();
138  G4KaonMinus::KaonMinusDefinition();
139}
140
141
142void F03PhysicsList::ConstructBarions()
143{
144//  barions
145
146  G4Proton::ProtonDefinition();
147  G4AntiProton::AntiProtonDefinition();
148}
149
150
151///////////////////////////////////////////////////////////////////////
152//
153//
154
155void F03PhysicsList::ConstructProcess()
156{
157  AddTransportation();
158  //AddParameterisation();
159
160  ConstructEM();
161  ConstructGeneral();
162}
163
164/////////////////////////////////////////////////////////////////////////////
165//
166//
167
168#include "G4ComptonScattering.hh"
169#include "G4GammaConversion.hh"
170#include "G4PhotoElectricEffect.hh"
171
172#include "G4eMultipleScattering.hh"
173#include "G4MuMultipleScattering.hh"
174#include "G4hMultipleScattering.hh"
175
176#include "G4eIonisation.hh"
177#include "G4eBremsstrahlung.hh"
178#include "G4eplusAnnihilation.hh"
179
180#include "G4MuIonisation.hh"
181#include "G4MuBremsstrahlung.hh"
182#include "G4MuPairProduction.hh"
183
184#include "G4hIonisation.hh"
185
186#include "F03StepCut.hh"
187
188void F03PhysicsList::ConstructEM()
189{
190  theParticleIterator->reset();
191
192  while( (*theParticleIterator)() )
193  {
194    G4ParticleDefinition* particle = theParticleIterator->value();
195    G4ProcessManager* pmanager = particle->GetProcessManager();
196    G4String particleName = particle->GetParticleName();
197
198    if (particleName == "gamma") 
199    {
200      // Construct processes for gamma
201
202      thePhotoElectricEffect = new G4PhotoElectricEffect();     
203      theComptonScattering   = new G4ComptonScattering();
204      theGammaConversion     = new G4GammaConversion();
205     
206      pmanager->AddDiscreteProcess(thePhotoElectricEffect);
207      pmanager->AddDiscreteProcess(theComptonScattering);
208
209      pmanager->AddDiscreteProcess(theGammaConversion);
210     
211    } 
212    else if (particleName == "e-") 
213    {
214      // Construct processes for electron
215
216     theeminusIonisation = new G4eIonisation();
217     theeminusBremsstrahlung = new G4eBremsstrahlung();
218
219     theeminusStepCut = new F03StepCut();
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 F03StepCut();
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      F03StepCut* muonStepCut = new F03StepCut();
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      pmanager->AddProcess( muonStepCut,-1,-1,3);
254      muonStepCut->SetMaxStep(MaxChargedStep) ;
255    }
256    else if (
257                particleName == "proton" 
258               || particleName == "antiproton" 
259               || particleName == "pi+" 
260               || particleName == "pi-" 
261               || particleName == "kaon+" 
262               || particleName == "kaon-" 
263              )
264    {
265      F03StepCut* thehadronStepCut = new F03StepCut();
266
267      G4hIonisation* thehIonisation = new G4hIonisation() ; 
268      G4hMultipleScattering* thehMultipleScattering =
269                     new G4hMultipleScattering() ;
270
271
272      pmanager->AddProcess(thehMultipleScattering,-1,1,1);
273      pmanager->AddProcess(thehIonisation,-1,2,2);
274
275
276        pmanager->AddProcess( thehadronStepCut,-1,-1,3);
277        thehadronStepCut->SetMaxStep(MaxChargedStep) ;
278    }
279  }
280}
281
282
283#include "G4Decay.hh"
284
285void F03PhysicsList::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 F03PhysicsList::SetCuts()
312{
313  G4Timer theTimer ;
314  theTimer.Start() ;
315  if (verboseLevel >0)
316  {
317    G4cout << "F03PhysicsList::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 F03PhysicsList::SetGammaCut(G4double val)
340{
341  cutForGamma = val;
342}
343
344///////////////////////////////////////////////////////////////////////////
345
346void F03PhysicsList::SetElectronCut(G4double val)
347{
348  cutForElectron = val;
349}
350
351////////////////////////////////////////////////////////////////////////////
352
353void F03PhysicsList::SetMaxStep(G4double step)
354{
355  MaxChargedStep = step ;
356  G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
357  G4cout << G4endl;
358}
Note: See TracBrowser for help on using the repository browser.