StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
writeParams.C
1 #include <stdio.h>
2 
3 void writeParams(FILE *fOut, int ibin, int icharge, char **paramNames, double *chisq, double *params, double *errors, int nCent, int nParams ) {
4  const char* binName[]={"all","soft","neck","hard","softHard"};
5  const char* chargeName[] = {"LS", "US", "CD", "CI"};
6  if (fOut) {
7  fprintf(fOut," Fits for %s, %s\n",binName[ibin],chargeName[icharge]);
8  for (int ip=0;ip<=nParams;ip++) {
9  fprintf(fOut,"%s",paramNames[ip]);
10  }
11  fprintf(fOut,"\n");
12  } else {
13  printf(" Fits for %s, %s\n",binName[ibin],chargeName[icharge]);
14  for (int ip=0;ip<=nParams;ip++) {
15  printf("%s",paramNames[ip]);
16  }
17  printf("\n");
18  }
19 
20  for (int ic=0;ic<nCent;ic++) {
21  if (fOut) {
22  fprintf(fOut,"%2i%5.0f ",ic,chisq[ic]);
23  for (int ip=0;ip<nParams;ip++) {
24  fprintf(fOut,"%7.3f(%3.0f)",params[ic*nParams+ip],1000*errors[ic*nParams+ip]);
25  }
26  fprintf(fOut,"\n");
27  } else {
28  printf("%2i%5.0f ",ic,chisq[ic]);
29  for (int ip=0;ip<nParams;ip++) {
30  printf("%7.3f(%3.0f)",params[ic*nParams+ip],1000*errors[ic*nParams+ip]);
31  }
32  printf("\n");
33  }
34  }
35 }