source: trunk/examples/extended/field/field01/src/F01PhysicsList.cc

Last change on this file was 1342, checked in by garnier, 14 years ago

update ti head

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: F01PhysicsList.cc,v 1.16 2010/08/16 08:24:39 kurasige Exp $
28// GEANT4 tag $Name: examples-V09-03-09 $
29//
30
31#include "G4Timer.hh"
32   
33#include "F01PhysicsList.hh"
34#include "F01DetectorConstruction.hh"
35#include "F01PhysicsListMessenger.hh"
36
37#include "G4ProcessManager.hh"
38#include "G4ProcessVector.hh"
39#include "G4ParticleTypes.hh"
40#include "G4ParticleTable.hh"
41#include "G4Material.hh"
42#include "G4EnergyLossTables.hh"
43#include "G4UnitsTable.hh"
44#include "G4ios.hh"
45#include <iomanip>
46
47
48
49/////////////////////////////////////////////////////////////
50//
51//
52
53F01PhysicsList::F01PhysicsList(F01DetectorConstruction* p)
54:  G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
55   thePhotoElectricEffect(0), theComptonScattering(0),
56   theGammaConversion(0), theeminusIonisation(0),
57   theeminusBremsstrahlung(0), theeplusIonisation(0),
58   theeplusBremsstrahlung(0), theeplusAnnihilation(0),
59   theeminusStepCut(0),theeplusStepCut(0)
60{
61  pDet = p;
62
63  defaultCutValue = 1.000*mm ;
64
65  cutForGamma = defaultCutValue ;
66  cutForElectron = defaultCutValue ;
67
68  SetVerboseLevel(1);
69  physicsListMessenger = new F01PhysicsListMessenger(this);
70}
71
72/////////////////////////////////////////////////////////////////////////
73//
74//
75
76F01PhysicsList::~F01PhysicsList()
77{
78  delete physicsListMessenger; 
79}
80
81///////////////////////////////////////////////////////////////////////////
82//
83//
84
85void F01PhysicsList::ConstructParticle()
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
92  ConstructBosons();
93  ConstructLeptons();
94  ConstructMesons();
95  ConstructBarions();
96}
97
98////////////////////////////////////////////////////////////////////////////
99//
100//
101
102void F01PhysicsList::ConstructBosons()
103{
104  // gamma
105
106  G4Gamma::GammaDefinition();
107
108  // charged geantino
109
110  G4ChargedGeantino::ChargedGeantinoDefinition();
111
112
113}
114
115void F01PhysicsList::ConstructLeptons()
116{
117  // leptons
118
119  G4Electron::ElectronDefinition();
120  G4Positron::PositronDefinition();
121  G4MuonPlus::MuonPlusDefinition();
122  G4MuonMinus::MuonMinusDefinition();
123
124  G4NeutrinoE::NeutrinoEDefinition();
125  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
126  G4NeutrinoMu::NeutrinoMuDefinition();
127  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
128}
129
130void F01PhysicsList::ConstructMesons()
131{
132 //  mesons
133
134  G4PionPlus::PionPlusDefinition();
135  G4PionMinus::PionMinusDefinition();
136  G4PionZero::PionZeroDefinition();
137  G4KaonPlus::KaonPlusDefinition();
138  G4KaonMinus::KaonMinusDefinition();
139}
140
141
142void F01PhysicsList::ConstructBarions()
143{
144//  barions
145
146  G4Proton::ProtonDefinition();
147  G4AntiProton::AntiProtonDefinition();
148}
149
150
151///////////////////////////////////////////////////////////////////////
152//
153//
154
155void F01PhysicsList::ConstructProcess()
156{
157  AddTransportation();
158  // AddParameterisation();
159
160  ConstructEM();
161  ConstructGeneral();
162}
163
164/////////////////////////////////////////////////////////////////////////////
165//
166//
167
168#include "G4ComptonScattering.hh"
169#include "G4GammaConversion.hh"
170#include "G4PhotoElectricEffect.hh"
171
172#include "G4eMultipleScattering.hh"
173#include "G4MuMultipleScattering.hh"
174#include "G4hMultipleScattering.hh"
175
176#include "G4eIonisation.hh"
177#include "G4eBremsstrahlung.hh"
178#include "G4eplusAnnihilation.hh"
179
180#include "G4MuIonisation.hh"
181#include "G4MuBremsstrahlung.hh"
182#include "G4MuPairProduction.hh"
183
184#include "G4hIonisation.hh"
185
186#include "F01StepCut.hh"
187
188void F01PhysicsList::ConstructEM()
189{
190  theParticleIterator->reset();
191
192  while( (*theParticleIterator)() )
193  {
194    G4ParticleDefinition* particle = theParticleIterator->value();
195    G4ProcessManager* pmanager = particle->GetProcessManager();
196    G4String particleName = particle->GetParticleName();
197
198    if (particleName == "gamma") 
199    {
200      // Construct processes for gamma
201
202      thePhotoElectricEffect = new G4PhotoElectricEffect();     
203      theComptonScattering   = new G4ComptonScattering();
204      theGammaConversion     = new G4GammaConversion();
205     
206      pmanager->AddDiscreteProcess(thePhotoElectricEffect);
207      pmanager->AddDiscreteProcess(theComptonScattering);
208
209      pmanager->AddDiscreteProcess(theGammaConversion);
210     
211    } 
212    else if (particleName == "e-") 
213    {
214      // Construct processes for electron
215
216      // theeminusMultipleScattering = new G4eMultipleScattering();
217     theeminusIonisation = new G4eIonisation();
218     theeminusBremsstrahlung = new G4eBremsstrahlung();
219
220
221      theeminusStepCut = new F01StepCut();
222
223      //  pmanager->AddProcess(theeminusMultipleScattering,-1,1,1);
224
225      pmanager->AddProcess(theeminusIonisation,-1,2,2);
226
227
228      pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3); 
229
230     
231      pmanager->AddProcess(theeminusStepCut,-1,-1,4);
232      theeminusStepCut->SetMaxStep(MaxChargedStep) ;
233
234    } 
235    else if (particleName == "e+") 
236    {
237      // Construct processes for positron
238
239      //   theeplusMultipleScattering = new G4eMultipleScattering();
240      theeplusIonisation = new G4eIonisation();
241      theeplusBremsstrahlung = new G4eBremsstrahlung();
242      // theeplusAnnihilation = new G4eplusAnnihilation();
243
244
245      theeplusStepCut = new F01StepCut();
246     
247      //  pmanager->AddProcess(theeplusMultipleScattering,-1,1,1);
248      pmanager->AddProcess(theeplusIonisation,-1,2,2);
249      pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
250      //  pmanager->AddProcess(theeplusAnnihilation,0,-1,4);
251     
252
253      pmanager->AddProcess(theeplusStepCut,-1,-1,5);
254      theeplusStepCut->SetMaxStep(MaxChargedStep) ;
255
256    } 
257    else if( particleName == "mu+" || 
258               particleName == "mu-"    ) 
259    {
260     // Construct processes for muon+
261
262      F01StepCut* muonStepCut = new F01StepCut();
263
264      G4MuIonisation* themuIonisation = new G4MuIonisation() ;
265     pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
266     pmanager->AddProcess(themuIonisation,-1,2,2);
267     pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
268     pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4); 
269     
270     pmanager->AddProcess( muonStepCut,-1,-1,3);
271     muonStepCut->SetMaxStep(MaxChargedStep) ;
272
273    } 
274    else if (
275                particleName == "proton" 
276               || particleName == "antiproton" 
277               || particleName == "pi+"
278               || particleName == "pi-" 
279               || particleName == "kaon+" 
280               || particleName == "kaon-" 
281              )
282    {
283        F01StepCut* thehadronStepCut = new F01StepCut();
284
285      G4hIonisation* thehIonisation = new G4hIonisation() ; 
286      G4hMultipleScattering* thehMultipleScattering =
287                     new G4hMultipleScattering() ;
288
289
290      pmanager->AddProcess(thehMultipleScattering,-1,1,1);
291      pmanager->AddProcess(thehIonisation,-1,2,2);
292
293
294        pmanager->AddProcess( thehadronStepCut,-1,-1,3);
295        thehadronStepCut->SetMaxStep(MaxChargedStep) ;
296      thehadronStepCut->SetMaxStep(10*mm) ;
297     
298    }
299  }
300}
301
302
303#include "G4Decay.hh"
304
305void F01PhysicsList::ConstructGeneral()
306{
307  // Add Decay Process
308
309   G4Decay* theDecayProcess = new G4Decay();
310  theParticleIterator->reset();
311
312  while( (*theParticleIterator)() )
313  {
314    G4ParticleDefinition* particle = theParticleIterator->value();
315    G4ProcessManager* pmanager = particle->GetProcessManager();
316
317    if (theDecayProcess->IsApplicable(*particle))
318    { 
319      pmanager ->AddProcess(theDecayProcess);
320
321      // set ordering for PostStepDoIt and AtRestDoIt
322
323      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
324      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
325    }
326  }
327}
328
329
330
331/////////////////////////////////////////////////////////////////////////////
332
333void F01PhysicsList::SetCuts()
334{
335  G4Timer theTimer ;
336  theTimer.Start() ;
337  if (verboseLevel >0)
338  {
339    G4cout << "F01PhysicsList::SetCuts:";
340    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
341  }
342  // set cut values for gamma at first and for e- second and next for e+,
343  // because some processes for e+/e- need cut values for gamma
344
345   SetCutValue(cutForGamma,"gamma");
346
347   SetCutValue(cutForElectron,"e-");
348   SetCutValue(cutForElectron,"e+");
349
350  if (verboseLevel>1)     DumpCutValuesTable();
351
352  theTimer.Stop();
353  G4cout.precision(6);
354  G4cout << G4endl ;
355  G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
356
357}
358
359///////////////////////////////////////////////////////////////////////////
360
361void F01PhysicsList::SetGammaCut(G4double val)
362{
363  cutForGamma = val;
364}
365
366///////////////////////////////////////////////////////////////////////////
367
368void F01PhysicsList::SetElectronCut(G4double val)
369{
370  cutForElectron = val;
371}
372
373
374////////////////////////////////////////////////////////////////////////////
375
376void F01PhysicsList::SetMaxStep(G4double step)
377{
378  MaxChargedStep = step ;
379  G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
380  G4cout << G4endl;
381}
Note: See TracBrowser for help on using the repository browser.