StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Example_readfz_plot.C
1 // $Id: Example_readfz_plot.C,v 1.4 2000/04/18 20:37:25 kathy Exp $
2 // $Log: Example_readfz_plot.C,v $
3 // Revision 1.4 2000/04/18 20:37:25 kathy
4 // St_DataSet,St_DataSetIter,St_Table classes are nowchanged to TDataSet,TDataSetIter,TTable
5 //
6 // Revision 1.3 1999/05/21 15:45:02 kathy
7 // fixed owner on Example_readfz_plot.C
8 //
9 // Revision 1.2 1999/05/21 15:33:49 kathy
10 // made sure Log & Id are in each file and also put in standard comment line with name of owner
11 //
12 //=======================================================================
13 // owner: Pavel Nevski
14 // what it does:
15 //=======================================================================
16 
17 // readfz_plot.C
18 //
19 // reads in geant fz file, gives a browser and then you can make a plot
20 
21 {
22 gROOT->LoadMacro("geant.C");
23 Load();
24 geant(1,"/disk1/star/test/psc0049_08_40evts.fzd");
25 //this will run 1 event and give you a browser
26 // if you want to plot something from geant/event/g2t_track then
27 
28 TDataSet *yp = chain->DataSet("geant");
29 //pointer to geant set
30 
31 TDataSetIter geantIter(yp);
32 // iterator
33 
34 St_g2t_track *pt = (St_g2t_track *) geantIter.Find("g2t_track");
35 // pointer to g2t_track
36 
37 g2t_track_st *t = pt->GetTable();
38 // pointer to table
39 
40 TH1F *h1 = new TH1F("g2t_rap","rapidity",100,-7.0,7.0);
41 //define histogram
42 
43 for (Int_t i = 0; i < pt->GetNRows(); i++,t++){ h1->Fill(t->rapidity);}
44 //fill histogram
45 
46 TCanvas *c1 = new TCanvas("c1","c1");
47 // make canvas
48 
49 h1->Draw();
50 // on screen
51 }
52 
virtual TDataSet * Find(const Char_t *path, TDataSet *rootset=0, Bool_t mkdir=kFALSE, Bool_t titleFlag=kFALSE)