source: trunk/source/digits_hits/utils/test/test1/src/Tst1PhysicsList.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

File size: 10.3 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: Tst1PhysicsList.cc,v 1.2 2010/07/21 02:51:58 akimura Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30
31#include "Tst1PhysicsList.hh"
32
33#include "G4ParticleDefinition.hh"
34#include "G4ProcessManager.hh"
35#include "G4ProcessVector.hh"
36#include "G4ParticleTypes.hh"
37#include "G4ParticleTable.hh"
38#include "G4ios.hh"             
39
40Tst1PhysicsList::Tst1PhysicsList():  G4VUserPhysicsList()
41{
42 defaultCutValue = 1.0*mm;
43 SetVerboseLevel(1);
44}
45
46Tst1PhysicsList::~Tst1PhysicsList()
47{}
48
49void Tst1PhysicsList::ConstructParticle()
50{
51  // In this method, static member functions should be called
52  // for all particles which you want to use.
53  // This ensures that objects of these particle types will be
54  // created in the program.
55
56  ConstructBosons();
57  ConstructLeptons();
58  ConstructMesons();
59  ConstructBaryons();
60}
61
62void Tst1PhysicsList::ConstructBosons()
63{
64  // pseudo-particles
65  G4Geantino::GeantinoDefinition();
66  G4ChargedGeantino::ChargedGeantinoDefinition();
67
68  // gamma
69  G4Gamma::GammaDefinition();
70}
71
72void Tst1PhysicsList::ConstructLeptons()
73{
74  // leptons
75  G4Electron::ElectronDefinition();
76  G4Positron::PositronDefinition();
77  G4MuonPlus::MuonPlusDefinition();
78  G4MuonMinus::MuonMinusDefinition();
79
80  G4NeutrinoE::NeutrinoEDefinition();
81  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
82  G4NeutrinoMu::NeutrinoMuDefinition();
83  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
84}
85
86void Tst1PhysicsList::ConstructMesons()
87{
88 //  mesons
89  G4PionPlus::PionPlusDefinition();
90  G4PionMinus::PionMinusDefinition();
91  G4PionZero::PionZeroDefinition();
92  G4Eta::EtaDefinition();
93  G4EtaPrime::EtaPrimeDefinition();
94  G4KaonPlus::KaonPlusDefinition();
95  G4KaonMinus::KaonMinusDefinition();
96  G4KaonZero::KaonZeroDefinition();
97  G4AntiKaonZero::AntiKaonZeroDefinition();
98  G4KaonZeroLong::KaonZeroLongDefinition();
99  G4KaonZeroShort::KaonZeroShortDefinition();
100}
101
102void Tst1PhysicsList::ConstructBaryons()
103{
104//  barions
105  G4Proton::ProtonDefinition();
106  G4AntiProton::AntiProtonDefinition();
107  G4Neutron::NeutronDefinition();
108  G4AntiNeutron::AntiNeutronDefinition();
109}
110
111void Tst1PhysicsList::ConstructProcess()
112{
113  AddTransportation();
114  ConstructGeneral();
115  ConstructEM();
116}
117
118#include "G4ComptonScattering.hh"
119#include "G4GammaConversion.hh"
120#include "G4PhotoElectricEffect.hh"
121
122#include "G4eMultipleScattering.hh"
123#include "G4eIonisation.hh"
124#include "G4eBremsstrahlung.hh"
125#include "G4eplusAnnihilation.hh"
126
127#include "G4MuMultipleScattering.hh"
128#include "G4MuIonisation.hh"
129#include "G4MuBremsstrahlung.hh"
130#include "G4MuPairProduction.hh"
131
132#include "G4hMultipleScattering.hh"
133#include "G4hIonisation.hh"
134
135void Tst1PhysicsList::ConstructEM()
136{
137  G4bool displacementFlg = true; // for multiple scattering
138  theParticleIterator->reset();
139  while( (*theParticleIterator)() ){
140    G4ParticleDefinition* particle = theParticleIterator->value();
141    G4ProcessManager* pmanager = particle->GetProcessManager();
142    G4String particleName = particle->GetParticleName();
143     
144    if (particleName == "gamma") {
145    // gamma
146      pmanager->AddDiscreteProcess(new G4GammaConversion());
147      pmanager->AddDiscreteProcess(new G4ComptonScattering());     
148      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
149
150    } else if (particleName == "e-") {
151    //electron
152      G4eMultipleScattering* theeminusMultipleScattering = new G4eMultipleScattering();
153      theeminusMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
154      G4VProcess* theeminusIonisation         = new G4eIonisation();
155      G4VProcess* theeminusBremsstrahlung     = new G4eBremsstrahlung();
156      //
157      // add processes
158      pmanager->AddProcess(theeminusMultipleScattering);
159      pmanager->AddProcess(theeminusIonisation);
160      pmanager->AddProcess(theeminusBremsstrahlung);
161      //     
162      // set ordering for AlongStepDoIt
163      pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
164      pmanager->SetProcessOrdering(theeminusIonisation,         idxAlongStep,2);
165      pmanager->SetProcessOrdering(theeminusBremsstrahlung,     idxAlongStep,3);     
166      //
167      // set ordering for PostStepDoIt
168      pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
169      pmanager->SetProcessOrdering(theeminusIonisation,         idxPostStep,2);
170      pmanager->SetProcessOrdering(theeminusBremsstrahlung,     idxPostStep,3);
171
172    } else if (particleName == "e+") {
173    //positron
174      G4eMultipleScattering* theeplusMultipleScattering = new G4eMultipleScattering();
175      theeplusMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
176      G4VProcess* theeplusIonisation         = new G4eIonisation();
177      G4VProcess* theeplusBremsstrahlung     = new G4eBremsstrahlung();
178      G4VProcess* theeplusAnnihilation       = new G4eplusAnnihilation();
179      //
180      // add processes
181      pmanager->AddProcess(theeplusMultipleScattering);
182      pmanager->AddProcess(theeplusIonisation);
183      pmanager->AddProcess(theeplusBremsstrahlung);
184      pmanager->AddProcess(theeplusAnnihilation);
185      //
186      // set ordering for AtRestDoIt
187      pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
188      //
189      // set ordering for AlongStepDoIt
190      pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
191      pmanager->SetProcessOrdering(theeplusIonisation,         idxAlongStep,2);
192      pmanager->SetProcessOrdering(theeplusBremsstrahlung,     idxAlongStep,3);     
193      //
194      // set ordering for PostStepDoIt
195      pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
196      pmanager->SetProcessOrdering(theeplusIonisation,         idxPostStep,2);
197      pmanager->SetProcessOrdering(theeplusBremsstrahlung,     idxPostStep,3);
198      pmanager->SetProcessOrdering(theeplusAnnihilation,       idxPostStep,4);
199 
200    } else if( particleName == "mu+" || 
201               particleName == "mu-"    ) {
202    //muon 
203      G4MuMultipleScattering* aMultipleScattering = new G4MuMultipleScattering();
204      aMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
205      G4VProcess* aBremsstrahlung     = new G4MuBremsstrahlung();
206      G4VProcess* aPairProduction     = new G4MuPairProduction();
207      G4VProcess* anIonisation        = new G4MuIonisation();
208      //
209      // add processes
210      pmanager->AddProcess(anIonisation);
211      pmanager->AddProcess(aMultipleScattering);
212      pmanager->AddProcess(aBremsstrahlung);
213      pmanager->AddProcess(aPairProduction);
214      //
215      // set ordering for AlongStepDoIt
216      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
217      pmanager->SetProcessOrdering(anIonisation,        idxAlongStep,2);
218      pmanager->SetProcessOrdering(aBremsstrahlung,     idxAlongStep,3);
219      pmanager->SetProcessOrdering(aPairProduction,     idxAlongStep,4);
220     
221      //
222      // set ordering for PostStepDoIt
223      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
224      pmanager->SetProcessOrdering(anIonisation,        idxPostStep,2);
225      pmanager->SetProcessOrdering(aBremsstrahlung,     idxPostStep,3);
226      pmanager->SetProcessOrdering(aPairProduction,     idxPostStep,4);
227
228     } else if ((!particle->IsShortLived()) &&
229               (particle->GetPDGCharge() != 0.0) && 
230               (particle->GetParticleName() != "chargedgeantino")) {
231     // all others charged particles except geantino     
232     G4hMultipleScattering* aMultipleScattering = new G4hMultipleScattering();
233     aMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
234     G4VProcess* anIonisation        = new G4hIonisation();
235     //
236     // add processes
237     pmanager->AddProcess(anIonisation);
238     pmanager->AddProcess(aMultipleScattering);
239     //
240     // set ordering for AlongStepDoIt
241     pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
242     pmanager->SetProcessOrdering(anIonisation,        idxAlongStep,2);
243     //
244     // set ordering for PostStepDoIt
245     pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
246     pmanager->SetProcessOrdering(anIonisation,        idxPostStep,2);
247    }
248  }
249}
250
251#include "G4Decay.hh"
252
253void Tst1PhysicsList::ConstructGeneral()
254{
255  // Add Decay Process and Parallel world Scoring Process
256  G4Decay* theDecayProcess = new G4Decay();
257
258  theParticleIterator->reset();
259  while( (*theParticleIterator)() ){
260    G4ParticleDefinition* particle = theParticleIterator->value();
261    G4ProcessManager* pmanager = particle->GetProcessManager();
262    if (theDecayProcess->IsApplicable(*particle)) { 
263      pmanager ->AddProcess(theDecayProcess);
264      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
265      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
266    }
267  }
268}
269
270void Tst1PhysicsList::SetCuts()
271{
272  // These values are used as the default production thresholds
273  // for the world volume.
274  SetCutsWithDefault();
275}
276
277
Note: See TracBrowser for help on using the repository browser.