00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 TBrowser *b = 0;
00036 class StChain;
00037 StChain *chain=0;
00038
00039 void Load(){
00040 gSystem->Load("St_base");
00041 gSystem->Load("StChain");
00042 gSystem->Load("xdf2root");
00043 gSystem->Load("St_Tables");
00044 gSystem->Load("St_xdfin_Maker");
00045 gSystem->Load("St_io_Maker");
00046 gSystem->Load("St_TLA_Maker");
00047 }
00048 xdf2root(const Int_t Nevents=10,
00049 const Char_t *fileinp = "/afs/rhic.bnl.gov/star/data/samples/hijet-g2t.xdf",
00050 const Char_t *FileOut = "/afs/rhic.bnl.gov/star/data/samples/hijet-g2t.root")
00051 {
00052
00053 if (gClassTable->GetID("StChain") < 0) Load();
00054
00055
00056 St_XDFFile *xdf_in = 0;
00057 if (fileinp) xdf_in = new St_XDFFile(fileinp,"r");
00058 TFile *root_out = 0;
00059 if (FileOut) root_out = new TFile(FileOut,"RECREATE");
00060
00061
00062
00063 if (chain) delete chain;
00064 chain = new StChain("bfc");
00065 if (xdf_in) {
00066 St_xdfin_Maker *xdfin = new St_xdfin_Maker("xdfin");
00067 chain->SetInputXDFile(xdf_in);
00068 }
00069 St_TLA_Maker *geant = new St_TLA_Maker("geant","event/geant/Event");
00070 St_io_Maker *out = new St_io_Maker("Output","all");
00071 chain->PrintInfo();
00072
00073
00074 int iInit = chain->Init();
00075 if (iInit) chain->Fatal(iInit,"on init");
00076
00077
00078 gBenchmark->Start("bfc");
00079 out->Add(geant->GetName(),"geant_branch_name.root");
00080 if (root_out) {chain->Write();}
00081
00082
00083 Int_t i=0;
00084 for (Int_t i =1; i <= Nevents; i++){
00085 if (chain->Make(i)) break;
00086 St_DataSet *dst = chain->DataSet("dst");
00087 if (root_out){
00088 gBenchmark->Start("root i/o");
00089
00090
00091
00092 gBenchmark->Stop("root i/o");
00093 }
00094
00095 if (i != Nevents) chain->Clear();
00096 printf ("===========================================\n");
00097 printf ("=========================================== Done with Event no. %d\n",i);
00098 printf ("===========================================\n");
00099 }
00100
00101
00102 if (Nevents > 1) {
00103 chain->Finish();
00104 if (root_out){
00105
00106
00107 root_out->Write();
00108 root_out->Close();
00109 delete root_out;
00110 gBenchmark->Print("root i/o");
00111 }
00112 gBenchmark->Print("bfc");
00113 }
00114 else {if (!b) b = new TBrowser;}
00115 }