11 static int startday=80;
12 static int endday=365;
17 static const int NRUN=10000;
19 static int ngoodrunP=0;
20 static int ngoodrunS=0;
21 static int NGOODS[NRUN];
22 static int NGOODP[NRUN];
24 static const int NID=252;
25 static const int NVAL=8;
27 static int flag[NRUN];
28 static Long64_t frun[NRUN];
29 static Long64_t idx[NRUN];
30 static double values[NID][NVAL][NRUN];
33 int getID(
int q,
int l,
int s)
35 return (q-1)*3*21 + (l-1)*21 + (s-1);
40 string ReplaceChar(
const string &orig,
const char char1,
const char char2 )
43 for(
unsigned int i = 0; i < copy.length(); i++ )
45 if( copy.at(i) == char1 )
54 void read(
int irun,
int runnum){
57 int yearday=runnum/1000;
58 sprintf(file,
"www/fps/%d/%d.mip.txt",yearday,runnum);
60 if(!iFile.is_open()) { printf(
"Failed to open %s\n",file);
return; }
61 printf(
"irun=%d Reading %s\n",irun,file);
66 for(
int id=0;
id<NID;
id++){
68 float peak,sigma,rms,p95,p98,miperr,sigerr;
69 iFile >> i >> q >> l >> s >> peak >> sigma >> rms >> p95 >> p98 >> miperr >> sigerr;
71 values[i][0][irun]=peak;
72 values[i][1][irun]=sigma;
73 values[i][2][irun]=rms;
74 values[i][3][irun]=p95;
75 values[i][4][irun]=p98;
76 values[i][5][irun]=miperr;
77 values[i][6][irun]=sigerr;
78 values[i][7][irun]=sigma/peak;
79 if(peak<20.0) nzero++;
83 printf(
"nzero=%4d nrms1=%4d\n",nzero,nrms1);
85 for(
int id=0;
id<NID;
id++){
86 for(
int v=0; v<NVAL; v++){
90 NGOODS[ngoodrunS] = irun;
95 NGOODP[ngoodrunP] = irun;
108 void readall(
int day){
114 int yearday=day%1000;
116 if(yearday!=0) {startday=yearday; endday=yearday;}
117 for(
int d=startday; d<=endday; d++){
118 int yday=year*1000+d;
120 char dirname[100]; sprintf(dirname,
"../www/fps/%5d/",yday);
122 TSystemDirectory dir(dirname,dirname);
123 TList *files = dir.GetListOfFiles();
130 while ((file=(TSystemFile*)next())) {
131 fname = file->GetName();
132 if (!file->IsDirectory() && fname.EndsWith(
".mip.txt")) {
133 string filename = fname.Data();
134 string s_yearday = filename.substr(0,8);
135 stringstream s_yday(s_yearday);
147 TMath::Sort(i,frun,idx,0);
149 cout <<
"Number of runs: " << nrun << endl;
150 for(
int j=0; j<nrun; j++)
154 read(j,(
int)frun[idx[j]]);
158 void make_ped_text_files()
161 for(
int k = 0; k < ngoodrunP; k++ )
163 stringstream FileName;
164 FileName <<
"fps_good_physics_ped/" << frun[idx[NGOODP[k]]] <<
".txt";
165 ofstream out_file(FileName.str().c_str());
167 for(
int id=0;
id < NID;
id++ )
169 out_file <<
id <<
" " << values[id][0][NGOODP[k]] <<
" " << values[id][1][NGOODP[k]] << endl;
178 void fps_make_ped_files(
int day=18000 )
181 memset(values,0,
sizeof(values));
184 cout <<
"Reading all the files" << endl;
186 cout <<
"Finshed Reading" << endl;
187 make_ped_text_files();