Multiple Counting Logic Errors

Dear FLUKA experts,

I am attempting to score, using mgdraw.f, the number of neutrons resulting in a particular region (the ROI) due to one of my primary particles. If, for instance, a neutron enters the ROI from outside, or it is created in the ROI, I want to count it. However, if it is created in the ROI, exits, and re-enters the ROI, I still only want to count it once. Moreover, if it interacts in the ROI, I don’t want the resultant neutron products to count unless there is a new neutron produced.

The point of this exercise is to relate the number of concerning neutrons produced by the primary muon to the muon’s distance of closest approach to the ROI.

A sample test might work like this:

  1. Check that the particle is a neutron and that it is inside the ROI:
    IF (MREG .EQ. 9 .AND. JTRACK .EQ. 8) THEN

  2. Count the particle once, by writing it to a file referencing NCASE so it can be related to the relevant primary

The trouble I am having is that I do not know how to avoid counting a neutron multiple times. I don’t want to count it every time it interacts, but if it creates tertiary neutrons in the ROI, I also want to count those— but only once.

Any advice would be appreciated.

Thank you,

Regan

Particles come with a predefined flag for user purposes, LLOUSE, an integer initialized as LLOUSE = 0. So you can check if your neutron has an LLOUSE .EQ. 0 and change it to 1 when you count it:

IF (MREG .EQ. 9 .AND. JTRACK .EQ. 8 .AND. LLOUSE .EQ. 0) THEN
   count neutron
   LLOUSE = 1
ENDIF

Best,
Roman

1 Like

Hello Roman,

Thank you for your response. I’ve experimented with this variable before and am testing this method now. I still have a question however. If a neutron interacts but is not destroyed or absorbed, it becomes one of the products of the reaction. Would LLOUSE be reset to 0 after an interaction? I still believe I am counting the same neutrons multiple times.

Further, could I use USRMED to kill the neutrons?

Thank you,

Regan

Dear @rross,

neutrons that are destroyed or absorbed in inelastic interactions are not tracked anymore and do not become part of the secondary particles. In case of elastic scattering, the LLOUSE value is not changed so if it was flagged it remains flagged: this should correspond to your needs because it is the same neutron indeeed.

Yes, usrmed.f can be used to kill particles in selected material by assigning the a zero weight. Be careful because this really affects the tracking of the particle. Depending on your case, fluscw.f / comscw.f may be more appropriate if you instead want to affect only the scoring of the particle (not their tracking).

Best,
Davide