Message: Re: information on ancestor particles Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Re: information on ancestor particles  

Keywords: ancestor particles mother particles
Forum: Event and Track Management
Re: None information on ancestor particles (Holger Gottschlag)
Re: None Re: information on ancestor particles (Makoto Asai)
Date: 11 May, 2007
From: Holger Gottschlag <>

Thanks for your reply! 

As shown in
i put this into my code: 

T01Trajectory* SteppingAction::GetParentTrajectory(G4int parentID)
  G4TrajectoryContainer* container = 
  if(container==0) return 0;
  TrajectoryVector* vect = container->GetVector();
  G4VTrajectory** tr = vect->begin();      // did not compile
    T01Trajectory* tr1 = (T01Trajectory*)tr;
    if(tr1->GetTrackID()==parentID) return tr1;  //segmentation fault here
    G4cout<<"debug: " << debug << endl;
  return 0;
which unfortunaly leads to this error message:

src/ error: cannot convert `
   __gnu_cxx::__normal_iterator<G4VTrajectory**, std::vector<G4VTrajectory*,
   std::allocator<G4VTrajectory*> > >' to `G4VTrajectory**' in initialization
src/ error: no match for 'operator!=' in 'tr !=
   std::vector<_Tp, _Alloc>::end() [with _Tp = G4VTrajectory*, _Alloc =

so it looks like "G4VTrajectory" does not fit to "vect->begin()", which is an iterator.  

when i change the lines

"G4VTrajectory** tr = vect->begin();"


"G4VTrajectory* tr = *(vect->begin());"

The Code compiles well, but i get a Segmentation Fault at Run Time 
in Line 

"if(tr1->GetTrackID()==parentID) return tr1;"

Did anyone solve that problem yet? 

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

1 Note: Re: information on ancestor particles   (Holger Gottschlag - 11 May, 2007)
 Add Message Add Message
to: "Re: information on ancestor particles "

 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 ]