# Scoring Energy Deposition using mgdraw.f routine, equivalent with EVENTBIN in a Cartesian three-dimensional array

Dear experts,

I am dealing with a problem where alpha and triton particles released from a LiF target hit by thermal neutrons. The detector is a box 3 x 3 x 1 cm (1cm is the drift region).
With the EVENTBIN scoring estimator I could get the energy deposition as follows:

EVENTBIN -12.0 ENERGY -97. GAS TOT
EVENTBIN 1. 0.0 0.0 &

with a region binning, which is equivalent with the following option with Cartesian binning:

EVENTBIN -10.0 ENERGY -46. 3.0 3.0 1.000035GASREG5
EVENTBIN -3.0 -3.0 3.50E-5 1. 1. 1. &

The results are the same as expected.

In addition, I tried to calculate the energy deposition using mgdraw.f routine:
From the main entry I record continuous energy deposition in the detector region

``````  IF (MREG.EQ.5) THEN
IF (MTRACK.GT.0 .AND. (JTRACK.EQ.-4 .OR. JTRACK.EQ.-6)) THEN

WRITE(67,*) NCASE,JTRACK,SNGL(EKIN),SNGL(CTRACK),
+ SNGL(XTRACK(1:NTRACK)),SNGL(YTRACK(1:NTRACK)),
+ SNGL(ZTRACK(1:NTRACK)),SNGL(CXTRCK),SNGL(CYTRCK),
+ SNGL(CZTRCK),SNGL(ANGLE2),SNGL(DTRACK(1:MTRACK))
``````

If I sum the SNGL(DTRACK(1:MTRACK) per primary (or use the entry ENDRAW, which is equivalent since RULL = 0 in this case -local energy depositions-) I am getting the same energy deposition spectra per event as using the two EVENTBIN cards above.

My question is the following: Is it possible to get in the main mgdraw entry the Cartesian X,Y,Z inside in the same NTUPLE with Edep/hit and XTRACK, YTRACK, ZTRACK?
In other words, how this EVENTBIN card:
EVENTBIN -10.0 ENERGY -46. 3.0 3.0 1.000035GASREG5
EVENTBIN -3.0 -3.0 3.50E-5 1. 1. 1. &
can be calculated inside mgdraw?
I would like at the end to have a complete NTUPLE built inside mgdraw where I could apply conditions not only per track lenght (position pointed by X,Y,Ztrack) but also per X,Y,Zvolume inside the detector region.

I am looking forward to hearing from you

Georgios

Dear @tsiledak,

Sorry for the delay in replying, It took me some time to find the problem in your previous post Also, I am not sure I understand what you want here…

What do you mean with “X,Y,Zvolume inside the detector region”?

You want to avoid using the MREG.EQ.5 filter and use instead a filter with the detector dimensions?

Best,
André

Dear Andre,

I would like to be able to get the X, Y, Z cartesian info that I could define for example in a EVENTBIN card in the region 5 inside mgdraw routine.
For example with this card:
EVENTBIN -12.0 ENERGY -97. GAS TOT
EVENTBIN 1. 0.0 0.0 &
I can obtain the energy deposition inside the GAS region (is the region numbered 5).
If I use the same card with the exact Cartesian coordinates:
EVENTBIN -10.0 ENERGY -46. 3.0 3.0 1.000035GASREG5
EVENTBIN -3.0 -3.0 3.50E-5 1. 1. 1. &
I obtain the same as expected since the Xmin,Ymin,Zmin and Xmax,Ymax,Zmax corresponding to the GAS region.
Is it possible to obtain onto the main mgdraw entry the X,Y,Z Cartesian coordinates apart from the
XTRACK,YTRACK,ZTRACK so that I could apply conditions on the X,Y,Z Cartesian coordinates of the region GAS? In other words, to be able to cut the region GAS in sub-regions inside mgdraw and calculate the Energy deposited there like what I am doing using the EVENTBIN card in the input.

Best regards

Georgios

Dear @tsiledak,

I hope our discussion in private was useful. I will summarize it in the following lines.

What is requested is another approach using MGDRAW main routine to replicate the EVENTBIN functionalities when mesh scheme is utilised. For the particular case of the gas area (Numbered 5), defined in the input as:

``````     RPP gas -3. 3. -3. 3. 3.50E-5 1.000035
``````

A potential solution to obtain the position of the particle, in a given mesh with, for example, binx = 2, biny = 2 and binz=3, could be obtained defining the following varibles in the mgdraw routine (just the idea is explained without the FORTRAN format):

xmin = -3, xmax = 3
ymin = -3, ymax = 3
zmin = 3.50E-5, zmax = 1.000035

Then, defining the number of bins :
num_bins_x = 2
num_bins_y = 2
num_bins_z = 3

The bin size of each case can be obtained in the following way:

bin_size_(x,y,z) = ((x,y,z)max - (x,y,z)min) / num_bins_(x,y,z)

Now, if a particle is in the position Xo,Yo,Zo (this value should be what you obtain from X,Y,ZTRACK(1).

Then,
x_index = (Xo - xmin)/bin_size_x … same for y and z.

Best regards,
André

1 Like