Fixed problems with negative energies
This commit is contained in:
parent
ba04c8dc77
commit
c4bb2bb74e
@ -99,25 +99,27 @@ void musrMuEnergyLossLandau::GetFinalEnergy(const G4Step* aStep)
|
|||||||
if(p_name=="mu+"){
|
if(p_name=="mu+"){
|
||||||
do{
|
do{
|
||||||
Eloss = random->Landau(landauMPV,landauSigma);
|
Eloss = random->Landau(landauMPV,landauSigma);
|
||||||
} while (Eloss < 0.);
|
if (Eloss > 0.) break;
|
||||||
|
} while (1);
|
||||||
|
|
||||||
Efinal = E - Eloss;
|
Efinal = E - Eloss;
|
||||||
|
if (Efinal < 0. ) Efinal = 0.;
|
||||||
// cout << "E, Eloss, Efinal = " << E << ", " << Eloss << ", " << Efinal << endl;
|
// cout << "E, Eloss, Efinal = " << E << ", " << Eloss << ", " << Efinal << endl;
|
||||||
|
|
||||||
particle = particleTable->FindParticle(p_name) ;
|
particle = particleTable->FindParticle(p_name) ;
|
||||||
|
|
||||||
// Set the new dynamic particle DP
|
// Set the new dynamic particle DP
|
||||||
DP = new G4DynamicParticle(particle,
|
DP = new G4DynamicParticle(particle,
|
||||||
aStep->GetTrack()->GetDynamicParticle()->GetMomentumDirection(),
|
aStep->GetTrack()->GetDynamicParticle()->GetMomentumDirection(),
|
||||||
Efinal/1000.);
|
Efinal/1000.);
|
||||||
|
|
||||||
/* IMPORTANT : COPY THOSE DATA TO GET THE SAME PARTICLE PROPERTIES!!!
|
/* IMPORTANT : COPY THOSE DATA TO GET THE SAME PARTICLE PROPERTIES!!!
|
||||||
SHOULD BE KEPT WHEN BUILDING A PARTICLE CHANGE */
|
SHOULD BE KEPT WHEN BUILDING A PARTICLE CHANGE */
|
||||||
DP->SetProperTime( aStep->GetTrack()->GetDynamicParticle()->GetProperTime());
|
DP->SetProperTime( aStep->GetTrack()->GetDynamicParticle()->GetProperTime());
|
||||||
DP->SetPolarization(aStep->GetTrack()->GetDynamicParticle()->GetPolarization().x(),
|
DP->SetPolarization(aStep->GetTrack()->GetDynamicParticle()->GetPolarization().x(),
|
||||||
aStep->GetTrack()->GetDynamicParticle()->GetPolarization().y(),
|
aStep->GetTrack()->GetDynamicParticle()->GetPolarization().y(),
|
||||||
aStep->GetTrack()->GetDynamicParticle()->GetPolarization().z());
|
aStep->GetTrack()->GetDynamicParticle()->GetPolarization().z());
|
||||||
DP->SetPreAssignedDecayProperTime(
|
DP->SetPreAssignedDecayProperTime(
|
||||||
aStep->GetTrack()->GetDynamicParticle()->GetPreAssignedDecayProperTime());
|
aStep->GetTrack()->GetDynamicParticle()->GetPreAssignedDecayProperTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user