Difference between revisions of "DV Plotting XSect"
Jump to navigation
Jump to search
(Created page with "Creating a file called MollerDiffXSect.c <pre>#include <stdio.h> #include <stdlib.h> #include <math.h> main() { float angle,dSigma_dOmega; double alpha=7.2973525664e-3; double E…") |
|||
| Line 1: | Line 1: | ||
| − | Creating a | + | Creating a program called MollerDiffXSect.c |
<pre>#include <stdio.h> | <pre>#include <stdio.h> | ||
| Line 37: | Line 37: | ||
</pre> | </pre> | ||
| + | |||
| + | |||
| + | The program can be run with the commands: | ||
| + | <pre> | ||
| + | make DiffXSect | ||
| + | ./DiffXSect >DiffXSect.dat | ||
| + | </pre> | ||
| + | |||
| + | This creates a data file with the scattering angle theta and the corresponding theoretical Moller differential cross-section for said angle. | ||
Revision as of 20:28, 15 April 2016
Creating a program called MollerDiffXSect.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{
float angle,dSigma_dOmega;
double alpha=7.2973525664e-3;
double E_CM=53e6;
/* using equation from Landau-Lifshitz & Azfar */
/* units in MeV */
for(angle=90;angle<=180; angle=angle+.25)
{
dSigma_dOmega=(alpha*(3+cos(angle*3.14/180)*cos(angle*3.14/180)));
dSigma_dOmega=dSigma_dOmega*dSigma_dOmega;
dSigma_dOmega=dSigma_dOmega/(4*E_CM*E_CM*sin(angle*3.14/180)*sin(angle*3.14/180)*sin(angle*3.14/180)*sin(angle*3.14/180));
dSigma_dOmega=dSigma_dOmega*1e18;
dSigma_dOmega=dSigma_dOmega*.3892e-3;//barns
dSigma_dOmega=dSigma_dOmega/1e-6;//micro barns
fprintf(stdout," %f\t%f\n", angle, dSigma_dOmega);
}
}
Creating a Makefile with contents:
CC = gcc
DiffXSect: MollerDiffXSect.o
$(CC) $(CFLAGS) MollerDiffXSect.o -lm -o DiffXSect
MollerDiffXSect.o: MollerDiffXSect.c
$(CC) $(CFLAGS) -c MollerDiffXSect.c
The program can be run with the commands:
make DiffXSect ./DiffXSect >DiffXSect.dat
This creates a data file with the scattering angle theta and the corresponding theoretical Moller differential cross-section for said angle.