Problem 691

Summary: Segmentation fault in TestEm7 ( Temporal solution of #690)
Product: Examples/Extended Reporter: tkoi
Component: electromagnetic/TestEM5Assignee: Michel.Maire
Status: RESOLVED FIXED    
Severity: normal CC: pshenich
Priority: P2    
Version: 6.2   
Hardware: Other   
OS: Other   

Description tkoi 2004-11-17 15:49:16 CET
As report#690, Hadron Physics of TestEM7 has a problem.
This problem is produced by the following way.

Some Particles created in Binary Cascade ( and also Binary Cascade Light Ion)
do not have ProcessManger.
So that at the applying DecayProcess for all applicable particles in
PhysicsList::ConstructProcess,
pmanager ->AddProcess(fDecayProcess); line makes core dump,
because pmanger is NULL.

The simplest way to avoid this trouble is to change the order of preocess
creations. To apply DecayProcesses ahead to the creation of Hadronic Processes.

Change PhyisicsList.cc ConstructProcess() like this,
*******************************************************************************
  // decay process
  //
  G4Decay* fDecayProcess = new G4Decay();

  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();

    if (fDecayProcess->IsApplicable(*particle)) {
      pmanager ->AddProcess(fDecayProcess);

      // set ordering for PostStepDoIt and AtRestDoIt
      pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
      pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
  }

  // hadronic physics lists
  for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();


*******************************************************************************

The other way is to check a particle has a processManager or not in applying
the Decay Processe.

The study for more essential solution may be necessity.

Tatsumi
Comment 1 Michel.Maire 2004-11-18 05:42:59 CET
Thanks. The correction was already done, in a similar way as you suggested.
See last reference tag.