Distinguish detectors for readout

The $G4INCLUDE/G4TouchableHistory.hh file reveals that there is a public member function GetHistoryDepth().

1 Like

Thank you, mkelsey, that worked!

So far everything is technically working but something is not right, though. I’m not sure where to look after it. The issue is that all detectors are facing or detecting the same amount of photons.

Thanks a lot in advance! Any hint and idea is highly appreciated!

Ok, at least I figured out where the number 4111 comes from: tree->GetEntriesFast().
Though it assumes each branch has the same number of entries…

Meanwhile I could determine that the number 4111 is the sum of all detectors. The detectors see a varying amount of photons from around ~500 to ~900 and all these detectors summed equal to 4111.
Now I just don’t know why the histograms contain more entries than they should.

Solution: I solved that issue by using a tree for each detector instead of assigning the hits to branches of the same tree.

If you include your unique identifier as one of the branches, then in your analysis code you can filter on that identifier to get histograms for each detector individiually. E.g., mydata->Draw("Edep","DetNum=5").

1 Like

Thank you very much for your advice(s)!

I’m facing another issue I guess I finally understood: Until now, I wrapped several objects around my detectors which is working well. Due to some minor changes the detectors are now not inside all the other objects but instead they are now a daughter together with two other objects of the same object. This is depicted here:

For both particles I’m always receiving the same depth history which never shows the particle going through the blue and or green object.
I’m assuming meanwhile that the history doesn’t show this because the red object is neither a daughter of the blue or the green object.
Is this true? If so, how do I resolve this?

Thanks a lot in advance!

The Touchable (“depth history”) will only show grey+one-color for each of your hits, because those three are all children of the grey. The depth history does NOT tell you anything about the trajectory. All it is telling you is the mother-daughter structure of your geometry.

If you want to know the path of your tracks (e.g., grey-green-grey-blue-grey-red for your lower track), then you need to either store the step information you collect in your SD, or you can look at the cumulative track trajectory (G4Trajectory).

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.