Dear @tuneu,
Thank you for your question.
As far as I know, there is not a unique_id number by default, BUT you can define it using a user defined variable in TRACKR.
trackr.inc [TRACKs Recording] (properties of the currently transported particle and its path)
Here, you can get a lot of information of the particle you are transporting, many you probably know already:
Ntrack = number of track segments
Mtrack = number of energy deposition events along the track 0 < i < Ntrack
Xtrack = end x-point of the ith track segment
Ytrack = end y-point of the ith track segment
Ztrack = end z-point of the ith track segment 1 < i < Ntrack
Ttrack = length of the ith track segment 1 < j < Mtrack
Jtrack = identity number of the particle: for recoils or
kerma deposition it can be outside the allowed
particle id range, assuming values like:
208: "heavy" recoil
211: EM below threshold
308: low energy neutron kerma
in those cases the id of the particle originating
the interaction is saved inside J0trck (which othe-
rwise is zero)
Etrack = total energy of the particle
Ptrack = momentum of the particle (not always defined, if
< 0 must be obtained from Etrack)
Cx,y,ztrck = direction cosines of the current particle
Cx,y,ztrpl = polarization cosines of the current particle
Wtrack = weight of the particle
Ctrack = total curved path
Spausr = user defined spare variables for the current particle
Satrck = macroscopic absorption cross section for low energy neutron collisions (it can be negative for Pnab>1)
Ltrack = flag recording the generation number
Llouse = user defined flag for the current particle
Ispusr = user defined spare flags for the current particle
Lfsssc = logical flag for inelastic interactions ending with
fission (used also for low energy neutrons)
Lpkill = logical (user) flag for sudden particle death
I suggest you to use the variable LLOUSE to flag the muons when they appear for the first time in MGDRAW. In that way you will be able to know that the muon you follow is the right one.
Second option, but using a similar procedure, is to flag them when they are generate and stored in the stack.
Look at this thread which explains how to do this (It explains how to give information about the particles ancestors, but for your problem the difference is just in the info that you provide to the parameter ‘LLOUSE’).
Third option ( It is probably similar to what you are doing now)
Dumping from MGDRAW these variables:
NCASE: number of primaries treated so far (including current one)
JTRACK, (X,Y,Z)TRACK and LTRACK
You can identify, postprocessing that information, all the tracks of your muons.
I hope this helps you, let me know in case you need more assistance,
Hace a nice weekend,
André