Killing pristine primaries

Dear FLUKA experts,

for my simulation of fully stripped heavy ions I want to get rid of (in theory) partially charged primaries if they have not interacted with any matter at a certain point of the simulation. I am using mgdraw->BXDRAW to check the relevant border crossing and use trackr->Ltrack==1 to identify primaries.

I now have the problem of deciding whether the primaries have interacted with matter (checking for energy loss should be fine). So far I have tried Mtrack==1 but found cases where energy was lost creating photons and electrons but without energy deposition. An alternative of just checking the energy/momentum is also questionable since the primaries can pass an electric field and might still need to be killed.

Secondly, what are my options for killing the particles? I predict that I will have to get rid of a lot of primaries, so I do not want to just not count them but end the tracking to save time.

Best regards
Roman

Dear Roman,

In order to do so you have to call the usrmed.f user routine that kills particles according to a certain condition.

This condition could be a flag that tells if the particle has travelled through any region that is not in VACUUM. You can use the integer LLOUSE, which is already defined and initialized as LLOUSE = 0. Turn LLOUSE = 1 if the particle crosses a boundary to a region that is not in vacuum (nor in the material of your region of interest, where you want to kill particles).

The assignment of the flag value is done in the mgdraw.f routine. For example:

  IF ( MEDFLK(NEWREG,1) .NE. 2 .AND. MEDFLK(NEWREG,1) .NE. ?? ) THEN
     LLOUSE = 1
  ENDIF

Where ?? is the material number of your region of interest.
To use the MEDFLK array you need to include the 'flkmat.inc’ file at the top of the routine with the other includes.

Once particles are identified/flagged, in the usrmed.f routine include the condition “LLOUSE .EQ. 0” at the boundary crossing to the region of interest, in order to set the particle weight equal to zero. For instance:

  IF ( MREG .NE. NEWREG .AND. LLOUSE .EQ. 0 ) THEN
     WEE = ZERZER
  ENDIF

As in case of mgdraw.f, include 'trackr.inc’.

The usrmed.f routine is called when including in the input file the MAT-PROP card with SDUM=USERDIRE. You can select the material of the region of interest to activate the call there. It is recommended that if you use the same material elsewhere, you better define the same with a different name so it can be identified univocally.

Hope this helps solving your question.

Dear Marta,

thank you very much for your help. The approach certainly looks promising but I still have a few questions:

  1. The material of the region that is supposed to filter out the primaries is vacuum. So now I am wondering how to make a custom copy of vacuum since FLUKA won’t let me create a material with either density=0 or Z=0, nor a compound with vacuum.

  2. The WEE variable in usrmed.f is described as a particle weight, so setting it to zero means it should not influence the results anymore. But does FLUKA also end tracking if the weight is zero in order to save CPU time?

  3. If I set the weight of my primary particle to zero, how is it accounted for in the normalization at the end of the simulation (e.g. energy deposition being normalized to GeV per primary). How is is accounted for in the energy summary at the end of the .out file?

Best regards
Roman

Hi Roman,

  1. in this case, no material copy indeed. Put VACUUM in MAT-PROP and add the proper region number condition (for NEWREG) in usrmed, such as to kill particles only when they enter your filtering region;

  2. yes;

  3. when zeroing the particle weight, the particle energy is lost (not deposited). The final informative energy summary is affected and should be interpreted accordingly, knowing that the energy carried by killed particles will appear as missing energy.