[Halld-offline] stop a trak in hdgeant4

Richard Jones richard.t.jones at uconn.edu
Tue May 30 12:42:05 EDT 2017


Maria,

Yes, in GlueXStackingAction::ClassifyNewTrack, if you return fKill it will
never be handed off to the tracking loop. This method gets called thousands
of times per event, so try to make any actions you do efficient. For
example, you might hide your code inside some if blocks that are fast to
compute, like selecting on particle type before probing the geometry
navigator.

-Richard

On Tue, May 30, 2017 at 12:09 PM, Maria Patsyuk <mpatsyuk at mit.edu> wrote:

> 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,
> Maria
>
> On May 30, 2017, at 11:18 AM, Richard Jones <richard.t.jones at uconn.edu>
> wrote:
>
> Maria,
>
> 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> 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=dHf2eZB5Qhsm7CKXNc-pVgTCcPW1miXEv1FqHslpOY4&s=vUDeGyZk9ZdDmtbnaclwBMasHzcTFkO2P5_Gq_3LgmU&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=dHf2eZB5Qhsm7CKXNc-pVgTCcPW1miXEv1FqHslpOY4&s=nDtN3vaWZAeLex2EgvxYpQUTd3QuYt9W1m0B_Ni2Bqc&e= .
>>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jlab.org/pipermail/halld-offline/attachments/20170530/c9524504/attachment-0002.html>


More information about the Halld-offline mailing list