05TA01 -0.140 0.006 auto-up 05TA02 -0.141 0.008 auto-up 05TA03 -0.122 0.007 good-up 05TA04 -0.123 0.007 good-down ........E.g. using:
cat gainsE.dat | grep -v tower | awk '{ print $1 " " $5 " " $7 " " $8}' > gainsE.inp
#sector08/eemcPMTcal 08TA01 7.692 0.414 500 08TA02 5.917 0.315 500 08TA03 7.463 0.390 500 08TA04 7.874 0.496 500 .....Do not use slopes marked as "manual". Gains are stored in DB using tower names. Note, there is no guarantee the eta dependnce of slopes is correct - for now us gains only to match towers for fixed eta bin. Also towers at the edges: 5TA*, 8TE*, *T*01, and *T*12 may have systematic error in slopes due to lack of neighbours.
Use e.g. the following script:
slope2gain(char *fname="gainsE.inp") { FILE *fd=fopen(fname,"r"); assert(fd); int sec,eta; char sub; for(sec=5;sec<=8;sec++) { char txt[100]; sprintf(txt,"gain%2.2d.dat",sec); FILE *fo=fopen(txt,"w"); assert(fo); fprintf(fo,"#sector%2.2d/eemcPMTcal\n",sec); for(sub='A';sub<='E';sub++) for(eta=1;eta<=12;eta++) { char name[100], text[100]; float slope,eslope; int ret=fscanf(fd,"%s %f %f %s",name,&slope,&eslope,text); assert(ret==4); assert(atoi(name)==sec); assert(name[3]==sub); assert(atoi(name+4)==eta); float gain=0, egain=999; if(strstr(text,"manual")==0) { // good value of slope gain =-1/slope; egain=gain * eslope/fabs(slope); } fprintf(fo,"%s %.3f %.3f 500\n",name,gain,egain); } fclose(fo); printf("file %s closed\n",txt); } }