Minimal example of the G4VUserTrackInformation application

Dear colleagues, could you demonstrate a minimal working example with G4VUserTrackInformation? The “extended/runAndEvent/RE01” is too large to catch the point. When I try something like

class TI : public G4VUserTrackInformation 
{
	public:
	string s;
};
....
void GGSteppingAction::UserSteppingAction(const G4Step* step)
{
        G4Track * theTrack = step->GetTrack();
	if(theTrack->GetUserInformation())
	{
		cout<<((TI*)theTrack->GetUserInformation())->s<<"\n";
	}
        else
        {
                TI *tt=new TI;
		tt->s="test";
                theTrack->SetUserInformation(tt);
        }
        
}

it doesn’t work.

1 Like