79G4bool G4GammaGeneralProcess::theT[nTables] =
80 {
true,
false,
true,
true,
true,
false,
true,
true,
true,
81 true,
true,
true,
true,
true,
true};
82G4String G4GammaGeneralProcess::nameT[nTables] =
83 {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
84 "9",
"10",
"11",
"12",
"13",
"14"};
88 minPEEnergy(150*
CLHEP::keV),
89 minEEEnergy(2*
CLHEP::electron_mass_c2),
90 minMMEnergy(100*
CLHEP::MeV)
103 theHandler =
nullptr;
118 if(
nullptr == ptr) {
return; }
120 if(stype ==
fRayleigh) { theRayleigh = ptr; }
130 theConversionMM = ptr;
160 G4cout <<
"G4GammaGeneralProcess::PreparePhysicsTable() for "
167 if(thePhotoElectric ==
nullptr || theCompton ==
nullptr ||
168 theConversionEE ==
nullptr) {
170 ed <<
"### G4GeneralGammaProcess is initialized incorrectly"
171 <<
"\n Photoelectric: " << thePhotoElectric
172 <<
"\n Compton: " << theCompton
173 <<
"\n Conversion: " << theConversionEE;
198 if(
nullptr == theHandler) {
200 if(theRayleigh) { theT[1] =
true; }
211 std::size_t numOfCouples = theCoupleTable->
GetTableSize();
216 std::size_t nbin1 = std::max(5, nd*
G4lrint(std::log10(minPEEnergy/mine)));
217 std::size_t nbin2 = std::max(5, nd*
G4lrint(std::log10(maxe/minMMEnergy)));
225 for(std::size_t i=0; i<nTables; ++i) {
226 if(!theT[i]) {
continue; }
230 for(std::size_t j=0; j<numOfCouples; ++j) {
232 if (bld->GetFlag(j) &&
nullptr == vec) {
255 G4cout <<
"### G4VEmProcess::BuildPhysicsTable() for "
276 if(theRayleigh !=
nullptr) {
291 const std::vector<G4PhysicsTable*>& tables = theHandler->
GetTables();
298 G4double sigComp(0.), sigPE(0.), sigConv(0.), sigR(0.),
299 sigN(0.), sigM(0.), val(0.);
301 for(
G4int i=0; i<numOfCouples; ++i) {
310 std::size_t nn = (*(tables[0]))[idx]->GetVectorLength();
312 G4cout <<
"======= Zone 0 ======= N= " << nn
315 for(std::size_t j=0; j<nn; ++j) {
316 G4double e = (*(tables[0]))[idx]->Energy(j);
318 sigComp = theCompton->
GetLambda(e, couple, loge);
319 sigR = (
nullptr != theRayleigh) ?
320 theRayleigh->
GetLambda(e, couple, loge) : 0.0;
323 G4cout << j <<
". E= " << e <<
" xs= " << sum
324 <<
" compt= " << sigComp <<
" Rayl= " << sigR <<
G4endl;
326 (*(tables[0]))[idx]->PutValue(j, sum);
329 (*(tables[1]))[idx]->PutValue(j, val);
334 nn = (*(tables[2]))[idx]->GetVectorLength();
338 for(std::size_t j=0; j<nn; ++j) {
339 G4double e = (*(tables[2]))[idx]->Energy(j);
341 sigComp = theCompton->
GetLambda(e, couple, loge);
342 sigR = (
nullptr != theRayleigh) ?
343 theRayleigh->
GetLambda(e, couple, loge) : 0.0;
344 sigPE = thePhotoElectric->
GetLambda(e, couple, loge);
345 G4double sum = sigComp + sigR + sigPE;
347 G4cout << j <<
". E= " << e <<
" xs= " << sum
348 <<
" compt= " << sigComp <<
" conv= " << sigConv
349 <<
" PE= " << sigPE <<
" Rayl= " << sigR
350 <<
" GN= " << sigN <<
G4endl;
352 (*(tables[2]))[idx]->PutValue(j, sum);
355 (*(tables[3]))[idx]->PutValue(j, val);
357 val = (sigR > 0.0) ? (sigComp + sigPE)/sum : 1.0;
358 (*(tables[4]))[idx]->PutValue(j, val);
362 nn = (*(tables[6]))[idx]->GetVectorLength();
366 for(std::size_t j=0; j<nn; ++j) {
367 G4double e = (*(tables[6]))[idx]->Energy(j);
369 sigComp = theCompton->
GetLambda(e, couple, loge);
370 sigConv = theConversionEE->
GetLambda(e, couple, loge);
371 sigPE = thePhotoElectric->
GetLambda(e, couple, loge);
377 G4double sum = sigComp + sigConv + sigPE + sigN;
379 G4cout << j <<
". E= " << e <<
" xs= " << sum
380 <<
" compt= " << sigComp <<
" conv= " << sigConv
382 <<
" GN= " << sigN <<
G4endl;
384 (*(tables[6]))[idx]->PutValue(j, sum);
387 (*(tables[7]))[idx]->PutValue(j, val);
389 val = (sigConv + sigComp)/sum;
390 (*(tables[8]))[idx]->PutValue(j, val);
392 val = (sigN > 0.0) ? (sigConv + sigComp + sigPE)/sum : 1.0;
393 (*(tables[9]))[idx]->PutValue(j, val);
397 nn = (*(tables[10]))[idx]->GetVectorLength();
399 G4cout <<
"======= Zone 3 ======= N= " << nn
402 for(std::size_t j=0; j<nn; ++j) {
403 G4double e = (*(tables[10]))[idx]->Energy(j);
405 sigComp = theCompton->
GetLambda(e, couple, loge);
406 sigConv = theConversionEE->
GetLambda(e, couple, loge);
407 sigPE = thePhotoElectric->
GetLambda(e, couple, loge);
414 if(
nullptr != theConversionMM) {
416 sigM = (val <
DBL_MAX) ? 1./val : 0.0;
418 G4double sum = sigComp + sigConv + sigPE + sigN + sigM;
420 G4cout << j <<
". E= " << e <<
" xs= " << sum
421 <<
" compt= " << sigComp <<
" conv= " << sigConv
423 <<
" GN= " << sigN <<
G4endl;
425 (*(tables[10]))[idx]->PutValue(j, sum);
427 val = (sigComp + sigPE + sigN + sigM)/sum;
428 (*(tables[11]))[idx]->PutValue(j, val);
430 val = (sigPE + sigN + sigM)/sum;
431 (*(tables[12]))[idx]->PutValue(j, val);
433 val = (sigN + sigM)/sum;
434 (*(tables[13]))[idx]->PutValue(j, val);
437 (*(tables[14]))[idx]->PutValue(j, val);
439 for(std::size_t k=0; k<nTables; ++k) {
440 if(theT[k] && (k <= 1 || k >= 10)) {
442 (*(tables[k]))[idx]->FillSecondDerivatives();
451 G4cout <<
"### G4VEmProcess::BuildPhysicsTable() done for "
605 }
else if(theRayleigh) {
635 }
else if(theConversionMM) {
675 if(theRayleigh !=
nullptr &&
679 for(std::size_t i=0; i<nTables; ++i) {
681 G4String nam = (0==i || 2==i || 6==i || 10==i)
682 ?
"LambdaGeneral" + nameT[i] :
"ProbGeneral" + nameT[i];
698 G4cout <<
"G4GammaGeneralProcess::RetrievePhysicsTable() for "
709 if(theRayleigh !=
nullptr &&
713 for(std::size_t i=0; i<nTables; ++i) {
715 G4String nam = (0==i || 2==i || 6==i || 10==i)
716 ?
"LambdaGeneral" + nameT[i] :
"ProbGeneral" + nameT[i];
718 G4bool spline = (i <= 1 || i >= 10);
772 proc = thePhotoElectric;
776 proc = theConversionEE;
777 }
else if(theRayleigh !=
nullptr && name == theRayleigh->
GetProcessName()) {
G4double condition(const G4ErrorSymMatrix &m)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Log(G4double x)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
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, G4bool spline)
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)
static G4EmParameters * Instance()
G4double MinKinEnergy() const
G4int NumberOfBinsPerDecade() const
G4int WorkerVerbose() const
G4double MaxKinEnergy() const
G4double ComputeMeanFreePath(G4double GammaEnergy, const G4Material *aMaterial)
void BuildPhysicsTable(const G4ParticleDefinition &) override
void AddHadProcess(G4HadronicProcess *)
void SelectedProcess(const G4Step &step, G4VProcess *ptr)
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
void SelectHadProcess(const G4Track &, const G4Step &, G4HadronicProcess *)
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
G4double GetProbability(size_t idxt)
G4bool IsApplicable(const G4ParticleDefinition &) override
G4VProcess * selectedProc
void AddEmProcess(G4VEmProcess *)
G4int GetSubProcessSubType() const
void StartTracking(G4Track *) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
void AddMMProcess(G4GammaConversionToMuons *)
G4double ComputeGeneralLambda(size_t idxe, size_t idxt)
G4double TotalCrossSectionPerVolume()
void ProcessDescription(std::ostream &outFile) const override
const G4String & GetSubProcessName() const
G4GammaGeneralProcess(const G4String &pname="GammaGeneralProc")
G4VEmProcess * GetEmProcess(const G4String &name) override
void PreparePhysicsTable(const G4ParticleDefinition &) override
~G4GammaGeneralProcess() override
const G4VProcess * GetCreatorProcess() const override
void InitialiseProcess(const G4ParticleDefinition *) override
void SelectEmProcess(const G4Step &, G4VEmProcess *)
G4HadronicProcess * theGammaNuclear
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
void ProcessDescription(std::ostream &outFile) const override
void PreparePhysicsTable(const G4ParticleDefinition &) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4CrossSectionDataStore * GetCrossSectionDataStore()
G4bool GetBaseMaterialFlag()
G4bool GetFlag(size_t idx)
static G4LossTableManager * Instance()
G4LossTableBuilder * GetTableBuilder()
const G4Material * GetMaterial() const
const G4String & GetName() const
void InitializeForPostStep(const G4Track &)
const G4String & GetParticleName() const
static void SetPhysicsVector(G4PhysicsTable *physTable, std::size_t idx, G4PhysicsVector *vec)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double MeanFreePath(const G4Track &track)
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4int DensityIndex(G4int idx) const
void SetEmMasterProcess(const G4VEmProcess *)
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
G4bool UseBaseMaterial() const
void ProcessDescription(std::ostream &outFile) const override
G4double GetLambda(G4double kinEnergy, const G4MaterialCutsCouple *couple, G4double logKinEnergy)
G4double DensityFactor(G4int idx) const
const G4MaterialCutsCouple * currentCouple
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
G4double preStepKinEnergy
size_t currentCoupleIndex
G4ParticleChangeForGamma fParticleChange
void SetParticle(const G4ParticleDefinition *p)
void PreparePhysicsTable(const G4ParticleDefinition &) override
const G4Material * currentMaterial
G4double currentInteractionLength
G4double theInitialNumberOfInteractionLength
void SetVerboseLevel(G4int value)
virtual void ProcessDescription(std::ostream &outfile) const
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4double theNumberOfInteractionLengthLeft
void SetProcessSubType(G4int)
virtual void PreparePhysicsTable(const G4ParticleDefinition &)
G4int GetProcessSubType() const
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
const G4String & GetProcessName() const