3 void writeCovariance(FILE *fOut,
int ibin,
int icharge,
char **paramNames,
double *errors,
double *covar,
int nCent,
int nParams) {
4 const char* binName[]={
"all",
"soft",
"neck",
"hard",
"softHard"};
5 const char* chargeName[] = {
"LS",
"US",
"CD",
"CI"};
7 fprintf(fOut,
" covariance matrices for %s, %s\n",binName[ibin],chargeName[icharge]);\
9 printf(
" covariance matrices for %s, %s\n",binName[ibin],chargeName[icharge]);\
12 for (
int ic=0;ic<nCent;ic++) {
14 fprintf(fOut,
" Normalized covariance for centrality %i\n",ic);
16 for (
int ip=0;ip<nParams;ip++) {
17 fprintf(fOut,
" %s",paramNames[ip]);
21 printf(
" Normalized covariance for centrality %i\n",ic);
23 for (
int ip=0;ip<nParams;ip++) {
24 printf(
" %s",paramNames[ip]);
29 for (
int ip=0;ip<nParams;ip++) {
31 fprintf(fOut,
"%s ",paramNames[ip]);
33 printf(
"%s ",paramNames[ip]);
35 if (0 < errors[ic*nParams+ip]) {
37 for (
int jp=0;jp<=ip;jp++) {
38 if (0 < errors[ic*nParams+jp]) {
39 double den = sqrt(covar[(ic*nParams+kp)*nParams+kp]*covar[(ic*nParams+lp)*nParams+lp]);
41 fprintf(fOut,
" %8.3f",covar[(ic*nParams+kp)*nParams+lp]/den);
43 printf(
" %8.3f",covar[(ic*nParams+kp)*nParams+lp]/den);