# How to determine position with the mesh scoring data?

**URL:** <https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890>\
**Category:** Recording, Visualizing and Persisting Data\
**Created:** [October 5, 2022, 3:37pm UTC](https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890 "2022-10-05T15:37:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.rajabnejad](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/m.rajabnejad/32/5188_2.png) [@m.rajabnejad](https://geant4-forum.web.cern.ch/u/m.rajabnejad)\
**Post date:** [October 5, 2022, 3:37pm UTC](https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890/1 "2022-10-05T15:37:42Z")

</div>

Hello everyone,  
I want to plot the dose vs depth(z-axis). I used mesh scoring to extract the data and have many data for (ix,iy, iz).  
How I can understand the exact z?

---

<div class="post-metadata">

**Author:** ![mkelsey](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/mkelsey/32/49_2.png) [@mkelsey](https://geant4-forum.web.cern.ch/u/mkelsey)\
**Post date:** [October 5, 2022, 5:01pm UTC](https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890/2 "2022-10-05T17:01:42Z")

</div>

You can’t. The mesh scoring is by design binned. You can assign an “effective z” corresponding to the midpoint of the bin, if you want to do that.

If you want to save the exact (x,y,z) coordinates, then you should be filling an N-tuple with hits. You can then choose to do whatever binning you want in your analysis code.

---

<div class="post-metadata">

**Author:** ![m.rajabnejad](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/m.rajabnejad/32/5188_2.png) [@m.rajabnejad](https://geant4-forum.web.cern.ch/u/m.rajabnejad)\
**Post date:** [October 7, 2022, 2:54pm UTC](https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890/4 "2022-10-07T14:54:36Z")

</div>

Hi, thanks for your response.  
What you are trying to tell me(N-tuple), is that I should use RunAction and EventAction…?  
how can I assign an “effective z” in mesh scoring?

---

<div class="post-metadata">

**Author:** ![mkelsey](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/mkelsey/32/49_2.png) [@mkelsey](https://geant4-forum.web.cern.ch/u/mkelsey)\
**Post date:** [October 7, 2022, 4:26pm UTC](https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890/5 "2022-10-07T16:26:58Z")

</div>

> [@m.rajabnejad](#):
>
> What you are trying to tell me(N-tuple), is that I should use RunAction and EventAction…?

Yes. You’d write a SensitiveDetector (SD) to attach to your volume, and use that to fill an N-tuple; the N-tuple is created in your Run and Event actions, as usual. There are several examples which show how to do this.

> [@m.rajabnejad](#):
>
> how can I assign an “effective z” in mesh scoring?

I presume that you know your geometry, and you know how you defined the mesh. So you should be able to convert the mesh cell index (ix,iy,iz) into spatial coordinates from the dimensions of the volume. Depending on how you do the arithmetic, you can get either the corner of each cell, or the center.

---

<div class="post-metadata">

**Author:** ![m.rajabnejad](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/m.rajabnejad/32/5188_2.png) [@m.rajabnejad](https://geant4-forum.web.cern.ch/u/m.rajabnejad)\
**Post date:** [October 7, 2022, 6:14pm UTC](https://geant4-forum.web.cern.ch/t/how-to-determine-position-with-the-mesh-scoring-data/8890/6 "2022-10-07T18:14:40Z")

</div>

Thank you so much for advice
