Infomation about parent particle

Hello Antonino,

In principle, you could save the information of the parent particles without using stupre.f and stuprf.f routines.
When you have an interaction, entry USDRAW of mgdraw is called with the corresponding code of that type of interaction. Then, the properties of the secondaries produced in that interaction are stored in common GENSTK.

At the moment of the interaction, you might want to save some of the properties of the parent in the
TRACKR user variables SPAUSR(1-11) (for real values such as coordinates, energy, etc.) and ISPUSR(1-11) (for integer values such as the particle type).

In your case, this can be:

      ENTRY USDRAW ( ICODE, MREG, XSCO, YSCO, ZSCO )
          SPAUSR(1) = XSCO
          SPAUSR(2) = YSCO
          SPAUSR(3) = ZSCO
          SPAUSR(4) = ETRACK
          ISPUSR(1) = JTRACK
          ISPUSR(2) = ICODE
      RETURN

These variables are now in TRACKR, which contains information about the current particle (the one which had the interaction). The secondaries of the current particle inherit them when they are transfered to the FLUKA stack.

This is done by the routines stupre.f and stuprf.f, which by default copy SPAUSR in SPAREK just before loading a particle into stack. Finally, when new particle is taken from the stack in order to transport it, this particle is filled into TRACKR, copying the SPAREK variables again in SPAUSR.

Following this logic:

  1. You save the information of the parent interaction into SPAUSR directly in USDRAW entry of the mgdraw.f routine.
  2. All the variables are copied in SPAREK when the secondaries are loaded on the stack.
  3. When the particle is downloaded from the stack for the transport (and therefore the scoring), the properties are copied back in SPAUSR.

I took the liberty to attach here a small working example (different from your case), where an electron beam imping on a small slab of copper.
test.inp (1.0 KB)
mgdraw.f (11.2 KB)

The usage of stupre.f and stuprf.f should be used if you need to do some more
sophisticated operations than just copying SPAUSR to SPAREK and ISPUSR to ISPARK. They could be used (for instance) for tracking the informations of the grand-parents (or higher order ancestors).

Allow me a final quick comment on your usage of stupre.f. The following lines:

      IESPAK(1, 1) = A
      ESPARK(1, 1) = B
      ESPARK(2, 1) = C
      ESPARK(3, 1) = D
      ...

should instead be:

      DO 500 NPNW = NPSTRT,NPEMF
          IESPAK(1, NPNW) = A
          ESPARK(1, NPNW) = B
          ESPARK(2, NPNW) = C
          ESPARK(3, NPNW) = D
          ...
 500  CONTINUE

I would finally encourage you to use variables in the EMFSTK when working with within the stupre.f routine. You can find them in emfstk.inc.

Let me know if this solved your problem!
Cheers,
Daniele

5 Likes