/* In this script I read the gain curves from file. the format of the DB is following: first line is "# left layer PMT coeff const power" and numbering is from layer 1 to layer 6 and then for right side. This script is only for HAND with 112 scintillators. */ #include #include #include void read_gain(double aL[112], double bL[112], double pL[112], double aR[112], double bR[112], double pR[112]) { char side[200],strL[4],strR[5],line2[200],str[300],str1[300],s1[10],s2[10],s3[10],ch[10]; int sd=-1,indx=-1; int ind0, ind1, ind3; double ind2; const int n=112; /*double aL[112],bL[112]; int pL[112]; double aR[112], bR[112]; double pR[112]; */ int bars_p[6]={0,30,54,76,88,100}; FILE *dbFile4 = fopen("./gain_curves_hand.dat","r"); //open the DB file while(fgets(line2, sizeof(line2), dbFile4) !=NULL) { sscanf(line2,"%s %s %s",&s1, &s2, &s3); sprintf(ch,"%s",s1); sprintf(side,"%s",s2); // needed in order to choose between left and right sprintf(strL,"left"); sprintf(strR,"right"); if(s1[0]=='#') { indx=1; if(!strcmp(side,strL)) {sd=1;} if(!strcmp(side,strR)) {sd=2;} if(sd!=1 && sd!=2) {cout<<" ERROR, can't recognize what side "<