Program in FORTRAN which calculate the detection efficiency

In summary, the problem is that you are missing an arithmetic operator between sin(theta) and sin(phi).
  • #1
inesnoussa
3
0
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,tcount=0
do i=1,N

theta = acos(1-2*rand())
phi = 2*pi*rand()
ux=cos(theta)sin(phi)
uy=sin(theta)sin(phi)
uz=cos(theta)
t=Dds/uz
x=ux*t
y=uy*t

if(sqrt(x**2+y**2+z**2).le.1)then
count=count+1
endif
end do
eff=count/N
print*,eff
end
There's someone there who could help me ? Thank you in advance
 
Technology news on Phys.org
  • #2
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.
 
  • #3
What SteamKing said.

Also, you have not initialized Dds.
 
  • #4
Hi,
the problem here is that i keep getting these error while compiling:

sourceponc.f90:11:

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)
 
  • #5
inesnoussa said:
Hi,
the problem here is that i keep getting these error while compiling:

sourceponc.f90:11:

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)

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.
 

Related to Program in FORTRAN which calculate the detection efficiency

What is FORTRAN?

FORTRAN (short for Formula Translation) is a high-level programming language used primarily for scientific and technical computing. It was first developed in the 1950s and has undergone many updates and improvements since then.

What is a detection efficiency?

Detection efficiency is a measure of how effective a detection system is at detecting a particular signal or event. It is usually expressed as a percentage, with 100% being a perfect detection rate.

How can FORTRAN be used to calculate detection efficiency?

FORTRAN has built-in functions and mathematical operations that make it well-suited for calculating detection efficiency. By writing a program that utilizes these features, you can easily calculate the efficiency of a given detection system.

What factors influence the accuracy of detection efficiency calculations in FORTRAN?

The accuracy of detection efficiency calculations in FORTRAN can be influenced by various factors, such as the complexity of the detection system, the quality of the data used, and the precision of the calculations performed.

Are there any resources available for learning how to write a FORTRAN program for calculating detection efficiency?

Yes, there are many online tutorials, forums, and textbooks available that can help you learn how to write a FORTRAN program for calculating detection efficiency. It is also helpful to have a basic understanding of programming concepts and mathematical operations before attempting to write such a program.

Similar threads

  • Programming and Computer Science
Replies
4
Views
705
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
26
Views
3K
  • Programming and Computer Science
Replies
5
Views
1K
Replies
26
Views
5K
  • Programming and Computer Science
Replies
6
Views
3K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
11
Views
14K
  • Programming and Computer Science
Replies
4
Views
2K
Back
Top