92 buildLambdaTable(true),
95 theLambdaTablePrim(0),
100 startFromNull(false),
110 minKinEnergy = 0.1*
keV;
111 maxKinEnergy = 10.0*
TeV;
119 polarAngleLimit = 0.0;
128 secParticles.reserve(5);
147 <<
" " <<
this <<
" " << theLambdaTable <<
G4endl;
152 delete theLambdaTable;
154 if(theLambdaTablePrim) {
156 delete theLambdaTablePrim;
165 void G4VEmProcess::Clear()
186 modelManager->
AddEmModel(order, p, fm, region);
196 G4cout <<
"### G4VEmProcess::SetModel is obsolete method and will be "
197 <<
"removed for the next release." <<
G4endl;
200 G4int n = emModels.size();
201 if(index >= n) {
for(
G4int i=n; i<=
index; ++i) {emModels.push_back(0);} }
210 G4cout <<
"### G4VEmProcess::Model is obsolete method and will be "
211 <<
"removed for the next release." <<
G4endl;
215 if(index >= 0 && index <
G4int(emModels.size())) { p = emModels[
index]; }
223 G4int n = emModels.size();
224 if(index >= n) {
for(
G4int i=n; i<=
index; ++i) {emModels.push_back(0);} }
233 if(index >= 0 && index <
G4int(emModels.size())) { p = emModels[
index]; }
249 return modelManager->
GetModel(idx, ver);
262 if(pname !=
"deuteron" && pname !=
"triton" &&
263 pname !=
"alpha" && pname !=
"He3" &&
264 pname !=
"alpha+" && pname !=
"helium" &&
265 pname !=
"hydrogen") {
272 G4cout <<
"G4VEmProcess::PreparePhysicsTable() for "
284 if(particle == &part) {
292 theEnergyOfCrossSectionMax.resize(n, 0.0);
293 theCrossSectionMax.resize(n,
DBL_MAX);
297 for(
G4int i=0; i<numberOfModels; ++i) {
299 if(0 == i) { currentModel = mod; }
307 theCuts = modelManager->
Initialise(particle,secondaryParticle,
314 if(buildLambdaTable){
319 if(minKinEnergyPrim < maxKinEnergy){
340 G4cout <<
"G4VEmProcess::BuildPhysicsTable() for "
342 <<
" and particle " << num
343 <<
" buildLambdaTable= " << buildLambdaTable
349 if(buildLambdaTable || minKinEnergyPrim < maxKinEnergy) {
356 num ==
"e+" || num ==
"mu+" ||
357 num ==
"mu-" || num ==
"proton"||
358 num ==
"pi+" || num ==
"pi-" ||
359 num ==
"kaon+" || num ==
"kaon-" ||
360 num ==
"alpha" || num ==
"anti_proton" ||
361 num ==
"GenericIon")))
368 G4cout <<
"G4VEmProcess::BuildPhysicsTable() done for "
370 <<
" and particle " << num
377 void G4VEmProcess::BuildLambdaTable()
380 G4cout <<
"G4EmProcess::BuildLambdaTable() for process "
400 if(startFromNull || minKinEnergyPrim < maxKinEnergy ) {
401 scale = std::log(maxKinEnergy/minKinEnergy);
402 if(minKinEnergyPrim < maxKinEnergy) { emax1 = minKinEnergyPrim; }
405 for(
size_t i=0; i<numOfCouples; ++i) {
414 if(buildLambdaTable) {
415 delete (*theLambdaTable)[i];
417 G4bool startNull = startFromNull;
419 if(startFromNull || minKinEnergyPrim < maxKinEnergy) {
421 if(emin < minKinEnergy) {
426 if(emax <= emin) { emax = 2*emin; }
428 G4lrint(nLambdaBins*std::log(emax/emin)/scale);
429 if(bin < 3) { bin = 3; }
433 }
else if(!bVector) {
446 if(minKinEnergyPrim < maxKinEnergy) {
447 delete (*theLambdaTablePrim)[i];
452 G4lrint(nLambdaBins*std::log(maxKinEnergy/minKinEnergyPrim)/scale);
453 if(bin < 3) { bin = 3; }
456 bVectorPrim = aVectorPrim;
470 if(buildLambdaTable) { FindLambdaMax(); }
473 G4cout <<
"Lambda table is built for "
486 if(integral) {
G4cout <<
", integral: 1 "; }
487 if(applyCuts) {
G4cout <<
", applyCuts: 1 "; }
489 if(biasFactor != 1.0) {
G4cout <<
" BiasingFactor= " << biasFactor; }
491 if(buildLambdaTable) {
492 size_t length = theLambdaTable->
length();
493 for(
size_t i=0; i<length; ++i) {
496 G4cout <<
" Lambda table from "
508 if(minKinEnergyPrim < maxKinEnergy) {
509 size_t length = theLambdaTablePrim->
length();
510 for(
size_t i=0; i<length; ++i) {
513 G4cout <<
" LambdaPrime table from "
529 G4cout <<
" LambdaTable address= " << theLambdaTable <<
G4endl;
530 if(theLambdaTable) {
G4cout << (*theLambdaTable) <<
G4endl; }
569 if(!currentModel->
IsActive(preStepKinEnergy)) {
return x; }
575 return biasManager->
GetStepLimit(currentCoupleIndex, previousStepSize);
581 if(preStepKinEnergy < mfpKinEnergy) {
582 if (integral) { ComputeIntegralLambda(preStepKinEnergy); }
583 else { preStepLambda = GetCurrentLambda(preStepKinEnergy); }
586 if(preStepLambda <= 0.0) {
593 if(preStepLambda > 0.0) {
616 G4cout <<
"G4VEmProcess::PostStepGetPhysicalInteractionLength ";
619 <<
" in Material " << currentMaterial->
GetName()
620 <<
" Ekin(MeV)= " << preStepKinEnergy/
MeV
622 G4cout <<
" MeanFreePath = " << currentInteractionLength/
cm <<
"[cm]"
623 <<
" InteractionLength= " << x/
cm <<
"[cm] " <<
G4endl;
660 <<
" E(MeV)= " << finalT/
MeV
661 <<
" preLambda= " << preStepLambda <<
" < "
662 << lx <<
" (postLambda) "
678 weight /= biasFactor;
693 secParticles.clear();
697 (*theCuts)[currentCoupleIndex]);
706 eloss, currentCoupleIndex,
707 (*theCuts)[currentCoupleIndex],
717 G4int num = secParticles.size();
723 for (
G4int i=0; i<num; ++i) {
724 if (secParticles[i]) {
731 if (e < (*theCutsGamma)[currentCoupleIndex]) { good =
false; }
733 }
else if (p == theElectron) {
734 if (e < (*theCutsElectron)[currentCoupleIndex]) { good =
false; }
736 }
else if (p == thePositron) {
738 e < (*theCutsPositron)[currentCoupleIndex]) {
780 if ( theLambdaTable && part == particle) {
788 <<
" in the directory <" << directory
791 G4cout <<
"Fail to store Physics Table for "
794 <<
" in the directory <" << directory
798 if ( theLambdaTablePrim && part == particle) {
806 <<
" in the directory <" << directory
809 G4cout <<
"Fail to store Physics Table Prim for "
812 <<
" in the directory <" << directory
826 G4cout <<
"G4VEmProcess::RetrievePhysicsTable() for "
832 if((!buildLambdaTable && minKinEnergyPrim > maxKinEnergy)
833 || particle != part) {
return yes; }
838 if(buildLambdaTable) {
844 G4cout <<
"Lambda table for " << particleName
845 <<
" is Retrieved from <"
850 size_t n = theLambdaTable->
length();
851 for(
size_t i=0; i<
n; ++i) {
852 if((* theLambdaTable)[i]) {
853 (* theLambdaTable)[i]->SetSpline(
true);
859 G4cout <<
"Lambda table for " << particleName <<
" in file <"
860 << filename <<
"> is not exist"
865 if(minKinEnergyPrim < maxKinEnergy) {
871 G4cout <<
"Lambda table prim for " << particleName
872 <<
" is Retrieved from <"
877 size_t n = theLambdaTablePrim->
length();
878 for(
size_t i=0; i<
n; ++i) {
879 if((* theLambdaTablePrim)[i]) {
880 (* theLambdaTablePrim)[i]->SetSpline(
true);
886 G4cout <<
"Lambda table prim for " << particleName <<
" in file <"
887 << filename <<
"> is not exist"
903 DefineMaterial(couple);
906 cross = (*theDensityFactor)[currentCoupleIndex]*
907 (((*theLambdaTable)[basedCoupleIndex])->Value(kineticEnergy));
911 currentParticle,kineticEnergy);
914 if(cross < 0.0) { cross = 0.0; }
935 if(0.0 < preStepLambda) { x = 1.0/preStepLambda; }
956 void G4VEmProcess::FindLambdaMax()
959 G4cout <<
"### G4VEmProcess::FindLambdaMax: "
963 size_t n = theLambdaTable->
length();
970 for (i=0; i<
n; ++i) {
971 pv = (*theLambdaTable)[i];
977 for (
size_t j=0; j<nb; ++j) {
986 theEnergyOfCrossSectionMax[i] = emax;
987 theCrossSectionMax[i] =
smax;
990 <<
" Max CS at i= " << i <<
" emax(MeV)= " << emax/
MeV
991 <<
" lambda= " << smax <<
G4endl;
996 for (i=0; i<
n; ++i) {
997 pv = (*theLambdaTable)[i];
999 G4int j = (*theDensityIdx)[i];
1000 theEnergyOfCrossSectionMax[i] = theEnergyOfCrossSectionMax[j];
1001 theCrossSectionMax[i] = (*theDensityFactor)[i]*theCrossSectionMax[j];
1034 G4cout <<
"### SetCrossSectionBiasingFactor: for "
1037 <<
" biasFactor= " << f <<
" weightFlag= " << flag
1051 G4cout <<
"### ActivateForcedInteraction: for "
1054 <<
" length(mm)= " << length/
mm
1055 <<
" in G4Region <" << r
1056 <<
"> weightFlag= " << flag
1070 if (0.0 <= factor) {
1079 G4cout <<
"### ActivateSecondaryBiasing: for "
1081 <<
" factor= " << factor
1082 <<
" in G4Region <" << region
1083 <<
"> energyLimit(MeV)= " << energyLimit/
MeV
1093 nLambdaBins =
G4lrint(nLambdaBins*std::log(maxKinEnergy/e)
1094 /std::log(maxKinEnergy/minKinEnergy));
1102 nLambdaBins =
G4lrint(nLambdaBins*std::log(e/minKinEnergy)
1103 /std::log(maxKinEnergy/minKinEnergy));