source: trunk/examples/extended/parameterisations/gflash/src/ExGflashPhysicsList.cc @ 1342

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

update ti head

File size: 12.4 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#include "ExGflashPhysicsList.hh"
27
28#include "globals.hh"
29#include "G4ParticleDefinition.hh"
30#include "G4ParticleWithCuts.hh"
31#include "G4ProcessManager.hh"
32#include "G4ProcessVector.hh"
33#include "G4ParticleTypes.hh"
34#include "G4ParticleTable.hh"
35#include "G4Material.hh"
36#include "G4MaterialTable.hh"
37#include "G4Region.hh"
38#include "G4RegionStore.hh"
39#include "G4ios.hh"
40#include <iomanip>  
41
42#include "G4FastSimulationManagerProcess.hh"
43
44
45ExGflashPhysicsList::ExGflashPhysicsList():  G4VUserPhysicsList()
46{
47  SetVerboseLevel(0);
48}
49
50ExGflashPhysicsList::~ExGflashPhysicsList()
51{
52}
53
54void ExGflashPhysicsList::ConstructParticle()
55{
56  // In this method, static member functions should be called
57  // for all particles which you want to use.
58  // This ensures that objects of these particle types will be
59  // created in the program.
60
61        std::cout<<"start construct particle"<<std::endl;
62  ConstructBosons();
63  ConstructLeptons();
64  ConstructMesons();
65  ConstructBaryons();
66  ConstructIons();
67        std::cout<<"end construct particle"<<std::endl;
68}
69
70void ExGflashPhysicsList::ConstructBosons()
71{
72  // pseudo-particles
73  G4Geantino::GeantinoDefinition();
74  G4ChargedGeantino::ChargedGeantinoDefinition();
75
76  // gamma
77  G4Gamma::GammaDefinition();
78
79  // optical photon
80  G4OpticalPhoton::OpticalPhotonDefinition();
81}
82
83#include "G4LeptonConstructor.hh"
84void ExGflashPhysicsList::ConstructLeptons()
85{
86  // Construct all leptons
87  G4LeptonConstructor pConstructor;
88  pConstructor.ConstructParticle();
89}
90
91#include "G4MesonConstructor.hh"
92void ExGflashPhysicsList::ConstructMesons()
93{
94  //  Construct all mesons
95  G4MesonConstructor pConstructor;
96  pConstructor.ConstructParticle();
97}
98
99#include "G4BaryonConstructor.hh"
100void ExGflashPhysicsList::ConstructBaryons()
101{
102  //  Construct all barions
103  G4BaryonConstructor  pConstructor;
104  pConstructor.ConstructParticle(); 
105}
106
107#include "G4IonConstructor.hh"
108void ExGflashPhysicsList::ConstructIons()
109{
110  //  Construct light ions
111  G4IonConstructor pConstructor;
112  pConstructor.ConstructParticle(); 
113}
114
115void ExGflashPhysicsList::ConstructProcess()
116{
117  //    std::cout<<"1111"<<std::endl;
118  AddTransportation();
119  //    std::cout<<"2222"<<std::endl;
120  AddParameterisation();
121  std::cout<<"AddParameterisation"<<std::endl;
122 
123  ConstructEM();
124  std::cout<<"ConstructEM"<<std::endl;
125  ConstructGeneral();
126  //    std::cout<<"5555"<<std::endl;
127}
128
129
130void ExGflashPhysicsList::AddTransportation()
131{
132  G4VUserPhysicsList::AddTransportation();
133}
134
135#include "G4ComptonScattering.hh"
136#include "G4GammaConversion.hh"
137#include "G4PhotoElectricEffect.hh"
138
139#include "G4eMultipleScattering.hh"
140#include "G4MuMultipleScattering.hh"
141#include "G4hMultipleScattering.hh"
142
143#include "G4eIonisation.hh"
144#include "G4eBremsstrahlung.hh"
145#include "G4eplusAnnihilation.hh"
146
147#include "G4UserLimits.hh"
148
149#include "G4MuIonisation.hh"
150#include "G4MuBremsstrahlung.hh"
151#include "G4MuPairProduction.hh"
152
153#include "G4hIonisation.hh"
154void ExGflashPhysicsList::ConstructEM()
155{
156
157   cout<<"Physics List constructor"<<endl;
158   SetCuts();
159  theParticleIterator->reset();
160  while( (*theParticleIterator)() ){
161    G4ParticleDefinition* particle = theParticleIterator->value();
162    G4ProcessManager* pmanager = particle->GetProcessManager();
163    G4String particleName = particle->GetParticleName();
164     
165    if (particleName == "gamma") {
166    // gamma
167      // Construct processes for gamma
168      G4VProcess* theGammaConversion = new G4GammaConversion();
169      G4VProcess* theComptonScattering = new G4ComptonScattering();
170      G4VProcess* thePhotoElectricEffect = new G4PhotoElectricEffect();     
171      // G4VProcess* thegammacut = new G4UserLimits();
172      //      thegammacut->SetUserMinEkine(1.0*MeV);
173
174      pmanager->AddDiscreteProcess(theGammaConversion);
175      pmanager->AddDiscreteProcess(theComptonScattering);     
176      pmanager->AddDiscreteProcess(thePhotoElectricEffect);
177      //  pmanager->AddProcess(thegammacut);
178      //   G4cout <<"theGammaConversion" << theGammaConversion <<endl;
179      //G4cout <<"theComptonScattering" << theComptonScattering <<endl;
180      //G4cout <<"thePhotoElectricEffect" << thePhotoElectricEffect <<endl;
181
182    } else if (particleName == "e-") {
183    //electron
184      // Construct processes for electron
185      G4VProcess* theeminusMultipleScattering = new G4eMultipleScattering();
186      G4VProcess* theeminusIonisation = new G4eIonisation();
187      G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
188      //      G4VProcess* theeminuscut = new G4UserLimits();
189      //  theeminuscut->SetUserMinEkine(1.0*MeV);
190      // add processes
191      pmanager->AddProcess(theeminusMultipleScattering);
192      pmanager->AddProcess(theeminusIonisation);
193      pmanager->AddProcess(theeminusBremsstrahlung);     
194     
195      //  pmanager->AddProcess( theeminuscut);
196
197
198 
199 // set ordering for AlongStepDoIt
200      pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,  1);
201      pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,  2);
202      // set ordering for PostStepDoIt
203      pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
204      pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
205      pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
206
207      //G4cout <<"theeminusMultipleScattering" << theeminusMultipleScattering <<endl;
208      //G4cout <<"theeminusIonisation" << theeminusIonisation <<endl;
209      //G4cout <<"theeminusBremsstrahlung" << theeminusBremsstrahlung <<endl;
210
211    } else if (particleName == "e+") {
212    //positron
213      // Construct processes for positron
214      G4VProcess* theeplusMultipleScattering = new G4eMultipleScattering();
215      G4VProcess* theeplusIonisation = new G4eIonisation();
216      G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
217      G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
218      // add processes
219      pmanager->AddProcess(theeplusMultipleScattering);
220      pmanager->AddProcess(theeplusIonisation);
221      pmanager->AddProcess(theeplusBremsstrahlung);
222      pmanager->AddProcess(theeplusAnnihilation);
223      // set ordering for AtRestDoIt
224      pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
225      // set ordering for AlongStepDoIt
226      pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,  1);
227      pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,  2);
228      // set ordering for PostStepDoIt
229      pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
230      pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
231      pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
232      pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
233 
234      //G4cout <<"theeplusMultipleScattering" << theeplusMultipleScattering <<endl;
235      //G4cout <<"theeplusIonisation" << theeplusIonisation <<endl;
236      //G4cout <<"theeplusBremsstrahlung" << theeplusBremsstrahlung <<endl;
237
238    } else if( particleName == "mu+" || 
239               particleName == "mu-"    ) {
240    //muon 
241     // Construct processes for muon+
242     G4VProcess* aMultipleScattering = new G4MuMultipleScattering();
243     G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
244     G4VProcess* aPairProduction = new G4MuPairProduction();
245     G4VProcess* anIonisation = new G4MuIonisation();
246      // add processes
247     pmanager->AddProcess(anIonisation);
248     pmanager->AddProcess(aMultipleScattering);
249     pmanager->AddProcess(aBremsstrahlung);
250     pmanager->AddProcess(aPairProduction);
251     // set ordering for AlongStepDoIt
252     pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
253     pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
254     // set ordering for PostStepDoIt
255     pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
256     pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
257     pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
258     pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
259     
260   } else if ((!particle->IsShortLived()) &&
261              (particle->GetPDGCharge() != 0.0) && 
262              (particle->GetParticleName() != "chargedgeantino")) {
263     // all others charged particles except geantino
264     G4VProcess* aMultipleScattering = new G4hMultipleScattering();
265     G4VProcess* anIonisation = new G4hIonisation();
266     // add processes
267     pmanager->AddProcess(anIonisation);
268     pmanager->AddProcess(aMultipleScattering);
269     // set ordering for AlongStepDoIt
270     pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
271     pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
272     // set ordering for PostStepDoIt
273     pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
274     pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
275    }
276  }
277}
278
279
280#include "G4Decay.hh"
281void ExGflashPhysicsList::ConstructGeneral()
282{
283  // Add Decay Process
284  G4Decay* theDecayProcess = new G4Decay();
285  //G4cout << "decay" <<theDecayProcess<<endl;
286  theParticleIterator->reset();
287  while( (*theParticleIterator)() ){
288    G4ParticleDefinition* particle = theParticleIterator->value();
289    G4ProcessManager* pmanager = particle->GetProcessManager();
290    if (theDecayProcess->IsApplicable(*particle)) { 
291      pmanager ->AddProcess(theDecayProcess);
292      // set ordering for PostStepDoIt and AtRestDoIt
293      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
294      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
295    }
296  } 
297}
298
299//  WARNING: This methode is mandatory if U want to use GFLASH
300void ExGflashPhysicsList::AddParameterisation()
301{
302  G4FastSimulationManagerProcess* 
303    theFastSimulationManagerProcess = 
304      new G4FastSimulationManagerProcess();
305  G4cout << "FastSimulationManagerProcess" <<endl;
306  theParticleIterator->reset();
307  //std::cout<<"---"<<std::endl;
308  while( (*theParticleIterator)() ){
309    //std::cout<<"+++"<<std::endl;
310 
311    G4ParticleDefinition* particle = theParticleIterator->value();
312    // std::cout<<"--- particle "<<particle->GetParticleName()<<std::endl;
313    G4ProcessManager* pmanager = particle->GetProcessManager();
314    // The fast simulation process becomes a discrete process only since 9.0:
315    pmanager->AddDiscreteProcess(theFastSimulationManagerProcess);
316  }
317}
318
319void ExGflashPhysicsList::SetCuts()
320{
321  if (verboseLevel >1){
322    G4cout << "ExGflashPhysicsList::SetCuts:";
323  } 
324  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
325  //   the default cut value for all particle types
326  DumpCutValuesTable();
327   SetCutsWithDefault();
328   //  SetCutValue(100*mm, "gamma");
329//   SetCutValue(0*mm, "e-");
330//   SetCutValue(0*mm, "e+");
331
332//   SetCutValue(62*mm, "gamma");
333//   SetCutValue(0.73*mm, "e-");
334//   SetCutValue(0.78*mm, "e+");
335
336
337
338 
339 
340  DumpCutValuesTable();
341// set cuts for region crystals with default Cuts
342  G4Region* region = G4RegionStore::GetInstance()->GetRegion("crystals");
343  region->SetProductionCuts(
344          G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
345}
346
347
348
349
350
351
352
353
354
Note: See TracBrowser for help on using the repository browser.