Message: Uninitialized volume pointers in G4Track? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Uninitialized volume pointers in G4Track? 

Forum: Event and Track Management
Date: 01 Oct, 2007
From: Ben Loer <bloer@princeton.edu>

Hi all,

I just came across a rather irritating bug(?) in G4Track. The following code snippet is from my UserStackingAction:

G4ClassificationOfNewTrack PUStackingAction::ClassifyNewTrack
                                            (const G4Track* aTrack)
{
  G4cout<<"Starting new stage"<<G4endl;
  if(aTrack->GetParentID()==0){/
    //This is a primary particle
    G4cout<<"Primary particle released!"<<G4endl;
    if(aTrack->GetVolume()) 
       //G4cout<<aTrack->GetVolume()->GetName()<<G4endl;
  }
  return fUrgent;
}

This causes a bus error when it encounters the if(aTrack->GetVolume()) line. I'm no C++ expert, but I thought that just checking to see if the pointer was empty should be safe, unless its not initialized.

Any suggestions on what else this could be? Or should I start a bug report?

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

1 None: RE: Uninitialized volume pointers in G4Track?   (Makoto Asai - 01 Oct, 2007)
2 None: RE: Uninitialized volume pointers in G4Track?   (Makoto Asai - 01 Oct, 2007)
1 None: RE: Uninitialized volume pointers in G4Track?   (Henrik - 13 Feb, 2008)
 Add Message Add Message
to: "Uninitialized volume pointers in G4Track?"

 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 ]