Problem 1145

Summary: G4TripathiLightCrossSection "LowEnergyCheck"
Product: Geant4 Reporter: tkoi
Component: processes/hadronic/cross_sectionsAssignee: dennis.herbert.wright
Status: RESOLVED FIXED    
Severity: trivial CC: kelsey
Priority: P5    
Version: 9.3   
Hardware: All   
OS: All   

Description tkoi 2010-09-22 20:22:16 CEST
Hi

G4TripathiLightCrossSection::GetIsoZACrossSection
(const G4DynamicParticle* theProjectile, G4double ZZ, G4double AA,   G4double /*theTemperature*/)
{
************************************************
286   result = pi * r_0*r_0 *
287            std::pow((std::pow(AT,third) + std::pow(AP,third) + deltaE),2.0) *
288            (1.0 - R_c*B/E_cm) * X_m;
289   if (!lowEnergyCheck)
290   {
291     if (result < 0.0)
292       result = 0.0;
293     else if (E < 6.0*MeV)
294     {
295       G4double f  = 0.95;
296       G4DynamicParticle slowerProjectile = *theProjectile;
297       slowerProjectile.SetKineticEnergy(f * EA * MeV);
298       // G4TripathiLightCrossSection theTripathiLightCrossSection; // MHM 20090824 Not needed
299     // theTripathiLightCrossSection.SetLowEnergyCheck(true);
300     G4bool savelowenergy=lowEnergyCheck;
301     SetLowEnergyCheck(true);
302       G4double resultp =
303         GetIsoZACrossSection(&slowerProjectile, ZZ, AA, 0.0);
304     SetLowEnergyCheck(savelowenergy);
305       if (resultp >result) result = 0.0;
306     }
************************************************
}

Function GetIsoZACrossSection at 303th is called the function recursively, then 
"result" will overwrite at 286th. As the result, “resultp “always has same value of "result". Therefore 305th line becomes meaningless.

Tatsumi
Comment 1 Michael Kelsey 2010-10-12 07:21:00 CEST
Hi, Tatsumi.  It looks to me as though the "result" assignment ought to be moved to be inside the "if (!lowEnergyCheck)" block.  Any chance you can test that in whatever code you discovered this bug?  It'd be cool to get this fixed in time for the 9.4 build.
Comment 2 dennis.herbert.wright 2011-05-05 23:29:59 CEST
Problem report withdrawn by Tatsumi Koi.