// A program to compute a PDF correlation cosine between two observables X and Y, // evaluated for N PDF sets (with values for each observable provided in text // files file1 and file2) // Author: P. Nadolsky, 2007 // Compilation: g++ -o corr corr.c // Usage: corr file1 file2 using namespace std; #include #include #include //-------------------------------------------------------------------------- int cntnbk(const char *str) /*Counts non-blank charachters in a string str until a first blank character or the end of the string is met*/ {int m=0; char tem; while (str[m] !=' ' && (tem=str[m++],tem)) ; if (str[m-1]=='\0') return m-1; //m non-blank symbols counted else return m; //we do not count the end-of-string symbol } //---------------------------------------------------------------------- int main(int argc, char *argv[]) { char fname1[40], fname2[40]; const int mpdf=100; int npdf=0, ipdf1=0,ipdf2=0; float xsec1[mpdf], xsec2[mpdf], err1, err2, corr; if (argc < 2 ) { cout << "corr: Computation of PDF errors and correlation cosines for " <>xsec1[ipdf1]; ipdf1++; } ipdf2=0; while (fin2.good()) { fin2>> dec>>xsec2[ipdf2]; ipdf2++; } //Drop trailing zeros at the end of cross sections while(xsec1[ipdf1-1]==0.0) ipdf1--; while(xsec2[ipdf2-1]==0.0) ipdf2--; if (ipdf1 == ipdf2) { cout << "Total number of extreme PDF sets: "< */