Geant4_10
G4ErrorPhysicsList.cc
Go to the documentation of this file.
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 // $Id: G4ErrorPhysicsList.cc 69014 2013-04-15 09:42:51Z gcosmo $
27 //
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // ------------------------------------------------------------
31 
32 #include "globals.hh"
33 
34 #include "G4PhysicalConstants.hh"
35 #include "G4SystemOfUnits.hh"
36 
37 #include "G4ErrorPhysicsList.hh"
38 #include "G4ComptonScattering.hh"
39 #include "G4GammaConversion.hh"
40 #include "G4PhotoElectricEffect.hh"
41 
42 #include "G4eIonisation.hh"
43 #include "G4eBremsstrahlung.hh"
44 #include "G4eplusAnnihilation.hh"
45 
46 #include "G4MuIonisation.hh"
47 #include "G4MuBremsstrahlung.hh"
48 #include "G4MuPairProduction.hh"
49 
50 #include "G4hIonisation.hh"
51 
52 #include "G4MuIonisation.hh"
53 #include "G4MuBremsstrahlung.hh"
54 #include "G4MuPairProduction.hh"
55 
56 #include "G4hIonisation.hh"
57 
58 #include "G4ParticleDefinition.hh"
59 #include "G4ProcessManager.hh"
60 #include "G4ProcessVector.hh"
61 #include "G4ParticleTypes.hh"
62 #include "G4ParticleTable.hh"
63 #include "G4Material.hh"
64 #include "G4MaterialTable.hh"
65 #include "G4ios.hh"
66 #include "G4PhysicsTable.hh"
67 #include "G4Transportation.hh"
68 
69 #include "G4ErrorEnergyLoss.hh"
70 
71 //------------------------------------------------------------------------
73 {
74  defaultCutValue = 1.0E+9*cm; // set big step so that AlongStep computes all the energy
75 }
76 
77 
78 //------------------------------------------------------------------------
80 {
81 }
82 
83 
84 //------------------------------------------------------------------------
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  // gamma
93  // e+/-
96  // mu+/-
99 
100  // pi+/-
103 
104  // proton
106 
107 }
108 
109 
110 //------------------------------------------------------------------------
112 {
113  G4Transportation* theTransportationProcess= new G4Transportation();
114 
115 #ifdef G4VERBOSE
116  if (verboseLevel >= 4){
117  G4cout << "G4VUserPhysicsList::ConstructProcess() "<< G4endl;
118  }
119 #endif
120 
121  // loop over all particles in G4ParticleTable
122  theParticleIterator->reset();
123  while( (*theParticleIterator)() ){
124  G4ParticleDefinition* particle = theParticleIterator->value();
125  G4ProcessManager* pmanager = particle->GetProcessManager();
126  if (!particle->IsShortLived()) {
127  G4cout << particle << "G4ErrorPhysicsList:: particle process manager " << particle->GetParticleName() << " = " << particle->GetProcessManager() << G4endl;
128  // Add transportation process for all particles other than "shortlived"
129  if ( pmanager == 0) {
130  // Error !! no process manager
131  G4String particleName = particle->GetParticleName();
132  G4Exception("G4ErrorPhysicsList::ConstructProcess","No process manager",
133  RunMustBeAborted, particleName );
134  } else {
135  // add transportation with ordering = ( -1, "first", "first" )
136  pmanager ->AddProcess(theTransportationProcess);
137  pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep);
138  pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep);
139  }
140  } else {
141  // shortlived particle case
142  }
143  }
144 
145  ConstructEM();
146 }
147 
148 
149 //------------------------------------------------------------------------
150 #include "G4eBremsstrahlung.hh"
151 #include "G4eIonisation.hh"
152 
153 #include "G4eIonisation.hh"
154 
155 #include "G4MuBremsstrahlung.hh"
156 #include "G4MuIonisation.hh"
157 #include "G4MuPairProduction.hh"
158 
159 #include "G4PhysicsTable.hh"
160 
161 #include "G4MuIonisation.hh"
162 
165 #include "G4ErrorMessenger.hh"
166 
168 {
169 
170  G4ErrorEnergyLoss* eLossProcess = new G4ErrorEnergyLoss;
171  G4ErrorStepLengthLimitProcess* stepLengthLimitProcess = new G4ErrorStepLengthLimitProcess;
172  G4ErrorMagFieldLimitProcess* magFieldLimitProcess = new G4ErrorMagFieldLimitProcess;
173  new G4ErrorMessenger( stepLengthLimitProcess, magFieldLimitProcess, eLossProcess );
174 
175  theParticleIterator->reset();
176  while( (*theParticleIterator)() ){
177  G4ParticleDefinition* particle = theParticleIterator->value();
178  G4ProcessManager* pmanager = particle->GetProcessManager();
179  G4String particleName = particle->GetParticleName();
180 
181  if (particleName == "gamma") {
182  // gamma
183  pmanager->AddDiscreteProcess(new G4GammaConversion());
184  pmanager->AddDiscreteProcess(new G4ComptonScattering());
185  pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
186 
187  // } else if (particleName == "e-" || particleName == "e+"
188  // || particleName == "mu+" || particleName == "mu-" ) {
189  }else if (!particle->IsShortLived() && particle->GetPDGCharge() != 0 ) {
190 
191  pmanager->AddContinuousProcess(eLossProcess,1);
192  pmanager->AddDiscreteProcess( stepLengthLimitProcess, 2 );
193  pmanager->AddDiscreteProcess( magFieldLimitProcess, 3 );
194 
195  /* } else if ((!particle->IsShortLived()) &&
196  (particle->GetPDGCharge() != 0.0) &&
197  (particle->GetParticleName() != "chargedgeantino")) {
198  // all others charged particles except geantino
199  // G4VProcess* aMultipleScattering = new G4MultipleScattering();
200  G4VProcess* anIonisation = new G4hIonisation();
202 
203  //
204  // add processes
205  pmanager->AddProcess(anIonisation);
206  // pmanager->AddProcess(aMultipleScattering);
208 
209  //
210  // set ordering for AlongStepDoIt
211  // pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
212  pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1);
213 
214  //
215  // set ordering for PostStepDoIt
216  // pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
217  pmanager->SetProcessOrdering(anIonisation, idxPostStep,1);
219  */
220  }
221  }
222 }
223 
224 
225 //------------------------------------------------------------------------
227 {
228  // " G4VUserPhysicsList::SetCutsWithDefault" method sets
229  // the default cut value or all particle types
231  // if (verboseLevel>0)
232  // DumpCutValuesTable();
233 }
234 
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
void SetProcessOrderingToFirst(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
virtual void ConstructEM()
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:88
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
virtual void ConstructParticle()
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
#define G4endl
Definition: G4ios.hh:61
virtual void ConstructProcess()
G4double GetPDGCharge() const
#define theParticleIterator
G4int AddContinuousProcess(G4VProcess *aProcess, G4int ord=ordDefault)
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81