-
Notifications
You must be signed in to change notification settings - Fork 1
/
PhysicsList.cc
479 lines (399 loc) · 17.3 KB
/
PhysicsList.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
//Include the prototypes of the members
#include "PhysicsList.hh"
#include "globals.hh"
//units
#include "G4SystemOfUnits.hh"
//Manages all the processes that you active/allow to happen
#include "G4ProcessManager.hh"
//the list of all particle types in Geant4
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4LeptonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4GenericIon.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
#include "G4OpticalPhoton.hh"
//the list of processes
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4VProcess.hh"
#include "G4EmStandardPhysics.hh"//Electromagnetic physics methods
#include "G4PhotoElectricEffect.hh"
#include "G4ComptonScattering.hh"
#include "G4RayleighScattering.hh"
#include "G4CoulombScattering.hh"
#include "G4GammaConversionToMuons.hh"
#include "G4GammaConversion.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4ionIonisation.hh"
#include "G4NuclearStopping.hh"
#include "G4IonParametrisedLossModel.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4OpAbsorption.hh"
#include "G4OpRayleigh.hh"
#include "G4Decay.hh"
#include "G4SynchrotronRadiation.hh"
#include "G4Cerenkov.hh"
#include "G4Scintillation.hh"
#include "G4EmSaturation.hh"
//Helper and options
#include "G4PhysicsListHelper.hh"
#include "G4PhysicsListOrderingParameter.hh"
#include "G4EmProcessOptions.hh"
#include "G4LossTableManager.hh"//IDK what loss table man does
#include "SteppingAction.hh"
#include "G4Step.hh"
//Constructor
//two mandatory virtual methods must be implemented: ConstructParticle() and ConstructProcess()
PhysicsList::PhysicsList(SteppingAction *stepp):G4VUserPhysicsList(), fstep(stepp)
{
ConstructParticle();
ConstructProcess();
//Set the Cut value to 0.1 micrometers this item is in the G4VUserPhysicsList so it is inherited
defaultCutValue = 0.1*um;
SetVerboseLevel(1);//0:silent. 1:only the valid commands are shown. 2:comment lines are also shown (default).
// Only allow EM physics.
//emPhysicsList = new G4EmStandardPhysics();//Lo comento, luego no se usa
}
//Generic Destructor
PhysicsList::~PhysicsList() {}
void PhysicsList::ConstructParticle()
{
//IMPORTANT: we must define ALL particles ussed in our application, not only primary particles (also secondaries
//created by physical processes)
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
ConstructIons();
ConstructNuclei();
}
void PhysicsList::ConstructBosons()//photons, phonons, bosons W and Z, gluons, Higgs. We only need photons.
{
// gamma and optical photon
G4Gamma::GammaDefinition();
G4OpticalPhoton::OpticalPhotonDefinition();
}
void PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4KaonZero::KaonZeroDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
}
void PhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
void PhysicsList::ConstructIons()
{
// ions
G4IonConstructor iConstructor;
iConstructor.ConstructParticle();
G4GenericIon::GenericIonDefinition();
}
void PhysicsList::ConstructNuclei()
{
G4Deuteron::Deuteron();
G4Triton::Triton();
G4He3::He3();
G4Alpha::Alpha();
}
// This is required to specify which physical processes you want to simulate
void PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructGeneral();
ConstructEM();
ConstructOp();
ConstructScintillation();
SetCuts();
}
void PhysicsList::ConstructEM()
{
//Activate atomic deexcitation
G4EmProcessOptions* theParameters = new G4EmProcessOptions();
theParameters -> SetFluo(true);
theParameters -> SetAuger(true);
theParameters -> SetPIXE(true);
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
// G4PhysicsListHelper* plhelper = G4PhysicsListHelper::GetPhysicsListHelper(); //Get pointer to G4PhysicsListHelper
if (particleName == "gamma"){// gamma
// Construct processes for gamma
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4RayleighScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
pmanager->AddDiscreteProcess(new G4GammaConversionToMuons());
/*
plhelper->RegisterProcess(new G4GammaConversion(), particle);
plhelper->RegisterProcess(new G4ComptonScattering(), particle);
plhelper->RegisterProcess(new G4RayleighScattering(), particle);
plhelper->RegisterProcess(new G4PhotoElectricEffect(), particle);
plhelper->RegisterProcess(new G4GammaConversionToMuons(), particle);
*/
}
else if (particleName == "e-"){//electron
// Construct processes for electron
pmanager->AddProcess(new G4eMultipleScattering(),-1,1,1); // only elastic scattering.
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,3,3);///OJO, en varios -1, -3, 3; en otros cmo está aquí, otros -1, .1 ,3
pmanager->AddProcess(new G4CoulombScattering());
/*
plhelper->RegisterProcess(new G4eMultipleScattering(), particle);
plhelper->RegisterProcess(new G4eIonisation(), particle);
plhelper->RegisterProcess(new G4eBremsstrahlung(), particle);
plhelper->RegisterProcess(new G4CoulombScattering(), particle);
*/
G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov");
if (theCerenkovProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theCerenkovProcess);
pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
}
}
else if (particleName == "e+") {//positron
// Construct processes for positron
pmanager->AddProcess(new G4eMultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,3,3);///OJO, en varios -1, -3, 3; en otros cmo está aquí, otros -1, -1 ,3
pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);//Positron annihilation into two gammas
pmanager->AddProcess(new G4CoulombScattering());
/*
plhelper->RegisterProcess(new G4eMultipleScattering(), particle);
plhelper->RegisterProcess(new G4eIonisation(), particle);
plhelper->RegisterProcess(new G4eBremsstrahlung(), particle);
plhelper->RegisterProcess(new G4eplusAnnihilation(), particle);
plhelper->RegisterProcess(new G4CoulombScattering(), particle);
*/
G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov");
if (theCerenkovProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theCerenkovProcess);
pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
}
}
else if(particleName == "mu+" || particleName == "mu-") {//muon
// Construct processes for muon
pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,3,3);///OJO, en otros -1, -1, 3
pmanager->AddProcess(new G4MuPairProduction(),-1,4,4);///OJO, en otros -1, -1, 4
/*
plhelper->RegisterProcess(new G4MuMultipleScattering(), particle);
plhelper->RegisterProcess(new G4MuIonisation(), particle);
plhelper->RegisterProcess(new G4MuBremsstrahlung(), particle);
plhelper->RegisterProcess(new G4MuPairProduction(), particle);
*/
G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov");
//DUDA: diferencia entre esto y hacer directamentepmanager->AddProcess(new G4Cerenkov())????
if (theCerenkovProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theCerenkovProcess);
pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
}
}
else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
/*
plhelper->RegisterProcess(new G4hMultipleScattering, particle);
plhelper->RegisterProcess(new G4hIonisation, particle);
*/
}
}//end while
}//end PhysicsList::ConstructEM()
void PhysicsList::ConstructOp()
{
theParticleIterator->reset();
while( (*(theParticleIterator))() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
/*
if (particleName == "opticalphoton") {
pmanager->AddProcess(new G4OpBoundaryProcess());
pmanager->AddProcess(new G4OpAbsorption());
pmanager->AddProcess(new G4OpRayleigh());
}
*/
if (particleName == "opticalphoton") {
//http://geant4.cern.ch/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html/TrackingAndPhysics/physicsProcess.html (ver 5.2.5)
pmanager->AddDiscreteProcess(new G4OpAbsorption());//In output it is indicated as OpAbsorption. In DetectorConstruction.cc material abosoption length needs to be indicated.
pmanager->AddDiscreteProcess(new G4OpRayleigh());//no Rayleigh scattering attenutation length specified by the user, the program automatically calls the RayleighAttenuationLengthGenerator
// 24/10/2016 pmanager->AddProcess(new G4OpBoundaryProcess());
pmanager->AddDiscreteProcess(new G4OpBoundaryProcess());
}
/*
G4PhysicsListHelper* helper = G4PhysicsListHelper::GetPhysicsListHelper();
helper->RegisterProcess(new G4OpBoundaryProcess(), OpPhoton);
helper->RegisterProcess(new G4OpAbsorption(), OpPhoton);
helper->RegisterProcess(new G4OpRayleigh(), OpPhoton);
*/
}//end while
}
void PhysicsList::ConstructGeneral()//Aquí inlcuyo el decay y protón, alpha, ion.
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager->AddDiscreteProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
//G4PhysicsListHelper* plhelper = G4PhysicsListHelper::GetPhysicsListHelper(); //Get pointer to G4PhysicsListHelper
if( particleName == "proton" ||
particleName == "pi-" ||
particleName == "pi+" ) {
//proton
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3);
pmanager->AddProcess(new G4hPairProduction, -1, 4, 4);
/*
plhelper->RegisterProcess(new G4hMultipleScattering, particle);
plhelper->RegisterProcess(new G4hIonisation, particle);
plhelper->RegisterProcess(new G4hBremsstrahlung, particle);
plhelper->RegisterProcess(new G4hPairProduction, particle);
*/
}
else if( particleName == "alpha" ||
particleName == "He3" ) {
//alpha and He3
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
pmanager->AddProcess(new G4NuclearStopping, -1, 3,-1);
/* plhelper->RegisterProcess(new G4hMultipleScattering, particle);
plhelper->RegisterProcess(new G4ionIonisation, particle);
plhelper->RegisterProcess(new G4NuclearStopping, particle);
*/
}
else if( particleName == "GenericIon" ) {
//Ions
//de esta forma es necesario descomentar la definición de pmanager arriba.
G4ionIonisation* ionIoni = new G4ionIonisation();
ionIoni->SetEmModel(new G4IonParametrisedLossModel());
pmanager->AddProcess(ionIoni, -1, 2, 2);
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4NuclearStopping, -1, 3,-1);
/*
plhelper->RegisterProcess(new G4hMultipleScattering, particle);
plhelper->RegisterProcess(new G4ionIonisation, particle);
plhelper->RegisterProcess(new G4NuclearStopping, particle);
*/
}
//Añado aquí también para que al resto le tenga en cuenta estos procesos
else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
/*
plhelper->RegisterProcess(new G4hMultipleScattering, particle);
plhelper->RegisterProcess(new G4hIonisation, particle);
*/
}
else if (particle->GetParticleName() == "chargedgeantino") { // OK, no sale ninguno
G4cout << G4endl << "hay chargedgeantino ? " << particle->GetParticleName() << G4endl << G4endl;
}
}//end while
}//end ConstructGeneral
void PhysicsList::ConstructScintillation()
{
//G4bool theScintProcessDefNeverUsed = true;
G4Scintillation* Scint = new G4Scintillation("Scintillation");
Scint->SetTrackSecondariesFirst(true);
//allows for different scintillation yields depending on the particle type – in such case, separate scintillation processes must be attached to the various particles. http://hypernews.slac.stanford.edu/HyperNews/geant4/get/opticalphotons/389/1.html
//ExcitationRatio = 1.0; is the default, where the ratio is the intensity of fast component to the total scintillation intensity . http://hypernews.slac.stanford.edu/HyperNews/geant4/get/opticalphotons/219.html
Scint->SetScintillationYieldFactor(1.);
Scint->SetScintillationExcitationRatio(1.);
//Use Birks Correction in the Scintillation process.
G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
Scint->AddSaturation(emSaturation);
Scint->SetVerboseLevel(1);
theParticleIterator->reset();
while ((*theParticleIterator)()) {
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (Scint->IsApplicable(*particle)){
//CONTINUO SIN PROCESSORDERING NO CENTELLEA. CON LAS DOS LÍNEAS, CONTINUO Y DISCRETO ES IGUAL. EN DISCRETO SIN LAS DOS LINEAS SALEN MENOS PARTICULAS PERO LA DIFERENCIA ES ÍNFIMA
pmanager->AddDiscreteProcess(Scint);
//pmanager->AddProcess(Scint);
pmanager->SetProcessOrderingToLast(Scint, idxAtRest);
pmanager->SetProcessOrderingToLast(Scint, idxPostStep);
}
}
/*
G4Scintillation* Scint = new G4Scintillation("Scintillation");
Scint->SetTrackSecondariesFirst(true);
G4PhysicsListHelper* helper = G4PhysicsListHelper::GetPhysicsListHelper();
theParticleIterator->reset();
while ((*theParticleIterator)()) {
G4ParticleDefinition* particle = theParticleIterator->value();
if (Scint->IsApplicable(*particle))helper->RegisterProcess(Scint, particle);
}
*/
}
void PhysicsList::SetCuts() //to avoid infrared divergence, threshold below no secondary are generated
{
//G4VUserPhysicsList::SetCutsWithDefault method sets the default cut value for all particle types
SetCutsWithDefault();
// set cut values for gamma at first and for e- second and next for e+, because some processes for e+/e- need cut values for gamma
//SetCutValue(defaultCutValue, "gamma");
//SetCutValue(defaultCutValue, "e-");
//SetCutValue(defaultCutValue, "e+");
if(verboseLevel>0) DumpCutValuesTable(); //Request to print out information of cut values
}