21 {
22 char runlist[200];
23 char rawlist[200];
24 sprintf(runlist, "RunList.txt");
25 sprintf(rawlist, "rawFileList.txt");
26
27 string str;
28 vector<int> vRun;
29 vector<string> vRunFile;
31 while(frunlist >> str){
32 vRunFile.push_back(str);
33
34 string strtmp = str;
35 strtmp.erase(0,strtmp.find("_")+1);
36 strtmp.erase(strtmp.find("."),4);
37 int iRun;
38 sscanf(strtmp.c_str(), "%d", &iRun);
39 vRun.push_back(iRun);
40
41 }
42 frunlist.close();
43
44 vector<int> vRawRun;
45 vector<string> vRawFile;
46 vector<string> vRawFileInput;
48 while(frawlist >> str){
49 vRawFile.push_back(str);
50
51 string strtmp = str;
52 string::size_type i1 = str.find("run_");
53 strtmp = str.substr(i1+4, 7);
54 int iRun;
55 sscanf(strtmp.c_str(), "%d", &iRun);
56 vRawRun.push_back(iRun);
57
58
59 string strtmp2 = str;
60 string::size_type i2 = str.find("All_");
61 strtmp2 = str.substr(0, i2+8);
62 string strtmp3 = strtmp2 + "*.raw";
63 vRawFileInput.push_back(strtmp3);
64
65 }
66 frawlist.close();
67
69 for(unsigned i=0; i<vRun.size(); i++){
70 int index = -1;
71 for(unsigned k=0; k<vRawRun.size(); k++){
72
73 if(vRun[i] == vRawRun[k]){ index = k; break;}
74 }
75 if(index > -1){
76 fout << "raw_evt_filter.exe " << vRunFile[i] << " \"" << vRawFileInput[index] << "\"" << endl;
77 } else{
78 cout << "can not find raw file for " << vRunFile[i] << endl;
79 }
80 }
81 fout.close();
82
83 return 0;
84}