Message: Re: problem physicslist with G4IonInelasticProccess Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: problem physicslist with G4IonInelasticProccess 

Forum: Physics List
Re: Question problem physicslist with G4IonInelasticProccess (T.D.Trong)
Date: 13 Sep, 2011
From: Joel Long <Joel Long>

On Mon, 12 Sep 2011 07:19:31 GMT, T.D.Trong wrote:
> I'm new in Geant4, I am simulating nuclear reaction in Carbon target
> with beam C11,12,13,14. To start simulation I modify example N03. But I
> have a problem with "Segmentation fault". Please help me: I am using
> geant4.9.4.p01 and modify "" of example Novice N03.
> when I added process "G4IonInelasticProcess" to ion's process:
> #include "G4IonInelasticProcess.hh"
> #include "G4BinaryLightIonReaction.hh"
> #include "G4TripathiCrossSection.hh"
> .............
>  } else if( particleName == "GenericIon" ) { 
>       //Ions 
>       pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
>       pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);     
> //* new add
>         G4IonInelasticProcess* theIonInelasticProcess = new G4IonInelasticProcess();
>         G4BinaryLightIonReaction* theIonInelasticModel  = new G4BinaryLightIonReaction();
>         theIonInelasticModel->SetMinEnergy(100*MeV);
>         theIonInelasticModel->SetMaxEnergy(10*GeV);
>         theIonInelasticProcess->RegisterMe(theIonInelasticModel);
>         G4TripathiCrossSection* tripathiData = new G4TripathiCrossSection();
>         theIonInelasticProcess->AddDataSet(tripathiData);
>         pmanager->AddDiscreteProcess(theIonInelasticProcess);
> // end add
>       } else if ((!particle->IsShortLived()) &&  
> ...........
> When I run it has segmentation fault. I don't know why? please help me.
> Thanks. ps: Sorry, because my English not good. :D


This sounds like a general programming problem rather than a Geant4 problem. A segmentation fault is a type of error that occurs when the computer follows a pointer and finds nothing at the other end. These are notoriously frustrating to debug. I would suggest looking at this guide to sorting them out:

It isn't immediately obvious to me whether your segfault is even originating in the posted code, but I would suggest printing the values of pmanager and particle:


If either one of these prints out as 0x0, then that is where your segfault is coming from, and you need to make sure they are not null pointers before you reference them.

Hope this helps, Joel

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: problem physicslist with G4IonInelasticProccess   (T.D.Trong - 13 Sep, 2011)
 Add Message Add Message
to: "Re: problem physicslist with G4IonInelasticProccess"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]