Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Program in FORTRAN which calculate the detection efficiency

  1. Nov 28, 2014 #1
    Hi everyone,
    I want to write a program in FORTRAN which calculate the detection efficiency for a punctual source and a disc source at a distance from the detector .The disc detector is assumed to be perfect: ie photon absorbing everything that falls on it. So here I am working in 3D and I use ux, uy and uz to lead the photon randomly using the spherical coordinate system

    a) efficiency vs the detector radius
    b) efficiency as a function of source detector distance
    c) efficiency according to the radius of the source
    Here's the code that I am trying to write for a point source;

    program sourceponc

    integer i,N
    real x,y,z,eff,count,Dds,rd,ux,uy,uz,t

    do i=1,N

    theta = acos(1-2*rand())
    phi = 2*pi*rand()

    end do
    There's someone there who could help me ??? Thank you in advance
  2. jcsd
  3. Nov 28, 2014 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    When posting code you have written, please use the code tags to enclose the actual source statements.

    It's not clear from the OP what help you are seeking. Is there some problem getting this code to run? Are you having trouble writing the program.

    PF will help you if you are having a problem understanding the statements in a programming language or you are experiencing difficulty in getting a program to run. We will not write the program for you.
  4. Nov 28, 2014 #3
    What SteamKing said.

    Also, you have not initialized Dds.
  5. Nov 29, 2014 #4
    the problem here is that i keep getting these error while compiling:


    ux=cos(theta)sin(phi) 1 Error: Unclassifiable statement at (1) sourceponc.f90:12:

    uy=sin(theta)sin(phi) 1 Error: Unclassifiable statement at (1)
  6. Nov 29, 2014 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    The compiler is having trouble deciphering this statement. You are missing an arithmetic operator (+ - * /) between sin(theta) and sin(phi). You can't just cram two terms together like this without an arithmetic operator in between.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook