Problem 618

Summary: Segmentation fault whilst using G4hLowEnergyIonisation and Generic Ion
Product: Geant4 Reporter: corneliu
Component: processes/electromagnetic/lowenergyAssignee: Vladimir.Ivantchenko
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.1   
Hardware: PC   
OS: Linux   

Description corneliu 2004-04-22 09:00:15 CEST
Hi,
I have encountered a segmentation fault whilst using the G4hLowEnergyIonisation
with generic ions. I am declaring primary particles in the
PrimaryGeneratorAction class with;

G4ParticleDefinition* particle = particleTable->GetIon(Z,A,0);

Then I am using the G4hLowEnergyIonisation process for generic ions. At run time
there is a segmentation fault. Using gdb I traced this back to the
GetMeanFreePath method of G4hLowEnergyIonisation class. It turns out that the
pointer "theIonEffChargeModel" is not initialised (well it is initialised to
NULL in the constructor). This initialisation is carried out in the
InitializeParametrisation method. In turn this is called by the
BuildPhysicsTable method. In this method there is an if statement like so:


  if(aParticleType.GetParticleType() == "nucleus" &&
     aParticleType.GetParticleName() != "GenericIon" &&
     aParticleType.GetParticleSubType() == "generic")
  {

     G4EnergyLossTables::Register(&aParticleType,
              theDEDXpTable,
              theRangepTable,
              theInverseRangepTable,
              theLabTimepTable,
              theProperTimepTable,
              LowestKineticEnergy, HighestKineticEnergy,
              proton_mass_c2/aParticleType.GetPDGMass(),
              TotBin);

     return;
  }

  if( !CutsWhereModified() && theLossTable) return;

  InitializeParametrisation() ;

It seems ions declared with the GetIon method are not considered GenericIons
(eg. type:nucleus name:C12[0.0] subtype:generic) and in this case (after
registering energy loss tables) the BuildPhysicsTable method returns (see
above). This occurs however BEFORE the call to the InitializeParametrisation
method. Consequently InitializeParametrisation is not called, hence the
theIonEffChargeModel pointer is never initialized and a segmentation fault
occurs when the GetMeanFreePath is called. I did work around this by declaring
the primary particle as a proton in the PrimaryGeneratorAction class, then using
the UI commands /gun/ion ..etc to declare the generic ion. It is possible that i
have misunderstood something here but i thought I'd submit a bug report anyway
just to be sure ;)
Best Regards,
Iwan Cornelius
Comment 1 Maria.Grazia.Pia 2004-05-17 02:20:59 CEST
The problem report is re-assigned to the developer expert in
G4hLowEnergyIonisation.

Best wishes,
Maria Grazia Pia
Comment 2 Vladimir.Ivantchenko 2004-06-03 04:26:59 CEST
Currently G4hIonisation + G4ionIonisation provide the same or better description
of hdron/ion ionisation and delta-electron production. G4hLowEnergyIonisation
have some problems of handling static objects. In our plans to migrade to design
provided by standard, so G4hLowEnergyIonisation will follow the same interface,
that will solve reported problem.