How to insert zenith angle info on a source.f from txt file

EnergyMeV.txt (2.1 KB) ZenithAngleRad.txt (1.8 KB)

Dear experts, I wonder if you could help me to prepare a source.f routine that:

  1. Reads the energy values from a txt file and also reads the zenith angle values (probability distributions) and uses them as direction cosines. I suppose that ZenithAngle = acos(-tzz), where tzz is the direction cosine in Z.

  2. In my input file, I use muons that their positions are generated randomly through a square. I used the option:
    BEAM -4. MUON-
    BEAMPOS 0.0 46. 0.0 46. 0.0 0.0CART-VOL
    BEAMPOS 0.0 0.0 -252.
    My input runs well, even if FLAIR finds the following mistake:
    WARNING: Invalid what(s)=[5, 6, ‘Assertion failed: w(6)>w(5)’]
    BEAMPOS 0.0 46. 0.0 46. 0.0 0.0CART-VOL
    My question is: If I do not wish to write onto the source.f routine the positions or the type of the beam particle, HOW I could inherit those info from my input file?

Thanks a lot in advance

Best regards

Georgios

Dear Georgios,

please take a look the source routine posted here:

  1. You can replicate the same reading and sampling parts for the zenith angle, then modify the direction cosine variables as needed.
    The SFECFE subroutine will return a random direction in 2D.

    CALL SFECFE(SINT, COST)
    
  2. Unfortunately the volumetric beam parameters are not inherited, only the point defined on the BEAMPOS card via the XBEAM, YBEAM and ZBEAM variables. If you want a rectangle as a source plane, you will have to sample it by yourself.

    You can use the FLRNMD(XDUMMY) function to get a random number between [0,1) sampled uniformly.

Cheers,
David