Problem 2422 - PreUserTrackingAction called more than once for the same particle (primary or not) when the option "TrackSecondariesFirst" is set for the optical processes
Summary: PreUserTrackingAction called more than once for the same particle (primary o...
Status: RESOLVED DUPLICATE of problem 2425
Alias: None
Product: Geant4
Classification: Unclassified
Component: tracking (show other problems)
Version: 10.7
Hardware: All All
: P4 normal
Assignee: Shogo Okada
URL:
Depends on:
Blocks:
 
Reported: 2021-09-15 16:21 CEST by bernardo
Modified: 2021-12-14 22:37 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description bernardo 2021-09-15 16:21:54 CEST
I first found this in my code so decided to check in  the LXe extended example.
Inserting in LXeTrackingAction::PreUserTrackingAction the line 

if (aTrack->GetUserInformation())
   G4cout << aTrack->GetTrackID() << G4endl;


and running with the cerenkov.mac macro, you will see the track id being written.
However if the option SetTrackSecondariesFirst is set to false in the LXe.cc : 

opticalParams->SetCerenkovTrackSecondariesFirst(false);

the above output will go silent.

Given that in this specific example (as I am doing in my code) a new object of the 
UserTrackInformation class is created for each call to PreUserTrackingAction, this results in a potential memory leak, because (I think...) only the last created UserTrackInformation object is deleted when the associated G4Track object is destroyed. In fact I could check that the memory consumption was increasing in the case with  SetTrackSecondariesFirts true.

Bernardo Tomé
Comment 1 Takashi.Sasaki 2021-09-16 02:18:49 CEST
Shogo, please investigate this.
Comment 2 asai 2021-12-14 22:37:24 CET

*** This problem has been marked as a duplicate of problem 2425 ***