15 void doCopy(Int_t startEvent, Int_t nEvents,
17 const Char_t *dirout =
"QWE.dir");
22 "void doCopy(Int_t startEvent, Int_t nEvents,
26 if (!dirout || !dirout[0]) dirout = "QWE.dir
";
27 const char *cwd = gSystem->WorkingDirectory();
29 if (strcmp(dirout,"./
")==0 || strcmp(dirout,cwd)==0)
31 printf("doCopy: ERROR *** current dir not allowed
for dirout ***
");
34 gSystem->MakeDirectory(dirout);
36 cout << endl << endl <<" doCopy - input # events =
" << nEvents << endl;
38 cout << " doCopy - input file =
" << file << endl;
39 cout << " doCopy - ouput dir =
" << dirout << endl;
42 // First load some shared libraries we need
45 gSystem->Load("St_base
");
48 gSystem->Load("libgen_Tables
");
49 gSystem->Load("libsim_Tables
");
50 gSystem->Load("libglobal_Tables
");
52 gSystem->Load("StUtilities
");
55 gSystem->Load("StarClassLibrary
");
59 // Handling depends on whether file is a ROOT file or XDF file
64 fileList[0] = file; fileList[1]=0;
66 setFiles= new StFile(fileList);
69 StIOMaker *IOMk = new StIOMaker("IO","r
",setFiles,"bfcTree
");
71 IOMk->SetBranch("dstBranch
" ,0,"r
");
72 IOMk->SetBranch("geantBranch
" ,0,"r
");
73 IOMk->SetBranch("histBranch
" ,0,"r
");
74 IOMk->SetBranch("runcoBranch
" ,0,"r
");
75 IOMk->SetBranch("eventBranch
" ,0,"r
");
77 if (startEvent>1) IOMk->Skip(startEvent-1);
80 TString basename = gSystem->BaseName(file);
81 basename.ReplaceAll(".root
","");
82 char *outName = gSystem->ConcatFileName(dirout,basename);
85 StTreeMaker *outMk = new StTreeMaker("EvOut
",outName,"bfcTree
");
86 outMk->SetIOMode("w
");
87 outMk->IntoBranch("eventBranch
","StEvent");
88 outMk->IntoBranch("dstBranch
" ,"dst
");
89 outMk->IntoBranch("histBranch
" ,"hist
");
90 outMk->IntoBranch("runcoBranch
","runco
");
91 outMk->IntoBranch("geantBranch
","geant
");
97 Int_t iInit = chain->Init();
98 if (iInit) chain->Fatal(iInit,"on init
");
107 EventLoop: if (i <= nEvents && istat!=2) {
109 cout << endl << "============================
Event " << i
110 << " start ============================
" << endl;
113 istat = chain->Make(i);
116 {cout << "Last event processed. Status =
" << istat << endl; break;}
118 {cout << "Error event processed. Status =
" << istat << endl;}
125 cout << endl << "============================
Event " << i
126 << " finish ============================
" << endl;
virtual TDataSet * Last() const
Return the last object in the list. Returns 0 when list is empty.