26 {
27 char* jobname;
28 if(argc>1){
29 jobname = argv[1];
30 }else{
31 cout << "bad argument" << endl;
32 return -1;
33 }
34
35 string path = "";
36 string strJob = jobname;
37 cout << "strJob: " << strJob << endl;
38 string::size_type ilast = strJob.find_last_of("/");
39 if(string::npos != ilast){
40 path = strJob.substr(0, ilast);
41 }
42
43 int alignMeth;
44 string alignFile;
45 string confname;
46 string str;
47 string strtmp;
48 ifstream fjob(jobname);
49 if( ! fjob.is_open() ){
50 cout << "ERROR: can not read jobOption: " << jobname << endl;
51 return 0;
52 } else{
53 cout << "Open jobOption: " << jobname << endl;
54 while( getline(fjob, str) ){
55 if(str.find("//", 0) != string::npos){
56 continue;
57 } else if( str.find("MdcGeomSvc.alignFilePath", 0) != string::npos ){
58 string::size_type i1 = str.find_first_of("\"");
59 string::size_type i2 = str.find_last_of("\"");
60 alignFile = str.substr(i1+1, i2-i1-1);
61 } else if(str.find("MdcAlignAlg.ConfigFile", 0) != string::npos){
62 string::size_type i1 = str.find_first_of("\"");
63 string::size_type i2 = str.find_last_of("\"");
64 confname = str.substr(i1+1, i2-i1-1);
65 } else if(str.find("MdcAlignAlg.MdcAlignMeth", 0) != string::npos){
66 string::size_type i1 = str.find_first_of("=");
67 string::size_type i2 = str.find_last_of(";");
68 strtmp = str.substr(i1+1, i2-i1-1);
69 sscanf(strtmp.c_str(), "%d", &alignMeth);
70 }
71 }
72 }
73
75 pGeom =
new MdcCosGeom(
"/home/bes/wulh/document/wireconf.txt",
"/home/bes/wulh/calibConst/MdcAlignPar_ini.txt" );
76 pGeom -> initialize(0.0);
77
78 TObjArray* hlist = new TObjArray(0);
80 if(0 == alignMeth) pAlign =
new ResiAlign();
81 else {cout << "Error AlignType" << endl; return 0;}
82 pAlign->
init(hlist, pGeom);
83
85 if(0==fhistname.size()){
86 cout << "hist file path: " << path << endl;
88 }
89 for(unsigned nf=0; nf<fhistname.size(); nf++){
90 TFile* fin =
new TFile(fhistname[nf].
c_str());
91 if(!fin->IsOpen()){
92 continue;
93 } else{
94 cout << "merge hist file " << nf << ": " << fhistname[nf] << endl;
96 fin->Close();
97 }
98 }
99
100
104
105
106 pAlign->
align(alignPar);
107
108 TFile fhist("histall.root", "recreate");
109 fhist.cd();
110 hlist->Write();
111 fhist.Close();
112
113
115
116 return 0;
117}
vector< string > getHistList()
virtual void align(MdcAlignPar *alignPar)=0
virtual void mergeHist(TFile *fhist)=0
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
bool rdAlignPar(std::string alignFile)