33 void Example_read_dst_write_table_ntup(
35 const Char_t *MainFile=
36 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root",
37 const Char_t *NtupFile=
"globtrk_ntup.root")
40 cout <<
" nevents to process = " << nevents << endl;
41 cout <<
" Input file = " << MainFile << endl;
42 cout <<
" Output ntup file = " << NtupFile << endl;
44 gSystem->Load(
"St_base");
45 gSystem->Load(
"StChain");
47 gSystem->Load(
"libglobal_Tables");
48 gSystem->Load(
"libgen_Tables");
49 gSystem->Load(
"libsim_Tables");
51 gSystem->Load(
"StIOMaker");
52 gSystem->Load(
"StarClassLibrary");
53 gSystem->Load(
"StUtilities");
54 gSystem->Load(
"StAnalysisUtilities");
64 IOMk->SetBranch(
"*",0,
"0");
67 IOMk->SetBranch(
"dstBranch",0,
"r");
74 St_TableNtuple *myNtuple=0;
81 for (
int iev=0;iev<nevents; iev++)
84 int iret = chain->
Make();
87 cout <<
" !!!!! Now read event # " << iev << endl;
89 TDataSet *ds=chain->GetDataSet(
"dst/globtrk");
91 St_dst_track *glob = (St_dst_track *) dsiter.Find(
"globtrk");
112 cout <<
" CREATE NTUPLE! " << endl;
113 ntupfile =
new TFile(NtupFile,
"RECREATE",
"My Ntuple");
114 myNtuple =
new St_TableNtuple((
St_Table&)*glob);
119 myNtuple->Fill((
TTable&)*glob);
122 cout <<
" ==> finished loop, now write ntuple to output file" << endl;
127 gStyle->SetOptStat(111111);
128 myNtuple->Draw(
"n_point");
129 myNtuple->Draw(
"r0:z0",
"n_point<50 && n_fit_point<40");
130 myNtuple->Draw(
"x_first0:x_first1",
"n_point<50 && n_fit_point<40");
132 cout <<
" ==> close output file" << endl;
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
virtual void Clear(Option_t *option="")
User defined functions.