9 void ExampleReader(
const char *path =
"/star/institutions/mit/common/run6-trans/chargedPions/chargedPions_7097009.tree.root") {
10 gROOT->Macro(
"StRoot/StSpinPool/StChargedPionAnalysisMaker/macros/LoadLibs.C");
12 TFile *f = TFile::Open(path);
13 TTree *tree = (TTree*)f->Get(
"tree");
15 tree->SetBranchAddress(
"event", &event);
17 for(
int i=0; i<3; i++) {
20 cout <<
"run: " <<
event->runId() <<
" event: " <<
event->eventId();
22 if( event->vertex(0) )
23 cout <<
" vz: " << event->vertex(0)->Z() << endl;
25 for(
int j=0; j<
event->nJets(); j++) {
26 cout <<
" jet #" << j+1 <<
" ";
27 cout <<
"pt: " <<
event->jet(j)->Pt() <<
" "
28 <<
"eta: " <<
event->jet(j)->Eta() <<
" "
29 <<
"phi: " <<
event->jet(j)->Phi() << endl;
31 int nparticles = (
event->jet(j)->particles()).size();
32 for(
int k=0; k<nparticles; k++) {
34 cout <<
" particle #" << k+1 <<
" "
35 <<
" charge " << p.charge() <<
" "
36 <<
" pt " << p.Pt() <<
" "
37 <<
" eta " << p.Eta() << endl;