[Halld-offline] stop a trak in hdgeant4

Maria Patsyuk mpatsyuk at mit.edu
Tue May 30 12:09:23 EDT 2017

Hi Richard,

thank you for the detailed answer.

I’d like to prune at the point where they are generated, before they get posted for tracking.
Is it correct, that I need to modify GlueXStackingAction class for that?

Best regards,

On May 30, 2017, at 11:18 AM, Richard Jones <richard.t.jones at uconn.edu<mailto:richard.t.jones at uconn.edu>> wrote:


I am broadcasting this answer to the offline group because I think it is a question that will come up often, and I want to broadcast the answer to a larger audience. In your original email, you asked:

I’m looking for a proper way to stop an optical photon track in hdgeant4. Where should I do so? Is the proper place “GlueX SensitiveDetector” class or GlueXSpecialCuts?

You cannot just "stop" a particle that is being tracked in Geant4 (like you could in G3 by simply setting ISTOP=1). It was one of the design principles of the authors of G4 to prevent this. There are two ways to restrict the tracking of particles in G4 (besides not injecting them into the event in the first place):

  1.  prune them from the secondaries list when they are first spawned by some process, before they get stacked at the end of the step where they are made;
  2.  track them to the bitter end, and let them die a natural death, either by decaying, or by stopping and/or being absorbed by interactions in a medium;

If I might invoke an analogy to the legal system that normally protects human life, hdgeant4 has no built-in mechanism for capital punishment. Given that some particles can turn out to be "bad hombres" I have experimented with various ways of working around these limitations, but having no connections to the mob and feeling mildly squeemish about violating the law of Geant4, I ultimately decided against that. So in hdgeant4 we are going with the G4 design: no early "disappearance" of particles. Even though GlueXSpecialCuts seems like it might be crossing that line, it actually is not. I can give a brief talk on this, and what GlueXSpecialCuts is about, at an upcoming offline meeting, if desired.

So what can you do? If you are talking about Cerenkov photons, you either want to prune them at the point where they are generated, before they get posted for tracking ("stacked" in G4 lingo) or else you can write a new physics process (G4Process) that adds a new kind of interaction that gets invoked on every step, and takes action to terminate the particle when some condition is fulfilled. Only G4Process objects can kill/absorb/decay particles that are actively being tracked. I have nothing against you writing your own process, but there is quite a bit of detailed knowledge that goes into writing all of the mandatory methods that a G4Process must support, in addition to the small bit of code that actually does what you want to do in terminating wayward particles. Also keep in mind, once such a process is added to the simulation, it gets called on every step for every particle of the given type, so it can affect the efficiency of the simulation.

-Richard Jones

On Tue, May 30, 2017 at 9:07 AM, Maria Patsyuk <mpatsyuk at mit.edu<mailto:mpatsyuk at mit.edu>> wrote:
Hi Richard,

yes. I’m going to implement what you are saying.
My question is - in which place it is better to put?
Should I do so in GlueXSpecialCuts class?
I need a tool to stop the particle, and I don’t see an example of stopping a particle except for in the  GlueXSpecialCuts.
Please advise.

Best regards,

On May 29, 2017, at 6:33 PM, Richard Jones <rjones30 at gmail.com<mailto:rjones30 at gmail.com>> wrote:


Yes, this is a very good idea, a standard thing to do is to apply the wavelength-dependent detection efficiency already at the generation stage, and then at the detector, detect with probability one. Is this what you want to implement?


On Mon, May 29, 2017 at 11:42 AM, Maria Patsyuk <mpatsyuk at mit.edu<mailto:mpatsyuk at mit.edu>> wrote:

I’m looking for a proper way to stop an optical photon track in hdgeant4.
Where should I do so? Is the proper place “GlueX SensitiveDetector” class or GlueXSpecialCuts?
I’d like to introduce the photon detection efficiency at the production stage to save processing time (since quite a lot of optical photons anyways did not get detected, and the number of steps they are tracked is high).

Best regards,

You received this message because you are subscribed to the Google Groups "GlueX Software Help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gluex-software+unsubscribe at googlegroups.com<mailto:gluex-software%2Bunsubscribe at googlegroups.com>.
To post to this group, send email to gluex-software at googlegroups.com<mailto:gluex-software at googlegroups.com>.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_gluex-2Dsoftware_EE5408B3-2D9FFD-2D4437-2D9087-2D6D3722E32B4B-2540mit.edu&d=DwIGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=oyKV5joTkJsuRYv6hh48IMTw3i-IrYD-ZUAHHU0DdAY&m=4utfF28e0MfNjX5CwW70yi48aTJsiw4TIILjs3rb15I&s=khVcMXaCFOCx5NfkpdOnD3ge0AWz0Xi9jS9AEfbBmgY&e= .
For more options, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwIGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=oyKV5joTkJsuRYv6hh48IMTw3i-IrYD-ZUAHHU0DdAY&m=4utfF28e0MfNjX5CwW70yi48aTJsiw4TIILjs3rb15I&s=chttHMfaa-NBoGKfdhyTiLff7xLlScpE6jIaMxcYEes&e= .

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jlab.org/pipermail/halld-offline/attachments/20170530/d9222e01/attachment-0002.html>

More information about the Halld-offline mailing list