Hello experts, I have a question:
I have a simple geometry, two slices of stainless steel,inside a “vacuum” world(G4_Galactic)
The slices are 100 x 20 x 5 cm (x,y,z) and with a 5 cm distance from another(See below)
There is a global electric field in between, but not inside the slices(I did set it to zero via LocalFieldManager).
The source is 800 MeV photons placed at (0,0,0) and are shot whith a small angle in order to hit the “right” box, which is a sensitive detector, so it can record hits.
I needed to count the number of some particles, so I followed the advice in this topic:
And finally on to the potential problem.
I declared the “left” box as a different (meaning, I have a unique class that describes the “right” slice and another class that describes the “left” slice) sensitive detector, which has a unique collection of hits.Thus I have 2 sensitive detectors (and two HitsCollections)
So, the proton hits the “right” slice, some electrons may escape, go across the gap and interact with the “left” slice and produce more electrons.
I need to count how many electrons are the result of the “right” slice-electrons that passed the gap.
My approach is:
I use two std::vector TrackID, one for each slice.
These 2 vectors are filled at G4Step.
Next I check, if the two vectors have any elements in common (with std::set_intersection).
If they have any TrackID in common, then it is given in a third
std::unordered_set commonTrackID. This set is filled by the std::set_intersection.
Then, I simply remove any TrackID from the “left” slice std::vector TrackID that matches the set mentioned in (2). If there is anything left inside the “left” TrackID vector, it is the result of the “right”
electrons that crossed the gap and interacted with the “left” slice.
I clear everything at the end of each event
Is this a correct approach?
Are the trackID from Geant4 “global” per event (and all distinct sensitive detectors)?
For example, an electron that escaped form the “right” slice (let’s say it has TrackID=10 on the “right” slice), crosses the gap and interacts with the “left” slice will be detected with TrackID=10 there?
Is there possibly any other problem I can’t think of?
Sorry for the long post, but I’m still learning to use geant4, so any help is greatly appreciated!
PS: I forgot to mention that I run Geant4 in MT mode