RE: [fluka-discuss]: Access to tracking informations in USERDUMP

From: Anton Lechner <>
Date: Fri, 3 Feb 2017 17:30:21 +0000

Dear Antonio,

In order to reproduce the problem with MGREAD, could you be so kind and send a minimum working example (input file, routines and maybe the MGREAD file if you made modifications).

Meanwhile (since your problem is reading, not dumping) you could try to already use a customized MGDRAW routine to get the information you need. MGDRAW has an entry (USDRAW) which is called whenever you have an interaction (if activated by means of the USERDUMP card). In particular, in this entry, one can distinguish the type of interaction (via the value of ICODE), one can determine the current region/position in the geometry (via MREG, XSCO, YSCO, ZSCO), and one can access information about secondaries produced in this interaction (looping over particles in GENSTK). With following code snippet inserted into USDRAW you could filter out the events which are inelastic collisions of primaries (using the generation number LTRACK, which is 1 for primaries and making use of the ICODE variable, which is 101 for inelastic nuclear collisions). For simplicity, I directly write formatted output to unit 50, so no need to convert to ascii (you can change this of course).

* Inelastic collision of a primary
      IF ( LTRACK .EQ. 1 .AND. ICODE .EQ. 101 ) THEN
* Dump the location of the inelastic collision:
         WRITE( 50,* ) "Inelastic coll at ", XSCO, YSCO, ZSCO
* Loop over all secondaries and dump their particle code, kinetic
* energy, statistical weight and direction cosines:
         DO 10 INP = 1, NP
            WRITE( 50,* )
     & ' Part=',KPART(INP),' E=',TKI(INP),' Weight=',WEI(INP),
     & ' Tx=',CXR(INP), ' Ty=',CYR(INP),' Tz=',CZR(INP)
      END IF
Note that this code does not consider re-interactions of secondary hadrons. If you also want particles produced in re-interactions, you need to modify the first if statement (just in case: the particle code of the incident particle is accessible via the JTRACK variable).

Cheers, Anton

From: []
Sent: 03 February 2017 17:32
To: Anton Lechner
Subject: RE: [fluka-discuss]: Access to tracking informations in USERDUMP

Dear Anton,

I managed to compile the MGREAD program, but when I try to run it, it
prints only a few lines and I get this error:
'Fortran runtime error: I/O past end of record on unformatted file'.

About the information: for all the events, I need to know the position
of the interactions of the source pions in the target, then dump of a
list of the numbers, momenta and directions of the directly produced
secondaries. In fact, I intend to study the physical background of
hadronic interactions for charm mesons' decay measurement in nuclear

Thank you for your help.
Best regards,

Quoting Anton Lechner <>:

> Dear Antonio,
> Can you be a bit more specific why you cannot read the MGDRAW output
> with the MGREAD program given in the manual? Did you manage to
> compile and run it?
> There is a lot of information written by the default MGDRAW routine.
> If you tell us more about what you intend to do (e.g. dump particle
> information at boundary crossings, or dump a list of secondaries
> produced in interactions), then it might be easier to give some
> advice.
> Cheers, Anton
> ________________________________________
> From:
> [] on behalf of
> []
> Sent: 30 January 2017 13:18
> To:
> Subject: [fluka-discuss]: Access to tracking informations in USERDUMP
> Dear FLUKA experts,
> I am a new user, and I am currently learning how FLUKA works. I
> realized the geometry of the experiment and I made some test runs, but
> I cannot understand how you access tracking data such as momentum,
> particle name and number of produced secondary particles in the event
> (in my case, I want to analyse interactions of a pion beam impining on
> a Mo target).
> From the guides and the manual, I learned that the routine mgdraw.f
> provides, through the card USERDUMP, a collision tape of the event,
> and that the variables I look for might be present in TRACKR and
> accessible after some modifications of the user routine.
> Before modyfing mgdraw.f, however, I would like to learn how it works,
> but it seems I cannot read the binary file through and/or the
> MGREAD program contained in flair and in the FLUKA manual. Can you
> please tell me the commands to use them, or an alternative solution to
> access the data?
> I know this may be a silly question, but please answer me.
> Best regards,
> Antonio Iuliano.
> __________________________________________________________________________
> You can manage unsubscription from this mailing list at

You can manage unsubscription from this mailing list at
Received on Fri Feb 03 2017 - 19:55:02 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 03 2017 - 19:55:04 CET