Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gate 9.0 does not fill Hits Tree #350

Closed
ckaraf opened this issue Jul 21, 2020 · 9 comments
Closed

Gate 9.0 does not fill Hits Tree #350

ckaraf opened this issue Jul 21, 2020 · 9 comments

Comments

@ckaraf
Copy link

ckaraf commented Jul 21, 2020

I have compiled Gate 9.0 using Geant 10.6.2 and root 6.22.00.
However, when I run my script Gate does not fill the Hits Tree although I use:

/gate/output/root/enable
/gate/output/root/setRootNtupleFlag 1
/gate/output/root/setRootHitFlag 1
/gate/output/root/setRootSinglesFlag 1

Gate 8.2 fills the Hits tree correctly.

@djboersma
Copy link
Contributor

djboersma commented Aug 31, 2020

I think that the same problem is now reported on the user mailing list with more details:
http://lists.opengatecollaboration.org/pipermail/gate-users/2020-August/011878.html

I'm wondering if this has anything to do with the memory leak issues (e.g. #257) that were solved in Nov/Dec 2019, PR #266. @cpommranz , could you maybe comment on this? I might be completely off, of course, but I just wonder if the problem reported here could be an unintended side effect of that mem leak fix.

@cpommranz
Copy link
Contributor

This seems to be correct @djboersma, good catch!

Without having deeply looked into this, all I can say right now is that the problem disappears as soon as PR #266 is reverted. But by reverting the PR, we get the memory leak back (also for the test simulation given in the linked mail). I will have a look into this again soon.

@cpommranz
Copy link
Contributor

It turns out that G4SDManager::GetSDMpointer()->Activate(name, false); sets the sensitive detector itself to inactive. This inactive SD is later attached to the GateMultiSensitiveDetector.

The underlying problem is, as written in the commit message in PR #266, that Geant4 does not expose the G4SDStructure member function void RemoveSD(G4VSensitiveDetector*) and we therefore have no way to properly detach a SD from a volume. The only workaround (a very ugly one) I could find right now is to add a cloned but inactive version of the SD to the G4SDManager (which implicitly will remove the original and active SD) and use the original SD for the GateMultiSensitiveDetector. This is a rather dirty hack, so if anyone comes up with a better solution, I would very much appreciate it.

In parallel, I think we should try to get a RemoveDetector (or similar) member function into upstream Geant4's G4SDManager, similar to void AddNewDetector(G4VSensitiveDetector*aSD).

cpommranz added a commit to cpommranz/Gate that referenced this issue Sep 8, 2020
Previously, the inactive SD was attached to the
GateMultiSensitiveDetector, leading to an empty hit list. Since the
G4SDStructure member function `RemoveSD` is not exposed and we are
therefore unable to properly remove the original SD from the
G4SDManager, an inactive clone SD is added to the SD manager, which will
implicitly remove the original one. The original and active SD can then
be attached to the multi sensitive detector.

This is a rather dirty workaround and should be removed once `RemoveSD`
or similar is exposed in Geant4.

Note that a Geant4 warning message is raised in case
GEANT4_BUILD_VERBOSE_CODE is set.

Refs OpenGATE#350, OpenGATE#335
@dsarrut
Copy link
Contributor

dsarrut commented Sep 14, 2020

merge #354

@dsarrut dsarrut closed this as completed Sep 14, 2020
@dsarrut
Copy link
Contributor

dsarrut commented Sep 14, 2020

Please @ckaraf, could you check if it works with this solution ?

@ckaraf
Copy link
Author

ckaraf commented Sep 14, 2020 via email

@ckaraf
Copy link
Author

ckaraf commented Sep 25, 2020 via email

@jasqs
Copy link

jasqs commented Sep 25, 2020

Hi,

I confirm the same. I have tested this and it gives the same results as Gate 8.2.

thanks

@dsarrut
Copy link
Contributor

dsarrut commented Sep 25, 2020

cool! Big 👍 to @cpommranz !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants