/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Mdc/DedxCalibAlg/DedxCalibAlg-00-01-15/share/shell/genRawScript/genRawScript.cpp File Reference

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

int main ()


Function Documentation

int main (  ) 

Definition at line 21 of file genRawScript.cpp.

References genRecEmupikp::i, genRecEmupikp::rawlist, and deljobs::string.

00021           {
00022      char runlist[200];
00023      char rawlist[200];
00024      sprintf(runlist, "RunList.txt");
00025      sprintf(rawlist, "rawFileList.txt");
00026 
00027      string str;
00028      vector<int> vRun;
00029      vector<string> vRunFile;
00030      ifstream frunlist(runlist);
00031      while(frunlist >> str){
00032           vRunFile.push_back(str);
00033 
00034           string strtmp = str;
00035           strtmp.erase(0,strtmp.find("_")+1);     
00036           strtmp.erase(strtmp.find("."),4);
00037           int iRun;
00038           sscanf(strtmp.c_str(), "%d", &iRun);
00039           vRun.push_back(iRun);
00040           //      cout << "strtmp " << strtmp << ",  " << iRun << endl;
00041      }
00042      frunlist.close();
00043 
00044      vector<int> vRawRun;
00045      vector<string> vRawFile;
00046      vector<string> vRawFileInput;
00047      ifstream frawlist(rawlist);
00048      while(frawlist >> str){
00049           vRawFile.push_back(str);
00050 
00051           string strtmp = str;
00052           string::size_type i1 = str.find("run_");
00053           strtmp = str.substr(i1+4, 7);
00054           int iRun;
00055           sscanf(strtmp.c_str(), "%d", &iRun);
00056           vRawRun.push_back(iRun);
00057           //      cout << "strtmp " << strtmp << ",  " << iRun << endl;
00058 
00059           string strtmp2 = str;
00060           string::size_type i2 = str.find("All_");
00061           strtmp2 = str.substr(0, i2+8);
00062           string strtmp3 = strtmp2 + "*.raw";
00063           vRawFileInput.push_back(strtmp3);
00064           // cout << strtmp3 << endl;
00065      }
00066      frawlist.close();
00067 
00068      ofstream fout("job.txt");
00069      for(unsigned i=0; i<vRun.size(); i++){
00070           int index = -1;
00071           for(unsigned k=0; k<vRawRun.size(); k++){
00072             //      cout << "k " << k << "  run " << vRun[i] << "  rawrun " << vRawRun[k] << endl;
00073             if(vRun[i] == vRawRun[k]){ index = k; break;}
00074           }
00075           if(index > -1){
00076                fout << "raw_evt_filter.exe " << vRunFile[i] << " \"" << vRawFileInput[index] << "\"" << endl;
00077           } else{
00078                cout << "can not find raw file for " << vRunFile[i] << endl;
00079           }
00080      }
00081      fout.close();
00082 
00083      return 0;
00084 }


Generated on Tue Nov 29 23:16:43 2016 for BOSS_7.0.2 by  doxygen 1.4.7