# Boundary issue on detector

**URL:** <https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435>\
**Category:** Recording, Visualizing and Persisting Data\
**Created:** [January 8, 2025, 9:55am UTC](https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435 "2025-01-08T09:55:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HyeonSeok-Do](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/hyeonseok-do/32/8486_2.png) [@HyeonSeok-Do](https://geant4-forum.web.cern.ch/u/HyeonSeok-Do)\
**Post date:** [January 8, 2025, 9:55am UTC](https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435/1 "2025-01-08T09:55:56Z")

</div>

Please fill out the following information to help in answering your question, and also see [tips for posting code snippets](https://geant4-forum.web.cern.ch/t/how-to-post-code-snippets/9944). If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_  
_Operating System:_  
_Compiler/Version:_  
_CMake Version:_

* * *

Hello,  
I’m a newbie of geant4.  
And I have a question.

I created a detector by arranging rectangular parallelepiped pixels of the same size in a 21\*41 grid, and each pixel of the detector was numbered from 0 to 860.

 ![image](https://geant4-forum.web.cern.ch/uploads/default/original/2X/e/eaaca8fc5899242791d46d3fa9739fa9a054cf33.jpeg)  
It’s just “XY plane” of my detector.

I want to record the pixel number corresponding to the location where the primary particle is StopAndKill, and I would like to know how to deal with it conventionally if it becomes StopAndKill at the “intersection of the grid” or the “boundary of the two pixels”.  
When I tested it (I shot the particle at the intersection of the detector and checked the incident pixels), one of the values of four or two adjacent pixels was recorded at the intersection or the boundary of two pixels.  
However, in reality, I think it is impossible for particles to exist on the boundary accurately, so I think the above results are wrong.

I guess boundary issues might be very common in geant4 simulation, and I would like to know how experts at geant4 cope with these situations to overcome the limitations of these simulations.

I really appreciate your help.

---

<div class="post-metadata">

**Author:** ![jrellin](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jrellin](https://geant4-forum.web.cern.ch/u/jrellin)\
**Post date:** [January 8, 2025, 8:07pm UTC](https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435/2 "2025-01-08T20:07:39Z")

</div>

The question is really do you have actually segmented silicon or if its only the readout (of a monolithic slab) that you have. If it is the former than a signal generated in one pixel, even if its boundary, would not induce a signal in another at least related to the charge (electronic cross talk would be outside what Geant4 is designed for). If it is the latter than it is better to just record the x, y, z of the particle at rest. But really you would want to know the entire track history. So it depends on what you are doing or trying to model.

If you just want to know where the particle is stopped than the easiest thing would be to overwrite PostUserTrackingAction. PostUserTrackingAction is called whenever the track ends including if it triggers AtRest processes or is killed. You could check that the particle is your particle type of interest and just record the x,y, and z position there. If the silicon is pixelated you could use paramterized geometry placement which would allow for you to assign a pixel ID to the individual pixel. If its a slab, then just keep the x, y, z and handle later.

---

<div class="post-metadata">

**Author:** ![HyeonSeok-Do](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/hyeonseok-do/32/8486_2.png) [@HyeonSeok-Do](https://geant4-forum.web.cern.ch/u/HyeonSeok-Do)\
**Post date:** [January 10, 2025, 11:53am UTC](https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435/3 "2025-01-10T11:53:12Z")

</div>

Thank you for your apply.

In my case, I’m dealing with segmented silicon.  
In your answer, “If it is the former than a signal generated in one pixel, even if its boundary, would not induce a signal in another at least related to the charge.”

I have a few more questions.

It’s a very small probability, but if the particle ended the process at exactly the boundary of two pixels, for example, if the particle stopped at the complete boundary between pixel 1 and pixel 2, should this particle be stopped at pixel 1 or stopped at pixel 2, or should I exclude such low probability cases?

I’ve personally considered this approach:  
What do you think about making a gap between each pixel less than the minimum distance recognized by geant4, wrapping all the pixels using silicon, and excluding the event that the particles come to rest in the gap between each pixel?

I know that this would happen rarely, maybe I’m just concentrating on unnecessary things.  
But I want to know about the experts’ ideas or conventions as a newbie geant4 user.

I really thank you for your apply, it helps me a lot! Thank you.

---

<div class="post-metadata">

**Author:** ![jrellin](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jrellin](https://geant4-forum.web.cern.ch/u/jrellin)\
**Post date:** [January 10, 2025, 8:12pm UTC](https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435/4 "2025-01-10T20:12:36Z")

</div>

> [@HyeonSeok-Do](#):
>
> It’s a very small probability, but if the particle ended the process at exactly the boundary of two pixels, for example, if the particle stopped at the complete boundary between pixel 1 and pixel 2, should this particle be stopped at pixel 1 or stopped at pixel 2, or should I exclude such low probability cases?

I am not sure why you are expecting such events to take place. There should be no “boundary” cases since the volumes should not overlap. If the pixels are sensitive, than a particle will only ever interact with/stop in 1 pixel at a time.

```auto
What do you think about making a gap between each pixel less than the minimum distance recognized by geant4

```

There is no such distance outside of floating point errors. The production cut range for charged particles is to avoid runaway infrared cascade.

---

<div class="post-metadata">

**Author:** ![system](https://geant4-forum.web.cern.ch/uploads/default/original/1X/ce519a43ebdf7ac48a98a03c6ad6eea013b68c46.png) [@system](https://geant4-forum.web.cern.ch/u/system)\
**Post date:** [January 17, 2025, 8:13pm UTC](https://geant4-forum.web.cern.ch/t/boundary-issue-on-detector/13435/5 "2025-01-17T20:13:21Z")

</div>

Closed on January 17, 2025, 8:13pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
