source: trunk/source/error_propagation/src/G4ErrorPhysicsList.cc @ 1254

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

update geant4.9.3 tag

File size: 8.2 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// $Id: G4ErrorPhysicsList.cc,v 1.3 2009/05/14 13:54:34 arce Exp $
27// GEANT4 tag $Name: geant4-09-03 $
28//
29// ------------------------------------------------------------
30//      GEANT 4 class implementation file
31// ------------------------------------------------------------
32
33#include "globals.hh"
34
35#include "G4ErrorPhysicsList.hh"
36#include "G4ComptonScattering.hh"
37#include "G4GammaConversion.hh"
38#include "G4PhotoElectricEffect.hh"
39 
40#include "G4eIonisation.hh"
41#include "G4eBremsstrahlung.hh"
42#include "G4eplusAnnihilation.hh"
43
44#include "G4MuIonisation.hh"
45#include "G4MuBremsstrahlung.hh"
46#include "G4MuPairProduction.hh"
47
48#include "G4hIonisation.hh"
49
50#include "G4MuIonisation.hh"
51#include "G4MuBremsstrahlung.hh"
52#include "G4MuPairProduction.hh"
53
54#include "G4hIonisation.hh"
55
56#include "G4ParticleDefinition.hh"
57#include "G4ProcessManager.hh"
58#include "G4ProcessVector.hh"
59#include "G4ParticleTypes.hh"
60#include "G4ParticleTable.hh"
61#include "G4Material.hh"
62#include "G4MaterialTable.hh"
63#include "G4ios.hh"
64#include "G4PhysicsTable.hh"
65#include "G4Transportation.hh"
66
67#include "G4ErrorEnergyLoss.hh"
68
69//------------------------------------------------------------------------
70G4ErrorPhysicsList::G4ErrorPhysicsList():  G4VUserPhysicsList()
71{
72  defaultCutValue = 1.0E+9*cm; // set big step so that AlongStep computes all the energy
73}
74
75
76//------------------------------------------------------------------------
77G4ErrorPhysicsList::~G4ErrorPhysicsList()
78{
79}
80
81
82//------------------------------------------------------------------------
83void G4ErrorPhysicsList::ConstructParticle()
84{
85// In this method, static member functions should be called
86  // for all particles which you want to use.
87  // This ensures that objects of these particle types will be
88  // created in the program.
89  //  gamma
90  G4Gamma::GammaDefinition(); 
91  //  e+/-
92  G4Electron::ElectronDefinition();
93  G4Positron::PositronDefinition();
94  // mu+/-
95  G4MuonPlus::MuonPlusDefinition();
96  G4MuonMinus::MuonMinusDefinition();
97
98  // pi+/-
99  G4PionPlus::PionPlusDefinition();
100  G4PionMinus::PionMinusDefinition();
101
102  // proton
103  G4Proton::ProtonDefinition();
104
105}
106
107
108//------------------------------------------------------------------------
109void G4ErrorPhysicsList::ConstructProcess()
110{
111  G4Transportation* theTransportationProcess= new G4Transportation();
112
113#ifdef G4VERBOSE
114    if (verboseLevel >= 4){
115      G4cout << "G4VUserPhysicsList::ConstructProcess()  "<< G4endl;
116    }
117#endif
118
119  // loop over all particles in G4ParticleTable
120  theParticleIterator->reset();
121  while( (*theParticleIterator)() ){
122    G4ParticleDefinition* particle = theParticleIterator->value();
123    G4ProcessManager* pmanager = particle->GetProcessManager();
124    if (!particle->IsShortLived()) {
125      G4cout << particle << "G4ErrorPhysicsList:: particle process manager " << particle->GetParticleName() << " = " << particle->GetProcessManager() << G4endl;
126      // Add transportation process for all particles other than  "shortlived"
127      if ( pmanager == 0) {
128        // Error !! no process manager
129        G4String particleName = particle->GetParticleName();
130        G4Exception("G4ErrorPhysicsList::ConstructProcess","No process manager",
131                    RunMustBeAborted, particleName );
132      } else {
133        // add transportation with ordering = ( -1, "first", "first" )
134        pmanager ->AddProcess(theTransportationProcess);
135        pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep);
136        pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep);
137      }
138    } else {
139      // shortlived particle case
140    }
141  }
142
143  ConstructEM();
144}
145
146
147//------------------------------------------------------------------------
148#include "G4eBremsstrahlung.hh"
149#include "G4eIonisation.hh"
150
151#include "G4eIonisation.hh"
152
153#include "G4MuBremsstrahlung.hh"
154#include "G4MuIonisation.hh"
155#include "G4MuPairProduction.hh"
156
157#include "G4PhysicsTable.hh"
158
159#include "G4VEnergyLoss.hh"
160
161#include "G4MuIonisation.hh"
162
163#include "G4ErrorStepLengthLimitProcess.hh"
164#include "G4ErrorMagFieldLimitProcess.hh"
165#include "G4ErrorMessenger.hh"
166
167void G4ErrorPhysicsList::ConstructEM()
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();     
201     ////G4VProcess*  theUserCuts = new G4UserSpecialCuts();
202     
203     //
204     // add processes
205     pmanager->AddProcess(anIonisation);
206     //   pmanager->AddProcess(aMultipleScattering);   
207     ////pmanager->AddProcess(theUserCuts);
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);
218     ////pmanager->SetProcessOrdering(theUserCuts,     idxPostStep,2);
219    }
220  }
221}
222
223
224//------------------------------------------------------------------------
225void G4ErrorPhysicsList::SetCuts()
226{
227  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
228  //   the default cut value or all particle types
229  SetCutsWithDefault(); 
230  // if (verboseLevel>0)
231  //  DumpCutValuesTable();
232}
233
Note: See TracBrowser for help on using the repository browser.