--- DarthVader/TrackerLevel2/src/TrkProcess.cpp 2006/07/18 10:58:54 1.3 +++ DarthVader/TrackerLevel2/src/TrkProcess.cpp 2006/09/05 12:52:20 1.4 @@ -48,23 +48,21 @@ get2 = 1; standalone = false; frame2 = "root"; - frame1 = "hbook"; - ifroot1 = false; - ifroot2 = true; - file1 = ""; + frame1 = "root"; +// ifroot1 = false; +// ifroot2 = true; + pfolder = "/TrackerFolder"; + file1 = ""; if(f2->IsOpen()){ - file2 = f2->GetPath(); -// TString temp = file2(0,file2.Last(':')); -// outdir = temp(0,temp.Last('/')); - outdir = gSystem->DirName(gSystem->DirName(file2)); -// check if the indicated output directory exists - FileStat_t t; - if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12; + file2 = f2->GetPath(); + outdir = gSystem->DirName(gSystem->DirName(file2)); + // check if the indicated output directory exists + FileStat_t t; + if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12; }else{ - file2 = ""; - outdir = gSystem->WorkingDirectory(); + file2 = ""; + outdir = gSystem->WorkingDirectory(); }; - pfolder = "/TrackerFolder"; if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false; @@ -81,7 +79,7 @@ void TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){ for (int i=0; i< ncustom; i++){ - + // -----------------------------------------------------// if (!strcmp(vcustom[i], "-processFolder")){ if (++i >= ncustom) throw -3; @@ -137,10 +135,7 @@ continue; }; } - -// dbg_.debug = DEBUG; -// dbg_.verbose = VERBOSE; - + if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false; else throw -201; @@ -148,21 +143,28 @@ if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true; else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false; else throw -201; - + if(get1){ - TString filety; - if ( ifroot1) filety=".root"; - else if (!ifroot1) filety=".rz"; - else throw -200; -// file1 = outdir + "/"+ pfolder + "/" + file2(file2.Last('/')+1,file2.Last('.')) + ".Level1" + filety; -// cout << p->file1 << endl; -// TString path = gSystem->DirName(p->file1); -// FileStat_t t; -// // check if processFolder directory exists, and possibly create it -// if( gSystem->GetPathInfo(path.Data(),t) ) { -// if( gSystem->MakeDirectory(path.Data()) == -1)throw -13; -// }; -// // if it does, open/create teh putput file + + TString filety; + if ( ifroot1) filety=".root"; + else if (!ifroot1) filety=".rz"; + else throw -200; + +// file1 = outdir + "/"+ gSystem->BaseName(pfolder) + "/" + file2(file2.Last('/')+1,file2.Last('.')) + ".Level1" + filety; + TString base = file2; + if(base.Contains(".Level2.root"))base = base(0,base.Index(".Level2.root")); + else base = base(0,base.Index(".root")); + base = gSystem->BaseName(base); + file1 = outdir + "/"+ gSystem->BaseName(pfolder) + "/" + base +".Level1"+filety; +// cout << "Requested Level1 output. "<< endl << "Level1 File: "<< file1 << endl; + TString path = gSystem->DirName(file1); + FileStat_t t; + // check if processFolder directory exists, and possibly create it + if( gSystem->GetPathInfo(path.Data(),t) ) { + if( gSystem->MakeDirectory(path.Data()) == -1)throw -13; + }; + // if it does, open/create teh putput file };