Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GammaGeneralProcess.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//
29// GEANT4 Class file
30//
31//
32// File name: G4GammaGeneralProcess
33//
34// Author: Vladimir Ivanchenko
35//
36// Creation date: 19.07.2018
37//
38// Modifications:
39//
40// Class Description:
41//
42
43// -------------------------------------------------------------------
44//
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47
49#include "G4VDiscreteProcess.hh"
51#include "G4SystemOfUnits.hh"
52#include "G4ProcessManager.hh"
54#include "G4LossTableBuilder.hh"
55#include "G4HadronicProcess.hh"
56#include "G4LossTableManager.hh"
57#include "G4Step.hh"
58#include "G4Track.hh"
60#include "G4DataVector.hh"
61#include "G4PhysicsTable.hh"
62#include "G4PhysicsLogVector.hh"
64#include "G4VParticleChange.hh"
66#include "G4EmParameters.hh"
67#include "G4EmProcessSubType.hh"
68#include "G4Material.hh"
71
72#include "G4Log.hh"
73#include <iostream>
74
75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
76
77G4EmDataHandler* G4GammaGeneralProcess::theHandler = nullptr;
78G4bool G4GammaGeneralProcess::theT[nTables] =
79 {true,false,true,true,false,false,true,true,true,
80 false,true,true,true,false,false};
81G4String G4GammaGeneralProcess::nameT[nTables] =
82 {"0","1","2","3","4","5","6","7","8",
83 "9","10","11","12","13","14"};
84
86 G4VEmProcess("GammaGeneralProc", fElectromagnetic),
87 minPEEnergy(50*CLHEP::keV),
88 minEEEnergy(2*CLHEP::electron_mass_c2),
89 minMMEnergy(100*CLHEP::MeV),
90 peLambda(0.0),
91 nLowE(40),
92 nHighE(50),
93 splineFlag(false)
94{
95 thePhotoElectric = theCompton = theConversionEE = theRayleigh = nullptr;
96 theGammaNuclear = nullptr;
97 theConversionMM = nullptr;
98 selectedProc = nullptr;
99
100 idxEnergy = 0;
101 preStepLogE = factor = 1.0;
102
106}
107
108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
109
111{
112 //std::cout << "G4GammaGeneralProcess::~G4GammaGeneralProcess " << isTheMaster
113 // << " " << theHandler << G4endl;
114 if(isTheMaster) {
115 delete theHandler;
116 theHandler = nullptr;
117 }
118}
119
120//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
121
123{
124 return true;
125}
126
127//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
128
130{
131 if(!ptr) { return; }
132 G4int stype = ptr->GetProcessSubType();
133 if(stype == fRayleigh) { theRayleigh = ptr; }
134 else if(stype == fPhotoElectricEffect) { thePhotoElectric = ptr; }
135 else if(stype == fComptonScattering) { theCompton = ptr; }
136 else if(stype == fGammaConversion) { theConversionEE = ptr; }
137}
138
139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
140
142{
143 theConversionMM = ptr;
144}
145
146//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
147
149{
150 theGammaNuclear = ptr;
151}
152
153//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
154
156{
157 SetParticle(&part);
158 currentCouple = nullptr;
159 currentMaterial = nullptr;
160 preStepLambda = 0.0;
161 idxEnergy = 0;
162
166
167 if(1 < verboseLevel) {
168 G4cout << "G4GammaGeneralProcess::PreparePhysicsTable() for "
169 << GetProcessName()
170 << " and particle " << part.GetParticleName()
171 << " isMaster: " << isTheMaster << G4endl;
172 }
173
174 if(thePhotoElectric) { thePhotoElectric->PreparePhysicsTable(part); }
175 if(theCompton) { theCompton->PreparePhysicsTable(part); }
176 if(theConversionEE) { theConversionEE->PreparePhysicsTable(part); }
177 if(theRayleigh) { theRayleigh->PreparePhysicsTable(part); }
179 if(theConversionMM) { theConversionMM->PreparePhysicsTable(part); }
180
181 InitialiseProcess(&part);
182}
183
184//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
185
187{
188 if(isTheMaster) {
189
190 // tables are created and its size is defined only once
191 if(!theHandler) {
192 theHandler = new G4EmDataHandler(nTables);
193 if(theRayleigh) { theT[1] = theT[4] = true; }
194 if(theGammaNuclear) { theT[9] = theT[13] = true; }
195 if(theConversionMM) { theT[14] = true; }
196
197 theHandler->SetMasterProcess(thePhotoElectric);
198 theHandler->SetMasterProcess(theCompton);
199 theHandler->SetMasterProcess(theConversionEE);
200 theHandler->SetMasterProcess(theRayleigh);
201 }
202 auto bld = lManager->GetTableBuilder();
203
204 const G4ProductionCutsTable* theCoupleTable=
206 size_t numOfCouples = theCoupleTable->GetTableSize();
207
211 size_t nbin1 = std::max(5, nd*G4lrint(std::log10(minPEEnergy/mine)));
212 size_t nbin2 = std::max(5, nd*G4lrint(std::log10(maxe/minMMEnergy)));
213
214 G4PhysicsVector* vec = nullptr;
215 G4PhysicsLogVector aVector(mine,minPEEnergy,nbin1);
216 G4PhysicsLogVector bVector(minPEEnergy,minEEEnergy,nLowE);
217 G4PhysicsLogVector cVector(minEEEnergy,minMMEnergy,nHighE);
218 G4PhysicsLogVector dVector(minMMEnergy,maxe,nbin2);
219 if(splineFlag) {
220 aVector.SetSpline(splineFlag);
221 bVector.SetSpline(splineFlag);
222 cVector.SetSpline(splineFlag);
223 dVector.SetSpline(splineFlag);
224 }
225
226 for(size_t i=0; i<nTables; ++i) {
227 //G4cout << "## PreparePhysTable " << i << "." << G4endl;
228 if(theT[i]) {
229 G4PhysicsTable* table = theHandler->MakeTable(i);
230 //G4cout << " make table " << table << G4endl;
231 for(size_t j=0; j<numOfCouples; ++j) {
232 vec = (*table)[j];
233 if (bld->GetFlag(j) && !vec) {
234 //G4cout << " i= " << i << " j= " << j << " make new vector" << G4endl;
235 if(i<=1) {
236 vec = new G4PhysicsVector(aVector);
237 } else if(i<=5) {
238 vec = new G4PhysicsVector(bVector);
239 } else if(i<=9) {
240 vec = new G4PhysicsVector(cVector);
241 } else {
242 vec = new G4PhysicsVector(dVector);
243 }
245 }
246 }
247 }
248 }
249 }
250}
251
252//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
253
255{
256 if(1 < verboseLevel) {
257 G4cout << "### G4VEmProcess::BuildPhysicsTable() for "
258 << GetProcessName()
259 << " and particle " << part.GetParticleName()
260 << G4endl;
261 }
262 if(thePhotoElectric != nullptr) {
263 if(!isTheMaster) {
264 thePhotoElectric->SetEmMasterProcess(theHandler->GetMasterProcess(0));
265 }
266 thePhotoElectric->BuildPhysicsTable(part);
267 }
268 if(theCompton != nullptr) {
269 if(!isTheMaster) {
270 theCompton->SetEmMasterProcess(theHandler->GetMasterProcess(1));
271 }
272 theCompton->BuildPhysicsTable(part);
273 }
274 if(theConversionEE != nullptr) {
275 if(!isTheMaster) {
276 theConversionEE->SetEmMasterProcess(theHandler->GetMasterProcess(2));
277 }
278 theConversionEE->BuildPhysicsTable(part);
279 }
280 if(theRayleigh != nullptr) {
281 if(!isTheMaster) {
282 theRayleigh->SetEmMasterProcess(theHandler->GetMasterProcess(3));
283 }
284 theRayleigh->BuildPhysicsTable(part);
285 }
286 if(theGammaNuclear != nullptr) { theGammaNuclear->BuildPhysicsTable(part); }
287 if(theConversionMM != nullptr) { theConversionMM->BuildPhysicsTable(part); }
288
289 if(isTheMaster) {
290 const G4ProductionCutsTable* theCoupleTable=
292 size_t numOfCouples = theCoupleTable->GetTableSize();
293
295 const std::vector<G4PhysicsTable*>& tables = theHandler->GetTables();
296
299 G4DynamicParticle* dynParticle =
301
302 G4double sigComp(0.), sigPE(0.), sigConv(0.), sigR(0.),
303 sigN(0.), sigM(0.), val(0.);
304
305 for(size_t i=0; i<numOfCouples; ++i) {
306
307 if (bld->GetFlag(i)) {
308
309 G4int idx = (*theDensityIdx)[i];
310 const G4MaterialCutsCouple* couple =
311 theCoupleTable->GetMaterialCutsCouple(i);
312 const G4Material* material = couple->GetMaterial();
313
314 // energy interval 0
315 size_t nn = (*(tables[0]))[idx]->GetVectorLength();
316 if(1 < verboseLevel) {
317 G4cout << "======= Zone 0 ======= N= " << nn
318 << " for " << material->GetName() << G4endl;
319 }
320 for(size_t j=0; j<nn; ++j) {
321 G4double e = (*(tables[0]))[idx]->Energy(j);
322 G4double loge = G4Log(e);
323 sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
324 sigR = (theRayleigh) ? theRayleigh->GetLambda(e, couple, loge) : 0.0;
325 G4double sum = sigComp + sigR;
326 if(1 < verboseLevel) {
327 G4cout << j << ". E= " << e << " xs= " << sum
328 << " compt= " << sigComp << " Rayl= " << sigR << G4endl;
329 }
330 (*(tables[0]))[idx]->PutValue(j, sum);
331 if(theT[1]) {
332 val = (sum > 0.0) ? sigComp/sum : 0.0;
333 (*(tables[1]))[idx]->PutValue(j, val);
334 }
335 }
336
337 // energy interval 1
338 nn = (*(tables[2]))[idx]->GetVectorLength();
339 if(1 < verboseLevel) {
340 G4cout << "======= Zone 1 ======= N= " << nn << G4endl;
341 }
342 for(size_t j=0; j<nn; ++j) {
343 G4double e = (*(tables[2]))[idx]->Energy(j);
344 G4double loge = G4Log(e);
345 sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
346 sigR = (theRayleigh) ? theRayleigh->GetLambda(e, couple, loge) : 0.0;
347 sigPE = (thePhotoElectric)
348 ? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
349 sigN = 0.0;
350 if(gn) {
351 dynParticle->SetKineticEnergy(e);
352 sigN = gn->ComputeCrossSection(dynParticle, material);
353 }
354 G4double sum = sigComp + sigR + sigPE + sigN;
355 if(1 < verboseLevel) {
356 G4cout << j << ". E= " << e << " xs= " << sum
357 << " compt= " << sigComp << " conv= " << sigConv
358 << " PE= " << sigPE << " Rayl= " << sigR
359 << " GN= " << sigN << G4endl;
360 }
361 (*(tables[2]))[idx]->PutValue(j, sum);
362 val = (sum > 0.0) ? sigPE/sum : 0.0;
363 (*(tables[3]))[idx]->PutValue(j, val);
364 if(theT[4]) {
365 val = (sum > 0.0) ? (sigComp + sigPE)/sum : 0.0;
366 (*(tables[4]))[idx]->PutValue(j, val);
367 }
368 if(theT[5]) {
369 val = (sum > 0.0) ? (sigComp + sigPE + sigR)/sum : 0.0;
370 (*(tables[5]))[idx]->PutValue(j, val);
371 }
372 }
373
374 // energy interval 2
375 nn = (*(tables[6]))[idx]->GetVectorLength();
376 if(1 < verboseLevel) {
377 G4cout << "======= Zone 2 ======= N= " << nn << G4endl;
378 }
379 for(size_t j=0; j<nn; ++j) {
380 G4double e = (*(tables[6]))[idx]->Energy(j);
381 G4double loge = G4Log(e);
382 sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
383 sigConv = (theConversionEE)
384 ? theConversionEE->GetLambda(e, couple, loge) : 0.0;
385 sigPE = (thePhotoElectric)
386 ? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
387 sigN = 0.0;
388 if(gn) {
389 dynParticle->SetKineticEnergy(e);
390 sigN = gn->ComputeCrossSection(dynParticle, material);
391 }
392 G4double sum = sigComp + sigConv + sigPE + sigN;
393 if(1 < verboseLevel) {
394 G4cout << j << ". E= " << e << " xs= " << sum
395 << " compt= " << sigComp << " conv= " << sigConv
396 << " PE= " << sigPE
397 << " GN= " << sigN << G4endl;
398 }
399 (*(tables[6]))[idx]->PutValue(j, sum);
400 val = (sum > 0.0) ? sigConv/sum : 0.0;
401 (*(tables[7]))[idx]->PutValue(j, val);
402 val = (sum > 0.0) ? (sigConv + sigComp)/sum : 0.0;
403 (*(tables[8]))[idx]->PutValue(j, val);
404 if(theT[9]) {
405 val = (sum > 0.0) ? (sigConv + sigComp + sigPE)/sum : 0.0;
406 (*(tables[9]))[idx]->PutValue(j, val);
407 }
408 }
409
410 // energy interval 3
411 nn = (*(tables[10]))[idx]->GetVectorLength();
412 if(1 < verboseLevel) {
413 G4cout << "======= Zone 3 ======= N= " << nn
414 << " for " << material->GetName() << G4endl;
415 }
416 for(size_t j=0; j<nn; ++j) {
417 G4double e = (*(tables[10]))[idx]->Energy(j);
418 G4double loge = G4Log(e);
419 sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
420 sigConv = (theConversionEE)
421 ? theConversionEE->GetLambda(e, couple, loge) : 0.0;
422 sigPE = (thePhotoElectric)
423 ? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
424 sigN = 0.0;
425 if(gn) {
426 dynParticle->SetKineticEnergy(e);
427 sigN = gn->ComputeCrossSection(dynParticle, material);
428 }
429 sigM = 0.0;
430 if(theConversionMM) {
431 val = theConversionMM->ComputeMeanFreePath(e, material);
432 sigM = (val < DBL_MAX) ? 1./val : 0.0;
433 }
434 G4double sum = sigComp + sigConv + sigPE + sigN + sigM;
435 if(1 < verboseLevel) {
436 G4cout << j << ". E= " << e << " xs= " << sum
437 << " compt= " << sigComp << " conv= " << sigConv
438 << " PE= " << sigPE
439 << " GN= " << sigN << G4endl;
440 }
441 (*(tables[10]))[idx]->PutValue(j, sum);
442 val = (sum > 0.0) ? 1.0 - sigConv/sum : 1.0;
443 (*(tables[11]))[idx]->PutValue(j, val);
444 val = (sum > 0.0) ? 1.0 - (sigConv + sigComp)/sum : 1.0;
445 (*(tables[12]))[idx]->PutValue(j, val);
446 if(theT[13]) {
447 val = (sum > 0.0) ? 1.0 - (sigConv + sigComp + sigPE)/sum : 1.0;
448 (*(tables[13]))[idx]->PutValue(j, val);
449 }
450 if(theT[14]) {
451 val = (sum > 0.0)
452 ? 1.0 - (sigConv + sigComp + sigPE + sigN)/sum : 1.0;
453 (*(tables[14]))[idx]->PutValue(j, val);
454 }
455 }
456 for(size_t k=0; k<nTables; ++k) {
457 if(theT[k] && splineFlag) {
458 (*(tables[k]))[idx]->FillSecondDerivatives();
459 }
460 }
461 }
462 }
463 delete dynParticle;
464 }
465
466 if(1 < verboseLevel) {
467 G4cout << "### G4VEmProcess::BuildPhysicsTable() done for "
468 << GetProcessName()
469 << " and particle " << part.GetParticleName()
470 << G4endl;
471 }
472}
473
474//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
475
477{
479 currentMaterial = nullptr;
480}
481
482//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
483
485 const G4Track& track,
486 G4double previousStepSize,
488{
490 G4double x = DBL_MAX;
491
492 G4double energy = track.GetKineticEnergy();
494 const G4Material* mat = currentCouple->GetMaterial();
495
496 // compute mean free path
497 if(mat != currentMaterial || energy != preStepKinEnergy) {
499 basedCoupleIndex = (*theDensityIdx)[currentCoupleIndex];
500 factor = (*theDensityFactor)[currentCoupleIndex];
501 currentMaterial = mat;
502 preStepKinEnergy = energy;
503 preStepLogE = track.GetDynamicParticle()->GetLogKineticEnergy();
504 preStepLambda = TotalCrossSectionPerVolume();
505
506 // zero cross section
507 if(preStepLambda <= 0.0) {
510 }
511 }
512
513 // non-zero cross section
514 if(preStepLambda > 0.0) {
515
517
518 // beggining of tracking (or just after DoIt of this process)
521
522 } else if(currentInteractionLength < DBL_MAX) {
523
525 previousStepSize/currentInteractionLength;
528 }
529
530 // new mean free path and step limit for the next step
533 }
534 /*
535 G4cout << "PostStepGetPhysicalInteractionLength: e= " << energy
536 << " idxe= " << idxEnergy << " xs= " << preStepLambda
537 << " x= " << x << G4endl;
538 */
539 return x;
540}
541
542//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
543
544G4double G4GammaGeneralProcess::TotalCrossSectionPerVolume()
545{
546 G4double cross = 0.0;
547 /*
548 G4cout << "#Total: " << preStepKinEnergy << " " << minPEEnergy << " "
549 << minEEEnergy << " " << minMMEnergy<< G4endl;
550 G4cout << " idxE= " << idxEnergy
551 << " idxC= " << currentCoupleIndex << G4endl;
552 */
553 if(preStepKinEnergy < minPEEnergy) {
554 cross = ComputeGeneralLambda(0, 0);
555 //G4cout << "XS1: " << cross << G4endl;
556 peLambda = (thePhotoElectric) ? thePhotoElectric
557 ->GetLambda(preStepKinEnergy, currentCouple, preStepLogE) : 0.0;
558 cross += peLambda;
559 //G4cout << "XS2: " << cross << G4endl;
560
561 } else if(preStepKinEnergy < minEEEnergy) {
562 cross = ComputeGeneralLambda(1, 2);
563 //G4cout << "XS3: " << cross << G4endl;
564
565 } else if(preStepKinEnergy < minMMEnergy) {
566 cross = ComputeGeneralLambda(2, 6);
567 //G4cout << "XS4: " << cross << G4endl;
568
569 } else {
570 cross = ComputeGeneralLambda(3, 10);
571 //G4cout << "XS5: " << cross << G4endl;
572 }
573 /*
574 G4cout << "xs= " << cross << " idxE= " << idxEnergy
575 << " idxC= " << currentCoupleIndex
576 << " E= " << energy << G4endl;
577 */
578 return cross;
579}
580
581//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
582
584 const G4Step& step)
585{
586 // In all cases clear number of interaction lengths
588 G4double q = G4UniformRand();
590 G4double p;
591 /*
592 G4cout << "PostStep: preStepLambda= " << preStepLambda << " x= " << x
593 << " PE= " << peLambda << " q= " << q << " idxE= " << idxEnergy
594 << G4endl;
595 */
596 switch (idxEnergy) {
597 case 0:
598 if(x <= peLambda) {
599 return SampleEmSecondaries(track, step, thePhotoElectric);
600 } else {
601 p = GetProbability(1);
602 if(x <= peLambda + (preStepLambda - peLambda)*p) {
603 return SampleEmSecondaries(track, step, theCompton);
604 } else if(theRayleigh != nullptr) {
605 return SampleEmSecondaries(track, step, theRayleigh);
606 }
607 }
608 break;
609
610 case 1:
611 p = GetProbability(3);
612 if(q <= p) {
613 return SampleEmSecondaries(track, step, thePhotoElectric);
614 }
615 p = GetProbability(4);
616 if(q <= p) {
617 return SampleEmSecondaries(track, step, theCompton);
618 }
619 p = GetProbability(5);
620 if(q <= p) {
621 if(theRayleigh != nullptr) {
622 return SampleEmSecondaries(track, step, theRayleigh);
623 }
624 } else if(theGammaNuclear != nullptr) {
625 return SampleHadSecondaries(track, step, theGammaNuclear);
626 }
627 break;
628
629 case 2:
630 p = GetProbability(7);
631 if(q <= p) {
632 return SampleEmSecondaries(track, step, theConversionEE);
633 }
634 p = GetProbability(8);
635 if(q <= p) {
636 return SampleEmSecondaries(track, step, theCompton);
637 }
638 p = GetProbability(9);
639 if(q <= p) {
640 return SampleEmSecondaries(track, step, thePhotoElectric);
641 } else if(theGammaNuclear != nullptr) {
642 return SampleHadSecondaries(track, step, theGammaNuclear);
643 }
644 break;
645
646 case 3:
647 p = 1.0 - GetProbability(11);
648 if(q <= p) {
649 return SampleEmSecondaries(track, step, theConversionEE);
650 }
651 p = 1.0 - GetProbability(12);
652 if(q <= p) {
653 return SampleEmSecondaries(track, step, theCompton);
654 }
655 p = 1.0 - GetProbability(13);
656 if(q <= p) {
657 return SampleEmSecondaries(track, step, thePhotoElectric);
658 }
659 p = 1.0 - GetProbability(14);
660 if(q <= p) {
661 if(theGammaNuclear != nullptr) {
662 return SampleHadSecondaries(track, step, theGammaNuclear);
663 }
664 } else if(theConversionMM != nullptr) {
665 SelectedProcess(step, theConversionMM);
666 return theConversionMM->PostStepDoIt(track, step);
667 }
668 break;
669 }
670 // no interaction
672 return &fParticleChange;
673}
674
675//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
676
678 const G4Track& track, const G4Step& step, G4HadronicProcess* proc)
679{
680 SelectedProcess(step, proc);
682 track.GetMaterial());
683 return proc->PostStepDoIt(track, step);
684}
685
686//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
687
689 const G4String& directory,
690 G4bool ascii)
691{
692 G4bool yes = true;
693 if(!isTheMaster) { return yes; }
694 if(thePhotoElectric != nullptr &&
695 !thePhotoElectric->StorePhysicsTable(part, directory, ascii))
696 { yes = false; }
697 if(theCompton != nullptr &&
698 !theCompton->StorePhysicsTable(part, directory, ascii))
699 { yes = false; }
700 if(theConversionEE != nullptr &&
701 !theConversionEE->StorePhysicsTable(part, directory, ascii))
702 { yes = false; }
703 if(theRayleigh != nullptr &&
704 !theRayleigh->StorePhysicsTable(part, directory, ascii))
705 { yes = false; }
706
707 for(size_t i=0; i<nTables; ++i) {
708 if(theT[i]) {
709 G4String nam = (0==i || 2==i || 6==i || 10==i)
710 ? "LambdaGeneral" + nameT[i] : "ProbGeneral" + nameT[i];
711 G4String fnam = GetPhysicsTableFileName(part,directory,nam,ascii);
712 if(!theHandler->StorePhysicsTable(i, part, fnam, ascii)) { yes = false; }
713 }
714 }
715 return yes;
716}
717
718//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
719
720G4bool
722 const G4String& directory,
723 G4bool ascii)
724{
725 if(1 < verboseLevel) {
726 G4cout << "G4GammaGeneralProcess::RetrievePhysicsTable() for "
727 << part->GetParticleName() << " and process "
728 << GetProcessName() << G4endl;
729 }
730 G4bool yes = true;
731 if(thePhotoElectric != nullptr &&
732 !thePhotoElectric->RetrievePhysicsTable(part, directory, ascii))
733 { yes = false; }
734 if(theCompton != nullptr &&
735 !theCompton->RetrievePhysicsTable(part, directory, ascii))
736 { yes = false; }
737 if(theConversionEE != nullptr &&
738 !theConversionEE->RetrievePhysicsTable(part, directory, ascii))
739 { yes = false; }
740 if(theRayleigh != nullptr &&
741 !theRayleigh->RetrievePhysicsTable(part, directory, ascii))
742 { yes = false; }
743
744 for(size_t i=0; i<nTables; ++i) {
745 if(theT[i]) {
746 G4String nam = (0==i || 2==i || 6==i || 10==i)
747 ? "LambdaGeneral" + nameT[i] : "ProbGeneral" + nameT[i];
748 G4String fnam = GetPhysicsTableFileName(part,directory,nam,ascii);
749 if(!theHandler->RetrievePhysicsTable(i, part, fnam, ascii))
750 { yes = false; }
751 }
752 }
753 return yes;
754}
755
756//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
757
759 G4double,
761{
763 return MeanFreePath(track);
764}
765
766//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
767
768void G4GammaGeneralProcess::ProcessDescription(std::ostream& out) const
769{
770 if(thePhotoElectric) { thePhotoElectric->ProcessDescription(out); }
771 if(theCompton) { theCompton->ProcessDescription(out); }
772 if(theConversionEE) { theConversionEE->ProcessDescription(out); }
773 if(theRayleigh) { theRayleigh->ProcessDescription(out); }
775 if(theConversionMM) { theConversionMM->ProcessDescription(out); }
776}
777
778//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
779
781{
782 //G4cout << "GetProcessName(): " << selectedProc << G4endl;
785}
786
787//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
788
790{
793}
794
795//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
796
798{
799 G4VEmProcess* proc = nullptr;
800 if(thePhotoElectric != nullptr && name == thePhotoElectric->GetProcessName()) {
801 proc = thePhotoElectric;
802 } else if(theCompton != nullptr && name == theCompton->GetProcessName()) {
803 proc = theCompton;
804 } else if(theConversionEE != nullptr && name == theConversionEE->GetProcessName()) {
805 proc = theConversionEE;
806 } else if(theRayleigh != nullptr && name == theRayleigh->GetProcessName()) {
807 proc = theRayleigh;
808 }
809 return proc;
810}
811
812//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@ fGammaGeneralProcess
@ fGammaConversion
@ fRayleigh
@ fComptonScattering
@ fPhotoElectricEffect
G4double condition(const G4ErrorSymMatrix &m)
G4ForceCondition
@ NotForced
G4double G4Log(G4double x)
Definition: G4Log.hh:226
@ fElectromagnetic
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Material *)
G4double GetLogKineticEnergy() const
void SetKineticEnergy(G4double aEnergy)
void SetMasterProcess(const G4VEmProcess *)
G4PhysicsTable * MakeTable(size_t idx)
G4bool RetrievePhysicsTable(size_t idx, const G4ParticleDefinition *part, const G4String &fname, G4bool ascii)
const G4VEmProcess * GetMasterProcess(size_t idx) const
const std::vector< G4PhysicsTable * > & GetTables() const
G4bool StorePhysicsTable(size_t idx, const G4ParticleDefinition *part, const G4String &fname, G4bool ascii)
G4double MinKinEnergy() const
G4int NumberOfBinsPerDecade() const
G4int Verbose() const
G4int WorkerVerbose() const
G4double MaxKinEnergy() const
G4double ComputeMeanFreePath(G4double GammaEnergy, const G4Material *aMaterial)
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
void AddHadProcess(G4HadronicProcess *)
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
G4double GetProbability(size_t idxt)
G4bool IsApplicable(const G4ParticleDefinition &) override
G4VParticleChange * SampleHadSecondaries(const G4Track &, const G4Step &, G4HadronicProcess *)
void AddEmProcess(G4VEmProcess *)
void StartTracking(G4Track *) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
void AddMMProcess(G4GammaConversionToMuons *)
G4double ComputeGeneralLambda(size_t idxe, size_t idxt)
const G4String & GetProcessName() const
void ProcessDescription(std::ostream &outFile) const override
G4VEmProcess * GetEmProcess(const G4String &name) override
void PreparePhysicsTable(const G4ParticleDefinition &) override
void SelectedProcess(const G4Step &track, const G4VProcess *ptr)
void InitialiseProcess(const G4ParticleDefinition *) override
const G4VProcess * selectedProc
G4HadronicProcess * theGammaNuclear
G4VParticleChange * SampleEmSecondaries(const G4Track &, const G4Step &, G4VEmProcess *)
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
static G4Gamma * Gamma()
Definition: G4Gamma.cc:85
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
void ProcessDescription(std::ostream &outFile) const override
void PreparePhysicsTable(const G4ParticleDefinition &) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4CrossSectionDataStore * GetCrossSectionDataStore()
G4bool GetFlag(size_t idx)
G4LossTableBuilder * GetTableBuilder()
const G4Material * GetMaterial() const
const G4String & GetName() const
Definition: G4Material.hh:175
void InitializeForPostStep(const G4Track &)
const G4String & GetParticleName() const
static void SetPhysicsVector(G4PhysicsTable *physTable, std::size_t idx, G4PhysicsVector *vec)
void SetSpline(G4bool)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
Definition: G4Step.hh:62
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double MeanFreePath(const G4Track &track)
G4LossTableManager * lManager
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
G4double preStepLambda
size_t basedCoupleIndex
void SetEmMasterProcess(const G4VEmProcess *)
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
virtual void ProcessDescription(std::ostream &outFile) const override
G4bool isTheMaster
G4EmParameters * theParameters
const G4MaterialCutsCouple * currentCouple
const G4ParticleDefinition * theGamma
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
G4double preStepKinEnergy
size_t currentCoupleIndex
G4double GetLambda(G4double kinEnergy, const G4MaterialCutsCouple *couple)
G4ParticleChangeForGamma fParticleChange
void SetParticle(const G4ParticleDefinition *p)
virtual void PreparePhysicsTable(const G4ParticleDefinition &) override
const G4Material * currentMaterial
G4double currentInteractionLength
Definition: G4VProcess.hh:335
G4double theInitialNumberOfInteractionLength
Definition: G4VProcess.hh:338
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:412
virtual void ProcessDescription(std::ostream &outfile) const
Definition: G4VProcess.cc:175
G4int verboseLevel
Definition: G4VProcess.hh:356
G4double theNumberOfInteractionLengthLeft
Definition: G4VProcess.hh:331
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:406
virtual void PreparePhysicsTable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:194
G4int GetProcessSubType() const
Definition: G4VProcess.hh:400
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
Definition: G4VProcess.cc:182
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382
Definition: DoubConv.h:17
int G4lrint(double ad)
Definition: templates.hh:134
#define DBL_MAX
Definition: templates.hh:62