source: trunk/examples/extended/polarisation/Pol01/src/PhysicsList.cc @ 850

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

update

File size: 5.8 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: PhysicsList.cc,v 1.2 2006/10/02 16:25:55 vnivanch Exp $
28// GEANT4 tag $Name:  $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "PhysicsList.hh"
34#include "PhysicsListMessenger.hh"
35 
36#include "PhysListEmStandard.hh"
37#include "PhysListEmPolarized.hh"
38
39#include "G4LossTableManager.hh"
40#include "G4UnitsTable.hh"
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44PhysicsList::PhysicsList() 
45: G4VModularPhysicsList()
46{
47  G4LossTableManager::Instance();
48 
49  currentDefaultCut   = 0.1*mm;
50  cutForGamma         = currentDefaultCut;
51  cutForElectron      = currentDefaultCut;
52  cutForPositron      = currentDefaultCut;
53
54  pMessenger = new PhysicsListMessenger(this);
55
56  SetVerboseLevel(1);
57
58  emName = "polarized";
59  emPhysicsList = new PhysListEmPolarized();
60
61}
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
65PhysicsList::~PhysicsList()
66{
67  delete pMessenger;
68}
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71
72// Bosons
73#include "G4Gamma.hh"
74
75// leptons
76#include "G4Electron.hh"
77#include "G4Positron.hh"
78
79
80//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81
82void PhysicsList::ConstructParticle()
83{
84  // only QED in this example
85
86// gamma
87  G4Gamma::GammaDefinition();
88 
89// leptons
90  G4Electron::ElectronDefinition();
91  G4Positron::PositronDefinition();
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
96#include "G4EmProcessOptions.hh"
97
98void PhysicsList::ConstructProcess()
99{
100  // Transportation
101  //
102  AddTransportation();
103
104  // Electromagnetic physics list
105  //
106  emPhysicsList->ConstructProcess();
107   
108  // step limitation (as a full process)
109  // 
110  AddStepMax();     
111}
112
113//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114
115void PhysicsList::AddPhysicsList(const G4String& name)
116{
117  if (verboseLevel>0) {
118    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
119  }
120 
121  if (name == emName) return;
122
123  if (name == "standard") {
124
125    emName = name;
126    delete emPhysicsList;
127    emPhysicsList = new PhysListEmStandard();
128           
129  } 
130  if (name == "polarized") {
131
132    emName = name;
133    delete emPhysicsList;
134    emPhysicsList = new PhysListEmPolarized();
135           
136  } 
137  else {
138    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
139           << " is not defined"
140           << G4endl;
141  }
142}
143
144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145
146#include "G4ProcessManager.hh"
147#include "StepMax.hh"
148
149void PhysicsList::AddStepMax()
150{
151  // Step limitation seen as a process
152  StepMax* stepMaxProcess = new StepMax();
153
154  theParticleIterator->reset();
155  while ((*theParticleIterator)()){
156      G4ParticleDefinition* particle = theParticleIterator->value();
157      G4ProcessManager* pmanager = particle->GetProcessManager();
158
159      if (stepMaxProcess->IsApplicable(*particle) && pmanager)
160          pmanager ->AddDiscreteProcess(stepMaxProcess);
161  }
162}
163
164
165//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166
167#include "G4Gamma.hh"
168#include "G4Electron.hh"
169#include "G4Positron.hh"
170
171void PhysicsList::SetCuts()
172{   
173  // set cut values for gamma at first and for e- second and next for e+,
174  // because some processes for e+/e- need cut values for gamma
175  SetCutValue(cutForGamma, "gamma");
176  SetCutValue(cutForElectron, "e-");
177  SetCutValue(cutForPositron, "e+");
178}
179
180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181
182void PhysicsList::SetCutForGamma(G4double cut)
183{
184  cutForGamma = cut;
185  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
186}
187
188//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
189
190void PhysicsList::SetCutForElectron(G4double cut)
191{
192  cutForElectron = cut;
193  SetParticleCuts(cutForElectron, G4Electron::Electron());
194}
195
196//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
197
198void PhysicsList::SetCutForPositron(G4double cut)
199{
200  cutForPositron = cut;
201  SetParticleCuts(cutForPositron, G4Positron::Positron());
202}
203
204//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.