Geant4  10.01.p03
OpNovicePhysicsList.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 //
27 //
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 
31 #include "globals.hh"
32 #include "OpNovicePhysicsList.hh"
34 
35 #include "G4ParticleDefinition.hh"
36 #include "G4ParticleTypes.hh"
37 #include "G4ParticleTable.hh"
38 
39 #include "G4BosonConstructor.hh"
40 #include "G4LeptonConstructor.hh"
41 #include "G4MesonConstructor.hh"
42 #include "G4BaryonConstructor.hh"
43 #include "G4IonConstructor.hh"
45 
46 #include "G4ProcessManager.hh"
47 
48 #include "G4Cerenkov.hh"
49 #include "G4Scintillation.hh"
50 #include "G4OpAbsorption.hh"
51 #include "G4OpRayleigh.hh"
52 #include "G4OpMieHG.hh"
53 #include "G4OpBoundaryProcess.hh"
54 
55 #include "G4LossTableManager.hh"
56 #include "G4EmSaturation.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
62  fVerboseLebel(1), fMaxNumPhotonStep(20)
63 {
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
74 {
75  // In this method, static member functions should be called
76  // for all particles which you want to use.
77  // This ensures that objects of these particle types will be
78  // created in the program.
79 
80  G4BosonConstructor bConstructor;
81  bConstructor.ConstructParticle();
82 
83  G4LeptonConstructor lConstructor;
84  lConstructor.ConstructParticle();
85 
86  G4MesonConstructor mConstructor;
87  mConstructor.ConstructParticle();
88 
89  G4BaryonConstructor rConstructor;
90  rConstructor.ConstructParticle();
91 
92  G4IonConstructor iConstructor;
93  iConstructor.ConstructParticle();
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
101  ConstructDecay();
102  ConstructEM();
103  ConstructOp();
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107 
108 #include "G4Decay.hh"
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
113 {
114  // Add Decay Process
115  G4Decay* theDecayProcess = new G4Decay();
116  theParticleIterator->reset();
117  while( (*theParticleIterator)() ){
118  G4ParticleDefinition* particle = theParticleIterator->value();
119  G4ProcessManager* pmanager = particle->GetProcessManager();
120  if (theDecayProcess->IsApplicable(*particle)) {
121  pmanager ->AddProcess(theDecayProcess);
122  // set ordering for PostStepDoIt and AtRestDoIt
123  pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
124  pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
125  }
126  }
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130 
131 #include "G4ComptonScattering.hh"
132 #include "G4GammaConversion.hh"
133 #include "G4PhotoElectricEffect.hh"
134 
135 #include "G4eMultipleScattering.hh"
136 #include "G4MuMultipleScattering.hh"
137 #include "G4hMultipleScattering.hh"
138 
139 #include "G4eIonisation.hh"
140 #include "G4eBremsstrahlung.hh"
141 #include "G4eplusAnnihilation.hh"
142 
143 #include "G4MuIonisation.hh"
144 #include "G4MuBremsstrahlung.hh"
145 #include "G4MuPairProduction.hh"
146 
147 #include "G4hIonisation.hh"
148 
149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
150 
152 {
153  theParticleIterator->reset();
154  while( (*theParticleIterator)() ){
155  G4ParticleDefinition* particle = theParticleIterator->value();
156  G4ProcessManager* pmanager = particle->GetProcessManager();
157  G4String particleName = particle->GetParticleName();
158 
159  if (particleName == "gamma") {
160  // gamma
161  // Construct processes for gamma
162  pmanager->AddDiscreteProcess(new G4GammaConversion());
163  pmanager->AddDiscreteProcess(new G4ComptonScattering());
164  pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
165 
166  } else if (particleName == "e-") {
167  //electron
168  // Construct processes for electron
169  pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
170  pmanager->AddProcess(new G4eIonisation(), -1, 2, 2);
171  pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3, 3);
172 
173  } else if (particleName == "e+") {
174  //positron
175  // Construct processes for positron
176  pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
177  pmanager->AddProcess(new G4eIonisation(), -1, 2, 2);
178  pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3, 3);
179  pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1, 4);
180 
181  } else if( particleName == "mu+" ||
182  particleName == "mu-" ) {
183  //muon
184  // Construct processes for muon
185  pmanager->AddProcess(new G4MuMultipleScattering(),-1, 1, 1);
186  pmanager->AddProcess(new G4MuIonisation(), -1, 2, 2);
187  pmanager->AddProcess(new G4MuBremsstrahlung(), -1, 3, 3);
188  pmanager->AddProcess(new G4MuPairProduction(), -1, 4, 4);
189 
190  } else {
191  if ((particle->GetPDGCharge() != 0.0) &&
192  (particle->GetParticleName() != "chargedgeantino") &&
193  !particle->IsShortLived()) {
194  // all others charged particles except geantino
195  pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
196  pmanager->AddProcess(new G4hIonisation(), -1,2,2);
197  }
198  }
199  }
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
203 #include "G4Threading.hh"
204 
206 {
207  G4Cerenkov* cerenkovProcess = new G4Cerenkov("Cerenkov");
208  cerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotonStep);
209  cerenkovProcess->SetMaxBetaChangePerStep(10.0);
210  cerenkovProcess->SetTrackSecondariesFirst(true);
211  G4Scintillation* scintillationProcess = new G4Scintillation("Scintillation");
212  scintillationProcess->SetScintillationYieldFactor(1.);
213  scintillationProcess->SetTrackSecondariesFirst(true);
214  G4OpAbsorption* absorptionProcess = new G4OpAbsorption();
215  G4OpRayleigh* rayleighScatteringProcess = new G4OpRayleigh();
216  G4OpMieHG* mieHGScatteringProcess = new G4OpMieHG();
217  G4OpBoundaryProcess* boundaryProcess = new G4OpBoundaryProcess();
218 
219  cerenkovProcess->SetVerboseLevel(fVerboseLebel);
220  scintillationProcess->SetVerboseLevel(fVerboseLebel);
221  absorptionProcess->SetVerboseLevel(fVerboseLebel);
222  rayleighScatteringProcess->SetVerboseLevel(fVerboseLebel);
223  mieHGScatteringProcess->SetVerboseLevel(fVerboseLebel);
224  boundaryProcess->SetVerboseLevel(fVerboseLebel);
225 
226  // Use Birks Correction in the Scintillation process
228  {
229  G4EmSaturation* emSaturation =
231  scintillationProcess->AddSaturation(emSaturation);
232  }
233 
234  theParticleIterator->reset();
235  while( (*theParticleIterator)() ){
236  G4ParticleDefinition* particle = theParticleIterator->value();
237  G4ProcessManager* pmanager = particle->GetProcessManager();
238  G4String particleName = particle->GetParticleName();
239  if (cerenkovProcess->IsApplicable(*particle)) {
240  pmanager->AddProcess(cerenkovProcess);
241  pmanager->SetProcessOrdering(cerenkovProcess,idxPostStep);
242  }
243  if (scintillationProcess->IsApplicable(*particle)) {
244  pmanager->AddProcess(scintillationProcess);
245  pmanager->SetProcessOrderingToLast(scintillationProcess, idxAtRest);
246  pmanager->SetProcessOrderingToLast(scintillationProcess, idxPostStep);
247  }
248  if (particleName == "opticalphoton") {
249  G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
250  pmanager->AddDiscreteProcess(absorptionProcess);
251  pmanager->AddDiscreteProcess(rayleighScatteringProcess);
252  pmanager->AddDiscreteProcess(mieHGScatteringProcess);
253  pmanager->AddDiscreteProcess(boundaryProcess);
254  }
255  }
256 }
257 
258 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
259 
261 {
262  fVerboseLebel = verbose;
263 }
264 
265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
266 
268 {
269  fMaxNumPhotonStep = MaxNumber;
270 }
271 
272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
273 
275 {
276  // " G4VUserPhysicsList::SetCutsWithDefault" method sets
277  // the default cut value for all particle types
278  //
280 
282 }
283 
284 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetMaxBetaChangePerStep(const G4double d)
Definition: G4Cerenkov.cc:151
static G4LossTableManager * Instance()
void SetNbOfPhotonsCerenkov(G4int)
virtual void ConstructProcess()
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.cc:146
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
static void ConstructParticle()
static void ConstructParticle()
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
static void ConstructParticle()
OpNovicePhysicsListMessenger * fMessenger
void SetScintillationYieldFactor(const G4double yieldfactor)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
static void ConstructParticle()
void AddSaturation(G4EmSaturation *)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4EmSaturation * EmSaturation()
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.cc:156
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
static void ConstructParticle()
G4bool IsWorkerThread()
Definition: G4Threading.cc:128
void SetTrackSecondariesFirst(const G4bool state)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
virtual void ConstructParticle()
#define G4endl
Definition: G4ios.hh:61
G4double GetPDGCharge() const
#define theParticleIterator
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4Cerenkov.cc:135