Message: Re: possible flagging the process at the prepoint ? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: possible flagging the process at the prepoint ? 

Forum: Event and Track Management
Re: Question possible flagging the process at the prepoint ? (David Sangcheol Lee)
Re: Idea Re: possible flagging the process at the prepoint ? (filippo)
Re: Ok Re: possible flagging the process at the prepoint ? (David Sangcheol Lee)
Re: Feedback Re: possible flagging the process at the prepoint ? (Michael H. Kelsey)
Re: Question Re: possible flagging the process at the prepoint ? (David Sangcheol Lee)
Date: 09 Oct, 2018
From: Michael H. Kelsey <Michael H. Kelsey>

David Sangcheol Lee writes:
> Thank you so much for your reply, Michael. I understand completely what
> you are saying. It helps me what I am trying to see from the simulation.
> 
> Just the problem is that if I call that process from pre point, should
> it be printing out something right instead of the simulation going
> segmentation error?

You need to check the pointers before you dereference them:

  G4StepPoint* prepoint = theStep->GetPreStepPoint();
  if (pre) {
    G4cout << "PreStepPoint is null" << G4endl;
    return;
  }

  G4VProcess* preproc = prepoint->GetProcessDefinedStep();
  if (!preporc) {
    G4cout << "No PreStepPoint process: first step?" << G4endl;
    return;
  }

  G4cout << "The previous step was limited by " << preproc->GetProcessName()
         << G4endl;

If you dereference a null pointer, that's a segmentation fault.

    -- Michael Kelsey

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

1 Ok: Re: possible flagging the process at the prepoint ?   (David Sangcheol Lee - 09 Oct, 2018)
 Add Message Add Message
to: "Re: possible flagging the process at the prepoint ?"

 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 ]