50 G4VParticleChange* pChange = pRegProcess->PostStepDoIt( track,
step );
51 pChange->SetVerboseLevel(0);
52 pChange->SetSecondaryWeightByProcess(
true);
54 G4double secWeight = 1.0;
56 std::vector<G4Track*> secondaries;
62 G4double
s =
step.GetStepLength();
63 G4double
x = pRegProcess->GetCurrentInteractionLength();
64 nw = pChange->GetParentWeight();
69 if (
wc < 1.0
e-10)
wc = 1.0;
70 nw *= 1/
wc * (1. - exp(-s/x))/(1 - exp(-
eFactor*s/x)) ;
71 G4cout <<
" MNSPXSB.PostStepDoit(): original wt = " << pChange->GetParentWeight() <<
" eF = " <<
eFactor << G4endl;
72 G4cout <<
" MNSPXSB.PostStepDoit(): New weight = " << nw <<
" wc = " <<
wc <<
" s= " << s <<
" x = " << x << G4endl;
73 ((G4ParticleChange*)pChange)->ProposeParentWeight(nw) ;
78 ((G4ParticleChange*)pChange)->ProposeParentWeight(nw) ;
85 pChange->SetNumberOfSecondaries(pChange->GetNumberOfSecondaries()+1);
86 G4ThreeVector mDirection = track.GetDynamicParticle()->GetMomentumDirection();
87 G4DynamicParticle* aD =
new G4DynamicParticle((track.GetDynamicParticle())->GetDefinition(),
88 G4LorentzVector(mDirection,
89 (track.GetDynamicParticle())->GetKineticEnergy()+
step.GetTotalEnergyDeposit()));
90 G4Track* secTrk =
new G4Track(aD,
step.GetDeltaTime(),
step.GetDeltaPosition());
91 pChange->AddSecondary(secTrk);
92 pChange->GetSecondary(pChange->GetNumberOfSecondaries()-1)->
97 nw = track.GetWeight();
98 pChange->ProposeParentWeight(nw);
102 secWeight = secWeight*nw;
108 G4VParticleChange* particleChange =
new G4VParticleChange();
110 for (
unsigned int ii=0; ii<(
unsigned int)
fNSplit; ii++) {
111 particleChange = pRegProcess->PostStepDoIt(track,
step);
113 throw std::runtime_error(
"MuNuclearSplittingProcessXSecBias::PostStepDoIt(): no particle change");
115 G4int numSec(particleChange->GetNumberOfSecondaries());
117 for (j=0; j<numSec; j++)
119 G4Track* newSec =
new G4Track(*(particleChange->GetSecondary(j)));
120 G4String pdgstr = newSec->GetParticleDefinition()->GetParticleName();
122 G4int
pdg = newSec->GetParticleDefinition()->GetPDGEncoding();
123 if (
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
127 if (pdg==G4KaonZeroShort::KaonZeroShort()->GetPDGEncoding()&&G4UniformRand()<0.50)
129 pdg = G4KaonZeroLong::KaonZeroLong()->GetPDGEncoding();
130 pdgstr = G4KaonZeroLong::KaonZeroLong()->GetParticleName();
131 G4LorentzVector pK0L(newSec->GetMomentum(),TMath::Sqrt(TMath::Power(G4KaonZeroLong::KaonZeroLong()->GetPDGMass(),2)+TMath::Power(newSec->GetMomentum().mag(),2)));
132 G4DynamicParticle *newK0L =
new G4DynamicParticle(G4KaonZeroLong::KaonZeroLong(),pK0L);
134 G4Track* newSecK0L =
new G4Track(newK0L,track.GetGlobalTime(),track.GetPosition());
135 secondaries.push_back(newSecK0L);
139 secondaries.push_back(newSec);
145 pChange->SetNumberOfSecondaries(secondaries.size());
146 pChange->SetSecondaryWeightByProcess(
true);
151 while (iter != secondaries.end()) {
152 G4Track* myTrack = *iter;
153 G4String pdgstr = myTrack->GetParticleDefinition()->GetParticleName();
154 G4double ke = myTrack->GetKineticEnergy()/
CLHEP::GeV;
155 G4int pdg = myTrack->GetParticleDefinition()->GetPDGEncoding();
156 if (
abs(pdg)==130 ||
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
159 std::cout <<
"MuNuclSplXSB(): Adding " << pdgstr <<
" of Kinetic Energy and weight " << ke <<
" GeV and " << secWeight <<
"." <<
std::endl;
161 myTrack->SetWeight(secWeight);
162 pChange->AddSecondary(myTrack);
static constexpr double GeV
G4double XBiasSurvivalProbability()
G4double XBiasSecondaryWeight()
QTextStream & endl(QTextStream &s)