StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcread.C
1 // $Id: bfcread.C,v 1.26 2006/08/15 21:43:07 jeromel Exp $
2 // $Log: bfcread.C,v $
3 // Revision 1.26 2006/08/15 21:43:07 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.25 2000/04/18 20:37:25 kathy
7 // St_DataSet,St_DataSetIter,St_Table classes are nowchanged to TDataSet,TDataSetIter,TTable
8 //
9 // Revision 1.24 2000/04/13 21:46:22 kathy
10 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
11 //
12 // Revision 1.23 2000/04/12 16:13:40 kathy
13 // have changed so that macro loads only table libraries needed instead of all table libraries
14 //
15 // Revision 1.22 2000/03/20 17:50:40 kathy
16 // fix all macros so that they set all branches on that are needed - otherwise won't work with soft links
17 //
18 // Revision 1.21 2000/01/19 15:46:05 kathy
19 // change default input files to point to ones in /afs/rhic.bnl.gov/star/data/samples
20 //
21 // Revision 1.20 2000/01/05 22:11:57 kathy
22 // changed input file to current one
23 //
24 // Revision 1.19 1999/09/13 14:33:49 kathy
25 // update bfcread.C so that it now uses IOMaker instead of TreeMaker - tested it for .dst.root,.dst.xdf, .*.root files - works for all
26 //
27 // Revision 1.18 1999/07/27 00:47:04 kathy
28 // remove the for loop from bfcread.C and replace with basically while and go to statements; this is due to the for loop problem in CINT - see my email on 26Jul99 to starsoft
29 //
30 // Revision 1.17 1999/07/13 01:13:02 kathy
31 // moved rch.C to obsolete, put in id,log,owner into HbtExample, removed loading of StRootEvent and changed default input file in bfcread.C and Example_readdst_qa_tables.C
32 //
33 // Revision 1.16 1999/06/27 22:45:34 fisyak
34 // Merge StRootEvent and StEvent
35 //
36 // Revision 1.15 1999/06/22 18:09:02 kathy
37 // change default input file
38 //
39 // Revision 1.14 1999/06/17 18:26:15 kathy
40 // bfcread: change default input file; Example.. fix so works if you just execute it
41 //
42 // Revision 1.13 1999/06/07 17:31:23 kathy
43 // clean up some macros
44 //
45 // Revision 1.12 1999/05/21 15:33:57 kathy
46 // made sure Log & Id are in each file and also put in standard comment line with name of owner
47 //
48 // Revision 1.11 1999/05/20 18:43:21 kathy
49 // removing unecessary macros
50 //
51 //======================================================================
52 // owner: Victor Perevoztchikov
53 // what it does: reads output files from bfc and displays data in browser
54 // - more info below
55 //=======================================================================
56 // bfcread.C
57 //
58 // Kathy's notes (9/13/99):
59 // - example to show how to read in file (.dst.xdf, .dst.root, .*.root)
60 // produced from bfc.C and:
61 // - run another maker (St_QA_Maker) - commented out for now
62 // - look at it using the browser
63 //
64 // This example is reading in the "dst" branch of the root file.
65 // (i.e. the input file is .dst.root)
66 // If you want to read in a different branch, you must change:
67 // - the input file name, e.g. *.bname.root (or .dst.xdf)
68 // - IOMk->SetBranch("bnameBranch",0,"r");
69 // - chain->GetDataSet("bname");
70 //
71 //
72 // This example is for debugging/testing purposes and therefore does
73 // not have chain->Finish(); at end
74 //
75 //======================================================================
76 
77 class StChain;
78 class TDataSet;
79 
81 StChain *chain;
82 TBrowser *brow=0;
83 
84 void bfcread(
85  Int_t nevents=1,
86  const char *MainFile=
87 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root")
88 {
89 //
90  gSystem->Load("St_base");
91  gSystem->Load("StChain");
92 
93  gSystem->Load("libglobal_Tables");
94  gSystem->Load("libgen_Tables");
95  gSystem->Load("libsim_Tables");
96 
97  gSystem->Load("StIOMaker");
98 
99 
100 // Setup top part of chain
101  chain = new StChain("bfc");
102  chain->SetDebug();
103 
104  StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
105  IOMk->SetDebug();
106  IOMk->SetIOMode("r");
107  IOMk->SetBranch("*",0,"0"); //deactivate all branches
108  IOMk->SetBranch("dstBranch",0,"r"); //activate dst Branch
109 
110 
111 // How to add other makers to chain (must also load library!)
112 // St_QA_Maker *qa = new St_QA_Maker;
113 
114 // --- now execute chain member functions
115  chain->Init();
116 
117 // Event loop
118  int istat=0,i=1;
119 EventLoop: if (i <= nevents && !istat) {
120  cout << "============================ Event " << i << " start" << endl;
121  chain->Clear();
122  istat = chain->Make(i);
123  cout << " istat value returned from chain Make = " << istat << endl;
124  if (istat) {cout << "Last event processed. Status = " << istat << endl;}
125  i++; goto EventLoop;
126  }
127 
128 
129  cout << " bfcread: passed event loop " << endl;
130 
131  Event = chain->GetDataSet("dst");
132  if (Event) {
133  Event->ls(9);
134  brow = new TBrowser("BName","BTitle");
135  }
136 
137 // Comment out for now because it clears data so you can't
138 // look at data in browser!
139 // Call finish routines:
140 // chain->Finish();
141 
142 }
143 
144 
145 
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110
Definition: AgUStep.h:26