//{ /* This script READ the DB of the gain curves (only for BB scintillators). */ #include #include void read_gains(double *c_L1, double *cnst_L1, int *p_L1, double *c_L2, double *cnst_L2, int *p_L2, double *c_L3, double *cnst_L3, int *p_L3, double *c_L4, double *cnst_L4, int *p_L4, double *c_L5, double *cnst_L5, int *p_L5, double *c_L6, double *cnst_L6, int *p_L6, double *c_R1, double *cnst_R1, int *p_R1, double *c_R2, double *cnst_R2, int *p_R2, double *c_R3, double *cnst_R3, int *p_R3, double *c_R4, double *cnst_R4, int *p_R4, double *c_R5, double *cnst_R5, int *p_R5, double *c_R6, double *cnst_R6, int *p_R6) { /*double c_L1[30]={0}, cnst_L1[30]={0}, c_L2[30]={0}, cnst_L2[30]={0}, c_L3[30]={0}, cnst_L3[30]={0}, c_L4[30]={0}, cnst_L4[30]={0}, c_L5[30]={0}, cnst_L5[30]={0}, c_L6[30]={0}, cnst_L6[30]={0}, c_R1[30]={0}, cnst_R1[30]={0}, c_R2[30]={0}, cnst_R2[30]={0}, c_R3[30]={0}, cnst_R3[30]={0}, c_R4[30]={0}, cnst_R4[30]={0}, c_R5[30]={0}, cnst_R5[30]={0}, c_R6[30]={0}, cnst_R6[30]={0}; int p_L1[30]={0}, p_L2[30]={0}, p_L3[30]={0}, p_L4[30]={0}, p_L5[30]={0}, p_L6[30]={0}, p_R1[30]={0}, p_R2[30]={0}, p_R3[30]={0}, p_R4[30]={0}, p_R5[30]={0}, p_R6[30]={0}; */ char line1[200],line2[200],s[200],s0[200],s1[200],s2[200],s3[200],*dd,*side,*strL,*strR,*detector; dd=(char*)malloc(1000); side=(char*)malloc(1000); strL=(char*)malloc(1000); strR=(char*)malloc(1000); detector=(char*)malloc(1000); int ind0,ind1,ind4,indx,d=0,t=0; double ind2; double ind3; char str[200],str1[200]; 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(side,"%s",s2); // needed in order to choose between left and right sprintf(strL,"left"); sprintf(strR,"right"); if(!strcmp(side,strL)) t=1; if(!strcmp(side,strR)) t=2; if(s1[0]=='#' && t==1) indx=1; // left E plane scintillators if(s1[0]=='#' && t==2) indx=2; // right E plane scintillators if(indx==1 && s1[0]!='#') { sscanf(line2,"%d %d %s %s %d",&ind0, &ind1, &str, &str1, &ind4); ind2=atof(str); ind3=atof(str1); /* if(ind0==1) { cout<<"ind0 = "<