Scoring certain range in results in USRBIN

Dear FLUKA and Flair experts,

Now I am analysing the photon emission from electrons on solid targets. The spatical distribution of Kα photons are of interests so that USRBIN card should be used. Will you please give me any hint which card I should use to make the scored photon energy set in a certain energy range?

Thanks a million!
Xiao

If you want to get the spatial distribution of a subset of photons only, as a function of their energy, you can link the USRBIN scoring of PHOTON to the fluscw.f user routine, to be activated by the USERWEIG card. In fluscw.f, you have to implement a logic preventing to score in case the photon energy is outside the desired range, such as:

      FLUSCW = ONEONE
      LSCZER = .FALSE.
      IF (IJ.EQ.7) THEN ! it's a photon
         IF(ABS(PLA).LT.arange.OR.ABS(PLA).GT.brange) THEN
*        it's outside the energy range 
            LSCZER = .TRUE. ! do not score
         END IF
      END IF

where arange and brange shall be replaced by the lower and upper limit of the energy range in GeV.
One can also have multiple USRBIN cards (from 1 to N) applying to different energy ranges, with the logic above cloned as a function of the variable JSCRNG (running from 1 to N for ISCRNG = 2).
Obviously the fluscw.f user routine, once it’s properly customized as suggested, has to be compiled and linked into a FLUKA executable of your own (see https://fluka.cern/documentation/running/user-routines and the Flair manual).

Dear Francesco,

I got it, thanks very much!

Best regards,
Xiao