Time window of detection

Hello, i created a setup with two detectors and scintillation material.
Also i generated a source with one gamma at time=0 and two other gammas after a certain lifetime.
So my problem is, i want only the scintillation hits in a time window of 200ns if i get a hit with the first gamma in one detector and one of the other two gammas in the other detector. All hits of other events aren’t relevant.
Do anyone has an idea how to solve this problem?

It sounds like you’re doing a coincidence experiment. You could do this within your simulation using a SteppingAction, where you set a flag and store the hit when one of the detectors is hit (make sure you store the event number as well, and reset everything when the event changes!), and then watch for a hit in the other detector within 200 ns.

Alternatively, you could store hits from both detectors into an N-tuple (including information like event number, hit times and energies, etc.), and implement the trigger window in your offline analysis code.

@mkelsey : Following the second approach, I save GlobalTime for each entry but that is unchanged for every entry of that event; as the decay primary source has really large half-life. How can I compare the timing of two entries (of respective two detectors) in my post-analysis; as I essentially see both times the same? Is there a way to reset the time at the start of each event or any alternative means to implement for a beginner like me?

I see. Do you need the half-life time distribution of primaries for your analysis? Or would you be happy if each event started with time t=0 after the decay?

In our experiment, we wrote a wrapper class around G4RadioactiveDecay, with a flag to reset the daughter times to match the parent track time. But that only works if you’re only generating one decay per event.

Thanks, yes i’m doing a coincidence experiment.
Is there an example for a coincidence experiment in the geant4 examples?

Hi @Dominik_Boras,

I am also stuck in a similar situation. Can you please share how you managed to create a user defined source with user specified lifetimes of the gammas ?

Was it by modifying the Photo evaporation and or radioactive decay datasets?

Thanks q ton in advance!

Hi Mike,

I saw your posts about coincident forming simulations. You seem to have mastered this in Geant4. How does one best tie a gamma to a particular decay? If I have 1000 decays and there is a gamma detected in my detector, how do I know which of the 1000 decays it came from? If I can solve that, then I think I can form coincidences for events detected from the say decay.

thanks in advance.

When you say “1000 decays”, do you mean you generated 1000 separate events (/run/beamOn 1000) each with a single primary decay? Or are you looking at pile-up type events?

If each event is just one decay, then you should write your data out as an N-tuple, and include the event number as one of the columns.

I don’t really know how I’m generating the decays. I’m using TOPAS and I’m assuming it does a /run/beamOn 1000 where each decay is it’s own “event”. So I did just as you said, write the event and run ID’s into the intuple and I use the event ID to tag coincidences. The problem is that I’m getting very poor coincident detection efficiency compared to the actual detector setup I have in my lab. So I think the event ID method of determining if two detectors were hit from gammas emitted from the same decay may not be correct.

In the larger scheme of things, I’d like to learn more about how Geant4 keeps time within its simulations. If you can point me to the documentation that would be a great help.

Thanks.

Hi Mike, I solved my problem. Using Event ID did work, but my coincidence tagging algorithm assumed the event ID’s in the ntuple would be in ascending order. I suppose from the multi-threading execution of the simulation, the event ID’s were somewhat scrambled. So I added a sorting routine and I’m now getting very impressive results.

Thanks.

Glad it worked! Your discovery about MT is exactly right: the event IDs are assigned to each thread in advance (in “blocks”, basically). The order they get written out depends on which thread finishes first, second, third, etc.

In our experiment, I have a singleton RunAction utility protected by mutex, which keeps it’s own “event number” counter. We increment that and write it to the output, in place of the Geant4 GetEventID(). That ensures that the output sees sequential event numbers.

Hi Mike,

On further analysis of my coincidence tagging, I’m finding what I call are impossible coincidences. for example I have a Cs137 source and run the monte carlo and I end up tagging two 661 keV gammas with the same event ID, when only 1 should be generated per decay. Any idea where I should look to find out what is going on? The probability of this happening is very small, but it’s not zero as it should be.

Hi Mike, Ignore my last reply. It was a bug in my code.