/* University College London Dept of P&A Course in C/C++ 3C49 | all rights reserved 1999 | | Example: Compton Monte-Carlo | | Test program to use the generator class which gives a phi angle | with the compton scattering probability distribution | | Author: P.Clarke */ #include #include "RanCom.h" #define NEVENTS 10000 #define NBINS 18 main() { float phi ; // make a compton generator object RanCom generator( 514., 622. ); // An array to histogram the events in in 10 degree bins up to 180 int histogram[NBINS] ; int ibin ; //Clear the histogram for( ibin=0; ibin < NBINS ; ibin++ ) histogram[ibin] = 0 ; //Loop for preset number of events*/ for( int i=0; i < NEVENTS; i++ ) { //Get a random number phi = generator.scatter() ; // Now increment the count in the appropriate histogram bin for( ibin=0; ibin < NBINS ; ibin++ ) { if( (phi>float((ibin)*10)) && (phi