source: trunk/examples/novice/N06/src/ExN06PhysicsList.cc @ 1157

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

update

File size: 10.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: ExN06PhysicsList.cc,v 1.14 2007/09/30 22:51:03 gum Exp $
28// GEANT4 tag $Name:  $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "G4ios.hh"
34#include <iomanip>
35
36#include "globals.hh"
37#include "ExN06PhysicsList.hh"
38#include "ExN06PhysicsListMessenger.hh"
39
40#include "G4ParticleDefinition.hh"
41#include "G4ParticleTypes.hh"
42#include "G4ParticleTable.hh"
43
44#include "G4Material.hh"
45#include "G4MaterialTable.hh"
46
47#include "G4ProcessManager.hh"
48#include "G4ProcessVector.hh"
49
50#include "G4Cerenkov.hh"
51#include "G4Scintillation.hh"
52#include "G4OpAbsorption.hh"
53#include "G4OpRayleigh.hh"
54#include "G4OpBoundaryProcess.hh"
55 
56//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57
58ExN06PhysicsList::ExN06PhysicsList() :  G4VUserPhysicsList()
59{
60  theCerenkovProcess           = 0;
61  theScintillationProcess      = 0;
62  theAbsorptionProcess         = 0;
63  theRayleighScatteringProcess = 0;
64  theBoundaryProcess           = 0;
65 
66  pMessenger = new ExN06PhysicsListMessenger(this); 
67  SetVerboseLevel(0);
68}
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71
72ExN06PhysicsList::~ExN06PhysicsList() { delete pMessenger;}
73
74//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75
76void ExN06PhysicsList::ConstructParticle()
77{
78  // In this method, static member functions should be called
79  // for all particles which you want to use.
80  // This ensures that objects of these particle types will be
81  // created in the program.
82
83  ConstructBosons();
84  ConstructLeptons();
85  ConstructMesons();
86  ConstructBaryons();
87}
88
89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90
91void ExN06PhysicsList::ConstructBosons()
92{
93  // pseudo-particles
94  G4Geantino::GeantinoDefinition();
95  G4ChargedGeantino::ChargedGeantinoDefinition();
96
97  // gamma
98  G4Gamma::GammaDefinition();
99
100  // optical photon
101  G4OpticalPhoton::OpticalPhotonDefinition();
102}
103
104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105
106void ExN06PhysicsList::ConstructLeptons()
107{
108  // leptons
109  G4Electron::ElectronDefinition();
110  G4Positron::PositronDefinition();
111  G4NeutrinoE::NeutrinoEDefinition();
112  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
113  G4MuonPlus::MuonPlusDefinition();
114  G4MuonMinus::MuonMinusDefinition();
115  G4NeutrinoMu::NeutrinoMuDefinition();
116  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
117}
118
119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120
121void ExN06PhysicsList::ConstructMesons()
122{
123 //  mesons
124  G4PionPlus::PionPlusDefinition();
125  G4PionMinus::PionMinusDefinition();
126  G4PionZero::PionZeroDefinition();
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130
131void ExN06PhysicsList::ConstructBaryons()
132{
133//  barions
134  G4Proton::ProtonDefinition();
135  G4AntiProton::AntiProtonDefinition();
136  G4Neutron::NeutronDefinition();
137  G4AntiNeutron::AntiNeutronDefinition();
138}
139
140//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141
142void ExN06PhysicsList::ConstructProcess()
143{
144  AddTransportation();
145  ConstructGeneral();
146  ConstructEM();
147  ConstructOp();
148}
149
150//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151
152#include "G4Decay.hh"
153
154//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155
156void ExN06PhysicsList::ConstructGeneral()
157{
158  // Add Decay Process
159  G4Decay* theDecayProcess = new G4Decay();
160  theParticleIterator->reset();
161  while( (*theParticleIterator)() ){
162    G4ParticleDefinition* particle = theParticleIterator->value();
163    G4ProcessManager* pmanager = particle->GetProcessManager();
164    if (theDecayProcess->IsApplicable(*particle)) {
165      pmanager ->AddProcess(theDecayProcess);
166      // set ordering for PostStepDoIt and AtRestDoIt
167      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
168      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
169    }
170  }
171}
172
173//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
174
175#include "G4ComptonScattering.hh"
176#include "G4GammaConversion.hh"
177#include "G4PhotoElectricEffect.hh"
178
179#include "G4MultipleScattering.hh"
180
181#include "G4eIonisation.hh"
182#include "G4eBremsstrahlung.hh"
183#include "G4eplusAnnihilation.hh"
184
185#include "G4MuIonisation.hh"
186#include "G4MuBremsstrahlung.hh"
187#include "G4MuPairProduction.hh"
188
189#include "G4hIonisation.hh"
190
191//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192
193void ExN06PhysicsList::ConstructEM()
194{
195  theParticleIterator->reset();
196  while( (*theParticleIterator)() ){
197    G4ParticleDefinition* particle = theParticleIterator->value();
198    G4ProcessManager* pmanager = particle->GetProcessManager();
199    G4String particleName = particle->GetParticleName();
200
201    if (particleName == "gamma") {
202    // gamma
203      // Construct processes for gamma
204//      pmanager->AddDiscreteProcess(new G4GammaConversion());
205//      pmanager->AddDiscreteProcess(new G4ComptonScattering());
206//      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
207
208    } else if (particleName == "e-") {
209    //electron
210      // Construct processes for electron
211      pmanager->AddProcess(new G4MultipleScattering(),-1, 1, 1);
212      pmanager->AddProcess(new G4eIonisation(),       -1, 2, 2);
213      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3, 3);
214
215    } else if (particleName == "e+") {
216    //positron
217      // Construct processes for positron
218      pmanager->AddProcess(new G4MultipleScattering(),-1, 1, 1);
219      pmanager->AddProcess(new G4eIonisation(),       -1, 2, 2);
220      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3, 3);
221      pmanager->AddProcess(new G4eplusAnnihilation(),  0,-1, 4);
222
223    } else if( particleName == "mu+" ||
224               particleName == "mu-"    ) {
225    //muon
226     // Construct processes for muon
227     pmanager->AddProcess(new G4MultipleScattering(),-1, 1, 1);
228     pmanager->AddProcess(new G4MuIonisation(),      -1, 2, 2);
229     pmanager->AddProcess(new G4MuBremsstrahlung(),  -1, 3, 3);
230     pmanager->AddProcess(new G4MuPairProduction(),  -1, 4, 4);
231
232    } else {
233      if ((particle->GetPDGCharge() != 0.0) &&
234          (particle->GetParticleName() != "chargedgeantino")) {
235     // all others charged particles except geantino
236       pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
237       pmanager->AddProcess(new G4hIonisation(),       -1,2,2);
238     }
239    }
240  }
241}
242
243//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
244
245void ExN06PhysicsList::ConstructOp()
246{
247  theCerenkovProcess           = new G4Cerenkov("Cerenkov");
248  theScintillationProcess = new G4Scintillation("Scintillation");
249  theAbsorptionProcess     = new G4OpAbsorption();
250  theRayleighScatteringProcess = new G4OpRayleigh();
251  theBoundaryProcess  = new G4OpBoundaryProcess();
252
253//  theCerenkovProcess->DumpPhysicsTable();
254//  theScintillationProcess->DumpPhysicsTable();
255//  theAbsorptionProcess->DumpPhysicsTable();
256//  theRayleighScatteringProcess->DumpPhysicsTable();
257
258  SetVerbose(1);
259 
260  theCerenkovProcess->SetMaxNumPhotonsPerStep(300);
261  theCerenkovProcess->SetTrackSecondariesFirst(true);
262 
263  theScintillationProcess->SetScintillationYieldFactor(1.);
264  theScintillationProcess->SetTrackSecondariesFirst(true);
265
266  G4OpticalSurfaceModel themodel = unified;
267  theBoundaryProcess->SetModel(themodel);
268
269  theParticleIterator->reset();
270  while( (*theParticleIterator)() ){
271    G4ParticleDefinition* particle = theParticleIterator->value();
272    G4ProcessManager* pmanager = particle->GetProcessManager();
273    G4String particleName = particle->GetParticleName();
274    if (theCerenkovProcess->IsApplicable(*particle)) {
275      pmanager->AddProcess(theCerenkovProcess);
276      pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
277    }
278    if (theScintillationProcess->IsApplicable(*particle)) {
279      pmanager->AddProcess(theScintillationProcess);
280      pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
281      pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
282    }
283    if (particleName == "opticalphoton") {
284      G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
285      pmanager->AddDiscreteProcess(theAbsorptionProcess);
286      pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
287      pmanager->AddDiscreteProcess(theBoundaryProcess);
288    }
289  }
290}
291
292//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
293
294void ExN06PhysicsList::SetVerbose(G4int verbose)
295{
296  theCerenkovProcess->SetVerboseLevel(verbose);
297  theScintillationProcess->SetVerboseLevel(verbose);
298  theAbsorptionProcess->SetVerboseLevel(verbose);
299  theRayleighScatteringProcess->SetVerboseLevel(verbose);
300  theBoundaryProcess->SetVerboseLevel(verbose); 
301}
302
303//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304
305void ExN06PhysicsList::SetNbOfPhotonsCerenkov(G4int MaxNumber)
306{ 
307  theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumber);
308}
309//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
310
311void ExN06PhysicsList::SetCuts()
312{
313  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
314  //   the default cut value for all particle types
315  //
316  SetCutsWithDefault();
317 
318  if (verboseLevel>0) DumpCutValuesTable();   
319}
320
321//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.