#include #include #include #include #include "genlimit.h" /* Joel Heinrich 13 April 2005 This program, example.c, computes cross section upper limit for example described in CDF note 7587. See http://www-cdf.fnal.gov/physics/statistics/statistics_software.html and http://www-cdf.fnal.gov/publications/cdf7587_genlimit.pdf */ double rlx(); /* uniform generator, calls CERNLIB's RANLUX */ void rlxrandomize(); /* initializes RANLUX with random seed */ /* generates gamma distribution deviates with mean a and variance a */ double gamma_gen(double a,double (*ru)()); #define NCHAN 4 int main(){ const double beta=0.95; const int nchan=NCHAN, nens=150000; const PRIOR prior=flat; EB* ens = (EB*)malloc(nchan*nens*sizeof(EB)); int nobs[NCHAN]; int i,k; double xgl[300], lwgl[300]; const int nglmax = sizeof(xgl)/sizeof(xgl[0]); int ngl=0; double limit=0, uncert=0; rlxrandomize(); nobs[0] = 6; /* 6 events observed in channel 0 */ nobs[1] = 1; /* 1 event observed in channel 1 */ nobs[2] = 1; /* 1 event observed in channel 2 */ nobs[3] = 8; /* 8 events observed in channel 3 */ /* generate prior ensemble */ k=0; for(i=0;i