[Halld-offline] stop a trak in hdgeant4

Richard Jones richard.t.jones at uconn.edu
Tue May 30 11:18:17 EDT 2017


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
   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

-Richard Jones

On Tue, May 30, 2017 at 9:07 AM, Maria Patsyuk <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,
> Maria
> On May 29, 2017, at 6:33 PM, Richard Jones <rjones30 at gmail.com> wrote:
> Maria,
> 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?
> -Richard
> On Mon, May 29, 2017 at 11:42 AM, Maria Patsyuk <mpatsyuk at mit.edu> wrote:
>> Hi,
>> 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,
>> Maria
>> --
>> 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.
>> To post to this group, send email to 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_ms&d=DwIFaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=oyKV5joTkJsuRYv6hh48IMTw3i-IrYD-ZUAHHU0DdAY&m=cIi9TaqCMuSaA3lpXJGx526_Q2l40LCc5szgpXrCkY0&s=WGR7OcbFKJFOqdLsST_O04nNbFzpyA1z60HebmMgUpQ&e= 
>> gid/gluex-software/EE5408B3-9FFD-4437-9087-6D3722E32B4B%40mit.edu.
>> For more options, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwIFaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=oyKV5joTkJsuRYv6hh48IMTw3i-IrYD-ZUAHHU0DdAY&m=cIi9TaqCMuSaA3lpXJGx526_Q2l40LCc5szgpXrCkY0&s=-BMgobvItmOM_h3L8ciYdWiF-vHKp4ZcYV6MOcDiVpA&e= .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jlab.org/pipermail/halld-offline/attachments/20170530/5e3c7638/attachment.html>

More information about the Halld-offline mailing list