Discarding double or triple events in BXDRAW of mgdraw.f

Dear experts,

I am dealing with thermal neutrons that hit a LiF target giving rise to tritons and alphas inside a gas volume. With the usrmed routine I chose to kill the entering alphas in the gas and keep only the tritons.
Then, in the mgdraw routine I implemented the following logic in order to record the tritons that enter inside the gas:

     IF(JTRACK .EQ.  -4) THEN
        IF (NTRACK .GT. 0 .AND. MTRACK .GT. 0.) THEN


In the produced output, a very small fraction are double events and one triple:

for example:

  204256          -4   2.72525707E-03
  204274          -4   2.68607726E-03
  **205066**          -4   2.26116204E-03
  **205066**          -4   1.82130362E-03
  207261          -4   2.70745624E-03
  207323          -4   2.68751546E-03

  588178          -4   2.72534858E-03 
  **588890**          -4   1.93321821E-03 
  **588890**          -4   1.20754645E-03 
  **588890**          -4   1.33422327E-06 
  588912          -4   2.70040589E-03 
  590093          -4   2.72738002E-03 

Where 205066 is the primary index for a double event (2 produced tritons) and 588890 for a triple.
I would like to take into account in the boundary crossing estimation only single events (events with 1 produced triton) and discard double or triple events.
Is there any suggestion to be done in mgdraw using an appropriate variable and not post-processing afterwards?

Thanks a lot in advance

Best regards


Hi, what actually puzzles me is why we have 2 or even 3 entries for the same primary neutron…
Is it a bug or just the same particle that changes direction in the border?
How could it be corrected? The last column in the following entries is the emission angle in degrees with respect to beam direction.

  205066          -4   2.26116204E-03 -0.216471851      0.322882682       3.50000009E-05 -0.435331464     -0.900270224       1.15413161E-04   89.9933853    
  205066          -4   1.82130362E-03 -0.271284968      0.210524142       3.50000009E-05 -0.442844659     -0.896503925       1.30126504E-02   89.2544098    

  588178          -4   2.72534858E-03  -4.12413254E-02  0.506994784       3.50000009E-05 -0.923177600      0.326949954      0.202105924       78.3398666    
  588890          -4   1.93321821E-03 -0.110072896      0.242832512       3.50000009E-05 -0.986414909      0.163389087       1.70180928E-02   89.0248871    
  588890          -4   1.20754645E-03 -0.449083269      0.301423907       3.50000009E-05 -0.983097315      0.180095345       3.29436697E-02   88.1121216    
  588890          -4   1.33422327E-06  -2.37866569      0.647529900       3.50000009E-05 -0.805210471     -0.538862526      0.247514248       75.6695328    
  588912          -4   2.70040589E-03  -1.22435354E-02  0.650838494       3.50000009E-05 -0.813307703      0.335518062      0.475350618       61.6178207

Dear @tsiledak,

Thank you for your question.

Could you please send me the inputs and routines of your simulation?
I would like to see the problem in more detail.


mgdraw.f (18.7 KB)
usrmed.f (3.0 KB)
XYmgdraw_1.inp (11.1 KB)

Dear Andre, please find attached the running files… how we could tag a secondary triton to know how many times interacts? Because it is not natural to have two tritons produced from the same neutron in the reaction of thermal neutrons that hit LiF… the produced file: XYmgdraw_1001_fort.66 is the one that I highlighted with multiple boundary crossing entries in the previous messages…

Thanks a lot in advance

BEst regards


Dear @tsiledak,

Indeed, what you are obtaining is peculiar.
Using the LTRACK variable you can obtain the generation number of the current particle.
For all your tritons you are obtaining a value of LTRACK=2, which means that the doubles and triples events are secondaries from an interation of a primary thermal neutron…

We are looking into it, and as soon as we get a solution I will come back to you.

Thanks for your question, and I apologise for the delay in replying.

Thank you so much, I am looking forward to hearing from you.
Best regards


Dear @tsiledak,

Thanks for your patience.

First of all I would like to point out that some of your cards and routines are incompatible with the current FLUKA.CERN version:

LOW-PWXS: Here you are defining the WHAT(1) as 1, which applies the pointwise treatment for the metastable material. I would recommend you to leave all the whats empty to enable the pointwise for all the materials.

LOW-MATS: Considering that you want to use the point-wise treatment you do not need to use these cards. These ones are intended for the group-wise treatment.

Usrmed routine: The format of your includes are not compatible anymore with the current FLUKA.CERN version.

Now, after these comments, we can solve your issue.

The problem was simply that the tritons were returning from the REG-5 to the REG-3 and crossing again the boundary REG-3 → REG-5.

You can observe this by yourself flagging the particles that a crossing the surface and checking the flag if they cross again. Something like this:

IF (ISPUSR(1).eq.724) THEN
WRITE(66,*) “It is me again!”, NCASE
ISPUSR(1) = 724

And of course, you see this just a few time because these are super rare cases.

I hope this helps,
Have a nice weekend

1 Like

Dear Andre,

I am grateful for your help, everything is understood now… thanks so much!
One last question that has to do with the issue I have pointed out a couple of weeks ago? Scoring Energy Deposition using mgdraw.f routine, equivalent with EVENTBIN in a Cartesian three-dimensional array
I wonder whether you could give a comment on that…

Thank you very much in advance

Best regards