/* This script is reading the HV mapping of BB scintillators planes dE and E. */ #include #include void read_hv_mapping(int *EL_crate, int *EL_slot, int *EL_ch, int *ER_crate, int *ER_slot, int *ER_ch,int *dEL_crate, int *dEL_slot, int *dEL_ch, int *dER_crate, int *dER_slot, int *dER_ch ) { char line1[200],line2[200],s[200],s0[200],s1[200],s2[200],s3[200],*file,*dd,*side,*strL,*strR,*detector; file=(char*)malloc(1000); dd=(char*)malloc(1000); side=(char*)malloc(1000); strL=(char*)malloc(1000); strR=(char*)malloc(1000); detector=(char*)malloc(1000); int ind1,ind2,ind3,ind4,indx; sprintf(file,"../HV-map-crate-1.dat"); FILE *dbFile3 = fopen(file,"r"); int t=0,d=0; while(fgets(line1, sizeof(line1), dbFile3) !=NULL) { sscanf(line1,"%s %s %s",&s1, &s2, &s3); sprintf(detector,"%s",s2); sprintf(side,"%s",s3); sprintf(strL,"left"); sprintf(strR,"right"); if(!strcmp(side,strL)) t=1; if(!strcmp(side,strR)) t=2; if(!strcmp(detector,"dE")) d=1; // choose detector type E or dE) if(s1[0]=='#' && (s2[0]=='E') && t==1) indx=1; // left E plane scintillators if(s1[0]=='#' && (s2[0]=='E') && t==2) indx=2; // right E plane scintillators if(s1[0]=='#' && d==1 && t==1) indx=3; // left dE plane scintillators if(s1[0]=='#' && d==1 && t==2) indx=4; // right dE plane scintillators if(indx==1 && s1[0]!='#') { sscanf(line1," %d %d %d %d", &ind1, &ind2, &ind3, &ind4); // cout<<" ind 1 = "<