Import Geant4 10.5.1 source tree

This commit is contained in:
Gabriele Cosmo
2019-04-17 10:39:02 +02:00
parent a7fdc52004
commit 28a70706e0
661 changed files with 55791 additions and 106984 deletions
@@ -76,7 +76,6 @@ G4EmBiasingManager::G4EmBiasingManager()
fDirectionalSplittingRadius = 0.;
fDirectionalSplittingTarget = G4ThreeVector(0.,0.,0.);
fDirectionalSplittingWeights.clear();
fWeight = 1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -304,7 +303,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4double safety)
{
G4int index = idxSecBiasedCouple[coupleIdx];
fWeight = 1.0;
G4double weight = 1.;
if(0 <= index) {
size_t n = vd.size();
@@ -322,18 +321,17 @@ G4EmBiasingManager::ApplySecondaryBiasing(
// Russian Roulette
} else if(1 == nsplit) {
fWeight = ApplyRussianRoulette(vd, index);
weight = ApplyRussianRoulette(vd, index);
// Splitting
} else {
if (fDirectionalSplitting) {
ApplyDirectionalSplitting(vd, track, currentModel, index, tcut);
fWeight = 1.;
weight = ApplyDirectionalSplitting(vd, track, currentModel, index, tcut);
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
fWeight = ApplySplitting(vd, track, currentModel, index, tcut);
weight = ApplySplitting(vd, track, currentModel, index, tcut);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
@@ -341,7 +339,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -358,7 +356,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4double safety)
{
G4int index = idxSecBiasedCouple[coupleIdx];
fWeight = 1.0;
G4double weight = 1.;
if(0 <= index) {
size_t n = vd.size();
@@ -376,19 +374,18 @@ G4EmBiasingManager::ApplySecondaryBiasing(
// Russian Roulette
} else if(1 == nsplit) {
fWeight = ApplyRussianRoulette(vd, index);
weight = ApplyRussianRoulette(vd, index);
// Splitting
} else {
if (fDirectionalSplitting) {
ApplyDirectionalSplitting(vd, track, currentModel,
weight = ApplyDirectionalSplitting(vd, track, currentModel,
index, tcut, pPartChange);
fWeight = 1.;
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
fWeight = ApplySplitting(vd, track, currentModel, index, tcut);
weight = ApplySplitting(vd, track, currentModel, index, tcut);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
@@ -396,7 +393,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -406,7 +403,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
G4int coupleIdx)
{
G4int index = idxSecBiasedCouple[coupleIdx];
fWeight = 1.0;
G4double weight = 1.;
if(0 <= index) {
size_t n = track.size();
@@ -419,9 +416,9 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
// Russian Roulette only
if(1 == nsplit) {
fWeight = secBiasedWeight[index];
weight = secBiasedWeight[index];
for(size_t k=0; k<n; ++k) {
if(G4UniformRand()*fWeight > 1.0) {
if(G4UniformRand()*weight > 1.0) {
const G4Track* t = track[k];
delete t;
track[k] = 0;
@@ -430,7 +427,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -486,11 +483,11 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
{
// method is applied only if 1 secondary created PostStep
// in the case of many secondaries there is a contradiction
fWeight = 1.0;
G4double weight = 1.;
size_t n = vd.size();
G4double w = secBiasedWeight[index];
if(1 != n || 1.0 <= w) { return fWeight; }
if(1 != n || 1.0 <= w) { return weight; }
G4double trackWeight = track.GetWeight();
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
@@ -500,7 +497,7 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
// double splitting is suppressed
if(1 < nsplit && trackWeight>w) {
fWeight = w;
weight = w;
if(nsplit > (G4int)tmpSecondaries.size()) {
tmpSecondaries.reserve(nsplit);
}
@@ -515,12 +512,12 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4double
G4EmBiasingManager::ApplyDirectionalSplitting(
std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
@@ -537,8 +534,8 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
fDirectionalSplittingWeights.clear();
if(1.0 <= w) {
fDirectionalSplittingWeights.push_back(fWeight);
return;
fDirectionalSplittingWeights.push_back(weight);
return weight;
}
G4double trackWeight = track.GetWeight();
@@ -570,14 +567,14 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
if (sec->GetParticleDefinition() == theGamma) {
if (CheckDirection(pos, sec->GetMomentumDirection())) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(weight);
fDirectionalSplittingWeights.push_back(1.);
} else if (G4UniformRand() < w) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.0);
fDirectionalSplittingWeights.push_back(1./weight);
}
} else if (k==0) { // not gamma
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.);
fDirectionalSplittingWeights.push_back(1./weight);
}
}
@@ -597,7 +594,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->GetProposedMomentumDirection(),
partChange->GetProposedKineticEnergy());
vd.push_back(dp);
fDirectionalSplittingWeights.push_back(weight);
fDirectionalSplittingWeights.push_back(1.);
}
} else if (G4UniformRand()<w) { // not going to target. play RR.
if (!foundPrimaryParticle) {
@@ -610,7 +607,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->GetProposedMomentumDirection(),
partChange->GetProposedKineticEnergy());
vd.push_back(dp);
fDirectionalSplittingWeights.push_back(1.0);
fDirectionalSplittingWeights.push_back(1./weight);
}
}
}
@@ -621,26 +618,29 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->ProposeMomentumDirection(primaryMomdir);
} else {
for (size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(trackWeight);
fDirectionalSplittingWeights.push_back(1.);
}
}
return;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmBiasingManager::GetWeight(G4int i)
{
// normally return 1. If a directionally split particle survives RR,
// return 1./(splitting factor)
if (fDirectionalSplittingWeights.size() >= (unsigned int)(i+1) ) {
return fDirectionalSplittingWeights[i];
}
else {
return fWeight;
G4double w = fDirectionalSplittingWeights[i];
fDirectionalSplittingWeights[i] = 1.; // ensure it's not used again
return w;
} else {
return 1.;
}
}
void
G4double
G4EmBiasingManager::ApplyDirectionalSplitting(
std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
@@ -648,7 +648,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
G4int index,
G4double tcut)
{
// Do nothing with primary
// primary is not a gamma. Do nothing with primary
G4double weight = 1.0;
G4double w = secBiasedWeight[index];
@@ -656,7 +656,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
fDirectionalSplittingWeights.clear();
if(1.0 <= w) {
fDirectionalSplittingWeights.push_back(weight);
return;
return weight;
}
G4double trackWeight = track.GetWeight();
@@ -681,17 +681,17 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
for (auto sec : tmpSecondaries) {
if (CheckDirection(pos, sec->GetMomentumDirection())) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(weight);
fDirectionalSplittingWeights.push_back(1.);
} else if (G4UniformRand()<w) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.0);
fDirectionalSplittingWeights.push_back(1./weight);
}
}
} // end of loop over nsplit
} else { // no splitting was done; still need weights
for (size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(trackWeight);
fDirectionalSplittingWeights.push_back(1.0);
}
}
return;
return weight;
}
@@ -35,32 +35,7 @@
//
// Creation date: 07.05.2002
//
// Modifications:
//
// 23-12-02 V.Ivanchenko change interface in order to move
// to cut per region
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 24-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 The set of models is defined for region (V.Ivanchenko)
// 06-03-03 Fix in energy intervals for models (V.Ivanchenko)
// 13-04-03 Add startFromNull (V.Ivanchenko)
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 16-07-03 Replace G4Material by G4MaterialCutCouple in dE/dx and CrossSection
// calculation (V.Ivanchenko)
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
// 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko)
// 26-01-04 Fix in energy range conditions (V.Ivanchenko)
// 24-03-05 Remove check or IsInCharge (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-08-05 Fix cut for e+e- pair production (V.Ivanchenko)
// 29-11-05 Add protection for arithmetic operations with cut=DBL_MAX (V.Ivanchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 13-05-06 Add GetModel by index method (VI)
// 15-03-07 Add maxCutInRange (V.Ivanchenko)
// 12-04-07 Add verbosity at destruction (V.Ivanchenko)
// 08-04-08 Fixed and simplified initialisation of G4RegionModel (VI)
// 03-08-09 Create internal vectors only it is needed (VI)
// 14-07-11 Use pointer to the vector of cuts and not local copy (VI)
// Modifications: V.Ivanchenko
//
// Class Description:
//
@@ -392,10 +367,6 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
// this model has lower order parameter than possible
// other models, with which there may be intersections
// so, appliction area of such models may be reduced
//G4cout << "tmin= " << tmin << " tmax= "
// << tmax << " push= " << push << " idx= " << idx <<G4endl;
//G4cout << "n= " << n << " eLow[0]= " << eLow[0] << " eLow[n-1]= " << eLow[n-1]
// << " eHigh[0]= " << eHigh[0] << " eHigh[n-1]= " << eHigh[n-1] << G4endl;
// insert below the first model
if (tmax <= eLow[0]) {
@@ -507,7 +478,8 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
eLow[n] = eHigh[n-1];
if(1 < verboseLevel) {
G4cout << "### New G4RegionModels set with " << n << " models for region <";
G4cout << "### New G4RegionModels set with " << n
<< " models for region <";
if (region) { G4cout << region->GetName(); }
G4cout << "> Elow(MeV)= ";
for(G4int iii=0; iii<=n; ++iii) {G4cout << eLow[iii]/MeV << " ";}
@@ -815,10 +787,10 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
std::min(r->LowEdgeEnergy(j+1),model->HighEnergyActivationLimit());
if(emax > emin) {
out << std::setw(20);
out << model->GetName() << " : Emin= "
<< std::setw(8) << G4BestUnit(emin,"Energy")
<< " Emax= "
<< std::setw(8) << G4BestUnit(emax,"Energy");
out << model->GetName() << " : Emin="
<< std::setw(5) << G4BestUnit(emin,"Energy")
<< " Emax="
<< std::setw(5) << G4BestUnit(emax,"Energy");
G4PhysicsTable* table = model->GetCrossSectionTable();
if(table) {
size_t kk = table->size();
@@ -826,18 +798,18 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
G4PhysicsVector* v = (*table)[k];
if(v) {
G4int nn = v->GetVectorLength() - 1;
out << " Table with " << nn << " bins Emin= "
<< std::setw(6) << G4BestUnit(v->Energy(0),"Energy")
<< " Emax= "
<< std::setw(6) << G4BestUnit(v->Energy(nn),"Energy");
out << " Nbins=" << nn << " "
<< std::setw(3) << G4BestUnit(v->Energy(0),"Energy")
<< " - "
<< std::setw(3) << G4BestUnit(v->Energy(nn),"Energy");
break;
}
}
}
G4VEmAngularDistribution* an = model->GetAngularDistribution();
if(an) { out << " " << an->GetName(); }
if(an) { out << " " << an->GetName(); }
if(fluoFlag && model->DeexcitationFlag()) {
out << " FluoActive";
out << " Fluo";
}
out << G4endl;
}
@@ -289,7 +289,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
labCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mscfCmd = new G4UIcmdWithADouble("/process/msc/FactorForAngleLimit",this);
mscfCmd->SetGuidance("Set factor for computation of a limit for -t (invariant trasfer)");
mscfCmd->SetGuidance("Set factor for computation of a limit for -t (invariant transfer)");
mscfCmd->SetParameterName("Fact",true);
mscfCmd->SetRange("Fact>0");
mscfCmd->SetDefaultValue(1.);
@@ -471,6 +471,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
@@ -482,7 +483,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetDefaultValue("mm");
unitPrm->SetDefaultUnit("mm");
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
@@ -555,19 +556,22 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
fiCmd->SetParameter(regNam);
G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
tlength->SetParameterRange("tlength>0");
fiCmd->SetParameter(tlength);
G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
unitT->SetDefaultUnit("mm");
fiCmd->SetParameter(unitT);
G4UIparameter* flagT = new G4UIparameter("tflag",'s',true);
G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
flagT->SetDefaultValue(true);
fiCmd->SetParameter(flagT);
bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roullette per region.");
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
bsCmd->SetGuidance(" bProcNam : process name");
bsCmd->SetGuidance(" bRegNam : region name");
bsCmd->SetGuidance(" bFactor : number of splitted gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_Idle,G4State_Idle);
@@ -585,6 +589,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
bsCmd->SetParameter(bEnergy);
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bUnit->SetDefaultUnit("MeV");
bsCmd->SetParameter(bUnit);
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
@@ -606,7 +611,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
nffCmd->AvailableForStates(G4State_PreInit);
tripletCmd = new G4UIcmdWithAnInteger("/process/gconv/conversionType",this);
tripletCmd->SetGuidance("gamma conversion triplet/nuclear genaration type:");
tripletCmd->SetGuidance("gamma conversion triplet/nuclear generation type:");
tripletCmd->SetGuidance("0 - (default) both triplet and nuclear");
tripletCmd->SetGuidance("1 - force nuclear");
tripletCmd->SetGuidance("2 - force triplet");
@@ -401,8 +401,8 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(G4int i=0; i<numberOfModels; ++i) {
G4VEmModel* mod = GetModelByIndex(i, printing);
G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing);
//G4cout << i << ". " << mod << " " << mod0 << " "
// << particle->GetParticleName() << G4endl;
//G4cout << i << ". " << mod << " " << mod0 << " "
// << particle->GetParticleName() << G4endl;
mod->InitialiseLocal(particle, mod0);
}
// master thread
@@ -424,8 +424,8 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon"|| num == "alpha++" ||
num == "alpha+" || num == "helium" ||
num == "hydrogen")))
num == "alpha+" || num == "helium" ||
num == "hydrogen")))
{
StreamInfo(G4cout, part);
}
@@ -542,33 +542,33 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
out << std::setprecision(6);
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) {
out << " for " << part.GetParticleName();
out << " for " << part.GetParticleName();
if (integral) { out << ","; }
}
if(integral) { out << " integral: 1 "; }
if(applyCuts) { out << ", applyCuts: 1 "; }
out << " SubType= " << GetProcessSubType();;
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
out << " BuildTable= " << buildLambdaTable << G4endl;
if(integral) { out << " integral:1 "; }
if(applyCuts) { out << " applyCuts:1 "; }
out << " SubType=" << GetProcessSubType();
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
out << " BuildTable=" << buildLambdaTable << G4endl;
if(buildLambdaTable) {
if(particle == &part) {
size_t length = theLambdaTable->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins per decade, spline: "
<< splineFlag << G4endl;
break;
}
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins/decade, spline: "
<< splineFlag << G4endl;
break;
}
}
} else {
out << " Used Lambda table of "
@@ -579,16 +579,16 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
if(particle == &part) {
size_t length = theLambdaTablePrim->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins " << G4endl;
break;
}
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins " << G4endl;
break;
}
}
} else {
out << " Used LambdaPrime table of "
@@ -844,7 +844,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
G4Track* t = new G4Track(dp, time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
if (biasManager) {
t->SetWeight(biasManager->GetWeight(i));
t->SetWeight(weight * biasManager->GetWeight(i));
} else {
t->SetWeight(weight);
}
@@ -861,12 +861,12 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
} else {
t->SetCreatorModelIndex(biasID);
}
/*
/*
G4cout << "Secondary(post step) has weight " << t->GetWeight()
<< ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
<< GetProcessName() << " fluoID= " << fluoID
<< " augerID= " << augerID <<G4endl;
*/
<< ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
<< GetProcessName() << " fluoID= " << fluoID
<< " augerID= " << augerID <<G4endl;
*/
} else {
delete dp;
edep += e;
@@ -889,8 +889,8 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
G4bool ascii)
const G4String& directory,
G4bool ascii)
{
G4bool yes = true;
if(!isTheMaster) { return yes; }
@@ -938,7 +938,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
const G4String& directory,
G4bool ascii)
{
if(1 < verboseLevel) {
@@ -1027,8 +1027,8 @@ G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
SelectModel(kineticEnergy, currentCoupleIndex);
if(currentModel) {
cross = fFactor*currentModel->CrossSectionPerVolume(currentMaterial,
currentParticle,
kineticEnergy);
currentParticle,
kineticEnergy);
}
}
return std::max(cross, 0.0);
@@ -677,7 +677,7 @@ void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon"|| num == "alpha++" ||
num == "alpha+" )))
num == "alpha+" )))
{
StreamInfo(G4cout, part);
}
@@ -887,8 +887,8 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
G4String indent = (rst ? " " : "");
out << std::setprecision(6);
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) out << " for " << part.GetParticleName();
out << " SubType= " << GetProcessSubType() << G4endl
if (!rst) out << " for " << part.GetParticleName();
out << " SubType=" << GetProcessSubType() << G4endl
<< " dE/dx and range tables from "
<< G4BestUnit(minKinEnergy,"Energy")
<< " to " << G4BestUnit(maxKinEnergy,"Energy")
@@ -896,33 +896,33 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
<< " Lambda tables from threshold to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< ", " << theParameters->NumberOfBinsPerDecade()
<< " bins per decade, spline: "
<< " bins/decade, spline: "
<< theParameters->Spline()
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
out << " finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
<< ", integral: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLimit= " << linLossLimit
<< G4endl;
out << " StepFunction=(" << dRoverRange << ", "
<< finalRange/mm << " mm)"
<< ", integ: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLim= " << linLossLimit
<< G4endl;
}
StreamProcessInfo(out);
modelManager->DumpModelList(out, verboseLevel);
if(theCSDARangeTable && isIonisation) {
out << " CSDA range table up"
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << G4endl;
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << G4endl;
}
if(nSCoffRegions>0 && isIonisation) {
out << " Subcutoff sampling in " << nSCoffRegions
<< " regions" << G4endl;
<< " regions" << G4endl;
}
if(2 < verboseLevel) {
out << " DEDXTable address= " << theDEDXTable << G4endl;
if(theDEDXTable && isIonisation) out << (*theDEDXTable) << G4endl;
out << "non restricted DEDXTable address= "
<< theDEDXunRestrictedTable << G4endl;
<< theDEDXunRestrictedTable << G4endl;
if(theDEDXunRestrictedTable && isIonisation) {
out << (*theDEDXunRestrictedTable) << G4endl;
}
@@ -933,11 +933,13 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
if(theCSDARangeTable && isIonisation) {
out << (*theCSDARangeTable) << G4endl;
}
out << " RangeTableForLoss address= " << theRangeTableForLoss << G4endl;
out << " RangeTableForLoss address= " << theRangeTableForLoss
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
out << (*theRangeTableForLoss) << G4endl;
}
out << " InverseRangeTable address= " << theInverseRangeTable << G4endl;
out << " InverseRangeTable address= " << theInverseRangeTable
<< G4endl;
if(theInverseRangeTable && isIonisation) {
out << (*theInverseRangeTable) << G4endl;
}
@@ -1029,7 +1031,7 @@ G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
G4double finR = (rndmStepFlag) ? std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(1)) : finalRange;
x = (fRange > finR) ?
fRange*dRoverRange + finR*(1.0 - dRoverRange)*(2.0 - finR/fRange) : fRange;
fRange*dRoverRange + finR*(1.0-dRoverRange)*(2.0-finR/fRange) : fRange;
// if(particle->GetPDGMass() > 0.9*GeV)
/*
G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
@@ -1643,7 +1645,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
G4Track* t = new G4Track(secParticles[i], time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
if (biasManager) {
t->SetWeight(biasManager->GetWeight(i));
t->SetWeight(weight * biasManager->GetWeight(i));
} else {
t->SetWeight(weight);
}
@@ -317,7 +317,7 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
if(!msc) { continue; }
G4VMscModel* msc0=
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
msc->InitialiseLocal(firstParticle, msc0);
}
@@ -333,7 +333,7 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon" || num == "alpha+" ||
num == "alpha++" )))
num == "alpha++" )))
{
StreamInfo(G4cout, part);
}
@@ -353,8 +353,8 @@ void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
{
G4String indent = (rst ? " " : "");
outFile << G4endl << indent << GetProcessName() << ": ";
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
StreamProcessInfo(outFile);
modelManager->DumpModelList(outFile, verboseLevel);
}
@@ -380,9 +380,9 @@ void G4VMultipleScattering::StartTracking(G4Track* track)
for(G4int i=0; i<numberOfModels; ++i) {
/*
G4cout << "Next model " << i << " " << msc
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
*/
G4VEmModel* msc = GetModelByIndex(i);
msc->StartTracking(track);
@@ -510,16 +510,16 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
if(r2 > minDisplacement2) {
fPositionChanged = true;
G4double dispR = std::sqrt(r2);
G4double dispR = std::sqrt(r2);
G4double postSafety =
sFact*safetyHelper->ComputeSafety(fNewPosition, dispR);
sFact*safetyHelper->ComputeSafety(fNewPosition, dispR);
//G4cout<<" R= "<< dispR<<" postSafety= "<<postSafety<<G4endl;
// far away from geometry boundary
if(postSafety > 0.0 && dispR <= postSafety) {
fNewPosition += displacement;
//near the boundary
//near the boundary
} else {
// displaced point is definitely within the volume
//G4cout<<" R= "<<dispR<<" postSafety= "<<postSafety<<G4endl;
@@ -543,72 +543,73 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
<< G4endl;
*/
// check if it is possible to shift to the boundary
// and the shift is not large
// and the shift is not large
if(safetyHelper->RecheckDistanceToCurrentBoundary(fNewPosition,
fNewDirection, maxshift, &dist, &safety)
&& std::abs(dist) < maxshift) {
/*
G4cout << "##MSC after Recheck dist= " << dist
<< " postsafety= " << postSafety
<< " t= " << tPathLength
<< " g= " << geomLength
<< " p= " << physStepLimit
<< G4endl;
*/
// shift is positive
if(dist >= 0.0) {
tPathLength *= (1.0 + dist/geomLength);
fNewPosition += dist*fNewDirection;
&& std::abs(dist) < maxshift) {
/*
G4cout << "##MSC after Recheck dist= " << dist
<< " postsafety= " << postSafety
<< " t= " << tPathLength
<< " g= " << geomLength
<< " p= " << physStepLimit
<< G4endl;
*/
// shift is positive
if(dist >= 0.0) {
tPathLength *= (1.0 + dist/geomLength);
fNewPosition += dist*fNewDirection;
// shift is negative cannot be larger than geomLength
} else {
maxshift = std::min(maxshift, geomLength);
if(0.0 < maxshift + dist) {
const G4ThreeVector& postpoint = step.GetPostStepPoint()->GetPosition();
G4ThreeVector point = fNewPosition + dist*fNewDirection;
G4double R2 = (postpoint - point).mag2();
G4double newdist = dist;
// check not more than 10 extra boundaries
for(G4int i=0; i<10; ++i) {
dist = 0.0;
if(safetyHelper->RecheckDistanceToCurrentBoundary(
point, fNewDirection, maxshift, &dist, &safety)
&& std::abs(newdist + dist) < maxshift) {
point += dist*fNewDirection;
G4double R2new = (postpoint - point).mag2();
//G4cout << "Backward i= " << i << " dist= " << dist
// << " R2= " << R2new << G4endl;
if(dist >= 0.0 || R2new > R2) { break; }
R2 = R2new;
fNewPosition = point;
newdist += dist;
} else {
break;
}
}
tPathLength *= (1.0 + newdist/geomLength);
// shift on boundary is not possible for negative disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
}
// shift on boundary is not possible for any disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
// reduced displacement
} else if(postSafety > geomMin) {
fNewPosition += displacement*(postSafety/dispR);
// shift is negative cannot be larger than geomLength
} else {
maxshift = std::min(maxshift, geomLength);
if(0.0 < maxshift + dist) {
const G4ThreeVector& postpoint =
step.GetPostStepPoint()->GetPosition();
G4ThreeVector point = fNewPosition + dist*fNewDirection;
G4double R2 = (postpoint - point).mag2();
G4double newdist = dist;
// check not more than 10 extra boundaries
for(G4int i=0; i<10; ++i) {
dist = 0.0;
if(safetyHelper->RecheckDistanceToCurrentBoundary(
point, fNewDirection, maxshift, &dist, &safety)
&& std::abs(newdist + dist) < maxshift) {
point += dist*fNewDirection;
G4double R2new = (postpoint - point).mag2();
//G4cout << "Backward i= " << i << " dist= " << dist
// << " R2= " << R2new << G4endl;
if(dist >= 0.0 || R2new > R2) { break; }
R2 = R2new;
fNewPosition = point;
newdist += dist;
} else {
break;
}
}
tPathLength *= (1.0 + newdist/geomLength);
// shift on boundary is not possible for negative disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
}
// shift on boundary is not possible for any disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
// reduced displacement
} else if(postSafety > geomMin) {
fNewPosition += displacement*(postSafety/dispR);
// very small postSafety
} else {
fPositionChanged = false;
}
}
if(fPositionChanged) {
safetyHelper->ReLocateWithinVolume(fNewPosition);
fParticleChange.ProposePosition(fNewPosition);
}
if(fPositionChanged) {
safetyHelper->ReLocateWithinVolume(fNewPosition);
fParticleChange.ProposePosition(fNewPosition);
}
}
}
}