66 : nForcedRegions(0),nSecBiasedRegions(0),eIonisation(0),
67 currentStepLimit(0.0),startTracking(true)
69 fSafetyMin = 1.e-6*
mm;
90 if(0 < nForcedRegions) { idxForcedCouple.resize(numOfCouples, -1); }
91 if(0 < nSecBiasedRegions) { idxSecBiasedCouple.resize(numOfCouples, -1); }
94 for (
size_t j=0; j<numOfCouples; ++j) {
98 if(0 < nForcedRegions) {
99 for(
G4int i=0; i<nForcedRegions; ++i) {
100 if(forcedRegions[i]) {
101 if(pcuts == forcedRegions[i]->GetProductionCuts()) {
102 idxForcedCouple[j] = i;
108 if(0 < nSecBiasedRegions) {
109 for(
G4int i=0; i<nSecBiasedRegions; ++i) {
110 if(secBiasedRegions[i]) {
111 if(pcuts == secBiasedRegions[i]->GetProductionCuts()) {
112 idxSecBiasedCouple[j] = i;
119 if (nForcedRegions > 0 && 0 < verbose) {
120 G4cout <<
" Forced Interaction is activated for "
123 <<
" inside G4Regions: " <<
G4endl;
124 for (
G4int i=0; i<nForcedRegions; ++i) {
129 if (nSecBiasedRegions > 0 && 0 < verbose) {
130 G4cout <<
" Secondary biasing is activated for "
133 <<
" inside G4Regions: " <<
G4endl;
134 for (
G4int i=0; i<nSecBiasedRegions; ++i) {
138 <<
" BiasingWeight= " << secBiasedWeight[i] <<
G4endl;
151 if(name ==
"" || name ==
"world" || name ==
"World") {
152 name =
"DefaultRegionForTheWorld";
156 G4cout <<
"### G4EmBiasingManager::ForcedInteraction WARNING: "
158 << rname <<
"> is unknown" <<
G4endl;
163 if (0 < nForcedRegions) {
164 for (
G4int i=0; i<nForcedRegions; ++i) {
165 if (reg == forcedRegions[i]) {
166 lengthForRegion[i] = val;
172 G4cout <<
"### G4EmBiasingManager::ForcedInteraction WARNING: "
173 << val <<
" < 0.0, so no activation for the G4Region <"
174 << rname <<
">" <<
G4endl;
179 forcedRegions.push_back(reg);
180 lengthForRegion.push_back(val);
196 if(name ==
"" || name ==
"world" || name ==
"World") {
197 name =
"DefaultRegionForTheWorld";
201 G4cout <<
"### G4EmBiasingManager::ActivateBremsstrahlungSplitting WARNING: "
203 << rname <<
"> is unknown" <<
G4endl;
217 }
else if(0.0 < factor) {
223 if (0 < nSecBiasedRegions) {
224 for (
G4int i=0; i<nSecBiasedRegions; ++i) {
225 if (reg == secBiasedRegions[i]) {
226 secBiasedWeight[i] = w;
227 nBremSplitting[i] = nsplit;
228 secBiasedEnegryLimit[i] = energyLimit;
240 secBiasedRegions.push_back(reg);
241 secBiasedWeight.push_back(w);
242 nBremSplitting.push_back(nsplit);
243 secBiasedEnegryLimit.push_back(energyLimit);
254 startTracking =
false;
255 G4int i = idxForcedCouple[coupleIdx];
259 currentStepLimit = lengthForRegion[i];
260 if(currentStepLimit > 0.0) { currentStepLimit *=
G4UniformRand(); }
263 currentStepLimit -= previousStep;
265 if(currentStepLimit < 0.0) { currentStepLimit = 0.0; }
266 return currentStepLimit;
273 std::vector<G4DynamicParticle*>& vd,
285 size_t n = vd.size();
290 if(0 < n && vd[0]->GetKineticEnergy() < secBiasedEnegryLimit[index]) {
296 if(safety > fSafetyMin) { ApplyRangeCut(vd, track, eloss, safety); }
300 weight = ApplyRussianRoulette(vd, index);
307 weight = ApplySplitting(vd, track, currentModel, index, tcut);
321 std::vector<G4DynamicParticle*>& vd,
333 size_t n = vd.size();
338 if(0 < n && vd[0]->GetKineticEnergy() < secBiasedEnegryLimit[index]) {
344 if(safety > fSafetyMin) { ApplyRangeCut(vd, track, eloss, safety); }
348 weight = ApplyRussianRoulette(vd, index);
355 weight = ApplySplitting(vd, track, currentModel, index, tcut);
374 size_t n = track.size();
379 if(0 < n && track[0]->GetKineticEnergy() < secBiasedEnegryLimit[index]) {
385 weight = secBiasedWeight[
index];
386 for(
size_t k=0; k<
n; ++k) {
402 G4EmBiasingManager::ApplyRangeCut(std::vector<G4DynamicParticle*>& vd,
406 size_t n = vd.size();
411 for(
size_t k=0; k<
n; ++k) {
428 G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
437 size_t n = vd.size();
440 if(1 != n || 1.0 <= w) {
return weight; }
448 if(1 < nsplit && trackWeight>w) {
452 if(nsplit > (
G4int)tmpSecondaries.size()) {
453 tmpSecondaries.reserve(nsplit);
456 for(
G4int k=1; k<nsplit; ++k) {
457 tmpSecondaries.clear();
459 for (
size_t kk=0; kk<tmpSecondaries.size(); ++kk) {
460 vd.push_back(tmpSecondaries[kk]);