Problem 2461 - Bug in G4UserTrackingAction::PostUserTrackingAction(const G4Track* track)
Summary: Bug in G4UserTrackingAction::PostUserTrackingAction(const G4Track* track)
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: tracking (show other problems)
Version: 10.7
Hardware: PC All
: P4 minor
Assignee: Takashi.Sasaki
URL:
Depends on:
Blocks:
 
Reported: 2022-01-05 07:43 CET by Linmao Li
Modified: 2022-01-11 09:47 CET (History)
0 users

See Also:


Attachments
The class I derived from G4UserTrackingAction (29.92 KB, image/png)
2022-01-11 09:25 CET, Linmao Li
Details
The definition of "PostUserTrackingAction(const G4Track*)" (19.81 KB, image/png)
2022-01-11 09:27 CET, Linmao Li
Details
The program crashed (19.08 KB, image/png)
2022-01-11 09:41 CET, Linmao Li
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Linmao Li 2022-01-05 07:43:06 CET
When a member function of "track" such as "track->GetCreatorProcess()" is called in "G4UserTrackingAction::PostUserTrackingAction(const G4Track* track)", i.e., "fpUserTrackingAction->PostUserTrackingAction(fpTrack);" in "G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)", a "segmentation fault" error will ocuur.
Comment 1 Takashi.Sasaki 2022-01-05 07:55:33 CET
UserTrackingAction is what you provided. Debug your code, please.
Comment 2 Linmao Li 2022-01-11 09:25:59 CET
Created attachment 744 [details]
The class I derived from G4UserTrackingAction

The header of the class I derived from G4UserTrackingAction
Comment 3 Linmao Li 2022-01-11 09:27:24 CET
Created attachment 745 [details]
The definition of "PostUserTrackingAction(const G4Track*)"
Comment 4 Linmao Li 2022-01-11 09:41:10 CET
Created attachment 746 [details]
The program crashed
Comment 5 Linmao Li 2022-01-11 09:43:34 CET
Maybe I didn't make it clear.

I created "class TrackingAction" derived from "G4UserTrackingAction".
Then I overrode the member function "virtual void PostUserTrackingAction(const G4Track*)", where I call the member functions of "G4Track", for example, "G4String creatorProcessName = track->GetCreatorProcess()->GetProcessName();"
Then the program crashed。

You can see the pictures I submitted.
Comment 6 Takashi.Sasaki 2022-01-11 09:47:38 CET
Please debug your program by yourself. I cannot afford to help you privately. We, developers, are unpaid volunteers.