<html>
<head>

</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Richard,
<div class=""><br class="">
</div>
<div class="">thank you for the detailed answer.</div>
<div class=""><br class="">
</div>
<div class="">I’d like to prune at the point where they are generated, before they get posted for tracking.</div>
<div class="">Is it correct, that I need to modify GlueXStackingAction class for that?</div>
<div class=""><br class="">
</div>
<div class="">Best regards,</div>
<div class="">Maria</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On May 30, 2017, at 11:18 AM, Richard Jones <<a href="mailto:richard.t.jones@uconn.edu" class="">richard.t.jones@uconn.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Maria,
<div class=""><br class="">
</div>
<div class="">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:</div>
<div class=""><br class="">
</div>
<div class=""><i class=""><span style="font-size:12.8px" class="">I’m looking for a proper way to stop an optical photon track in hdgeant4. </span><span style="font-size:12.8px" class="">Where should I do so? Is the proper place “GlueX SensitiveDetector” class
 or GlueXSpecialCuts?</span></i><br class="">
</div>
<div class=""><i class=""><span style="font-size:12.8px" class=""><br class="">
</span></i></div>
<div class=""><span style="font-size:12.8px" class="">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):</span></div>
<div class="">
<ol class="">
<li class=""><span style="font-size:12.8px" class="">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;</span></li><li class=""><span style="font-size:12.8px" class="">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;</span></li></ol>
</div>
<div class=""><span style="font-size:12.8px" class="">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.</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class="">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.</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class="">-Richard Jones</span></div>
<div class=""><i class=""><span style="font-size:12.8px" class=""><br class="">
</span></i></div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Tue, May 30, 2017 at 9:07 AM, Maria Patsyuk <span dir="ltr" class="">
<<a href="mailto:mpatsyuk@mit.edu" target="_blank" class="">mpatsyuk@mit.edu</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi Richard,
<div class=""><br class="">
</div>
<div class="">yes. I’m going to implement what you are saying.</div>
<div class="">My question is - in which place it is better to put?</div>
<div class="">Should I do so in GlueXSpecialCuts class?</div>
<div 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.</div>
<div class="">Please advise.</div>
<div class=""><br class="">
</div>
<div class="">Best regards,</div>
<div class="">Maria</div>
<div class="">
<div class="h5">
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On May 29, 2017, at 6:33 PM, Richard Jones <<a href="mailto:rjones30@gmail.com" target="_blank" class="">rjones30@gmail.com</a>> wrote:</div>
<br class="m_1035841491089293241Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Maria,
<div class=""><br class="">
</div>
<div class="">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?</div>
<div class=""><br class="">
</div>
<div class="">-Richard</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Mon, May 29, 2017 at 11:42 AM, Maria Patsyuk <span dir="ltr" class="">
<<a href="mailto:mpatsyuk@mit.edu" target="_blank" class="">mpatsyuk@mit.edu</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br class="">
<br class="">
I’m looking for a proper way to stop an optical photon track in hdgeant4.<br class="">
Where should I do so? Is the proper place “GlueX SensitiveDetector” class or GlueXSpecialCuts?<br class="">
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).<br class="">
<br class="">
Best regards,<br class="">
Maria<br class="">
<span class="m_1035841491089293241HOEnZb"><font color="#888888" class=""><br class="">
--<br class="">
You received this message because you are subscribed to the Google Groups "GlueX Software Help" group.<br class="">
To unsubscribe from this group and stop receiving emails from it, send an email to
<a href="mailto:gluex-software%2Bunsubscribe@googlegroups.com" target="_blank" class="">
gluex-software+unsubscribe@goo<wbr class="">glegroups.com</a>.<br class="">
To post to this group, send email to <a href="mailto:gluex-software@googlegroups.com" target="_blank" class="">
gluex-software@googlegroups.co<wbr class="">m</a>.<br class="">
To view this discussion on the web visit <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_gluex-2Dsoftware_EE5408B3-2D9FFD-2D4437-2D9087-2D6D3722E32B4B-2540mit.edu&d=DwMGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=oyKV5joTkJsuRYv6hh48IMTw3i-IrYD-ZUAHHU0DdAY&m=4utfF28e0MfNjX5CwW70yi48aTJsiw4TIILjs3rb15I&s=khVcMXaCFOCx5NfkpdOnD3ge0AWz0Xi9jS9AEfbBmgY&e=" rel="noreferrer" target="_blank" class="">
https://groups.google.com/d/ms<wbr class="">gid/gluex-software/EE5408B3-9F<wbr class="">FD-4437-9087-6D3722E32B4B%40mi<wbr class="">t.edu</a>.<br class="">
For more options, visit <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwMGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=oyKV5joTkJsuRYv6hh48IMTw3i-IrYD-ZUAHHU0DdAY&m=4utfF28e0MfNjX5CwW70yi48aTJsiw4TIILjs3rb15I&s=chttHMfaa-NBoGKfdhyTiLff7xLlScpE6jIaMxcYEes&e=" rel="noreferrer" target="_blank" class="">
https://groups.google.com/d/op<wbr class="">tout</a>.<br class="">
</font></span></blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>