46 void Example_read_dst_makehist(
49 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root")
52 gSystem->Load(
"St_base");
53 gSystem->Load(
"StChain");
55 gSystem->Load(
"libglobal_Tables");
56 gSystem->Load(
"libgen_Tables");
57 gSystem->Load(
"libsim_Tables");
59 gSystem->Load(
"StIOMaker");
60 gSystem->Load(
"StarClassLibrary");
71 IOMk->SetBranch(
"*",0,
"0");
74 IOMk->SetBranch(
"dstBranch",0,
"r");
81 TFile *hist_outfile = 0;
82 const Char_t *root_file =
"Example_read_dst_makehist.root";
83 hist_outfile =
new TFile(root_file,
"RECREATE");
86 TH1F *h1 =
new TH1F(
"h1",
"z position of primary vertex",100,-100.,100.);
87 h1->SetXTitle(
"vertex z position ");
88 h1->SetYTitle(
"num events");
89 TH1F *h2 =
new TH1F(
"h2",
"z position of all vtx in event",100,-100.,100.);
90 h2->SetXTitle(
"vertex z position ");
91 h2->SetYTitle(
"num events");
93 for (
int iev=0;iev<nevents; iev++)
96 int iret = chain->
Make();
99 cout <<
" !!!!! Now read event # " << iev << endl;
101 TDataSet *ds=chain->GetDataSet(
"dst/vertex");
103 St_dst_vertex *vert = (St_dst_vertex *) dsiter.Find(
"vertex");
105 cout <<
" vertex table pointer = " << vert << endl;
114 cout <<
" table header info: name = " << vert->GetName() << endl;
115 cout <<
" table header info: type = " << vert->GetType() << endl;
116 cout <<
" table header info: #rows used = " << vert->GetNRows() << endl;
117 cout <<
" table header info: #rows allocated = " << vert->GetTableSize() << endl;
118 cout <<
" table header info: row size (bytes) = " << vert->GetRowSize() << endl;
119 cout <<
" table header info: #columns = " << vert->GetNumberOfColumns() << endl;
126 dst_vertex_st *sth = vert->GetTable();
127 cout <<
" prim vtx z : " << sth->z << endl;
134 for (ij=0; ij< vert->GetNRows(); ij++)
136 h2->Fill(sth[ij]->z);
141 cout <<
" ==> finished loop" << endl;
143 TCanvas *c1 =
new TCanvas(
"c1",
" from table dst/vertex",200,10,600,880);
151 TPostScript ps(
"Example_read_dst_makehist.ps",111);
160 hist_outfile->Write();
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
virtual void Clear(Option_t *option="")
User defined functions.