DV Plotting XSect
Jump to navigation
Jump to search
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.