StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcread_hist_list.C
1 // $Id: bfcread_hist_list.C,v 1.22 2006/08/15 21:42:39 jeromel Exp $
2 // $Log: bfcread_hist_list.C,v $
3 // Revision 1.22 2006/08/15 21:42:39 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.21 2002/01/29 20:03:08 genevb
7 // Switched default dir from QA to EventQA
8 //
9 // Revision 1.20 2000/06/13 18:41:59 kathy
10 // had to move order of library loading for some unknown reason...
11 //
12 // Revision 1.19 2000/06/13 00:58:59 lansdell
13 // added libglobal_Tables to resolve crashes
14 //
15 // Revision 1.18 2000/04/12 15:06:52 kathy
16 // changed all macros that read DSTs to load Tables from libraries: gen,sim,global,dst instead of ALL Tables (previously loaded St_Tables); currently, if you are using DEV to read a DST in NEW,PRO, you must comment out the loading of libtpc_Tables because of a mismatch with tpt_track table
17 //
18 // Revision 1.17 2000/03/20 17:32:55 kathy
19 // setbranches in all macros so that they will work with softlinks - for StIOMaker
20 //
21 // Revision 1.16 2000/02/14 20:30:40 kathy
22 // removing unneeded macros; updating documentation in bfcread macros
23 //
24 // Revision 1.15 2000/01/19 16:29:51 kathy
25 // update macros to use default input files in /afs/rhic.bnl.gov/star/data/samples
26 //
27 // Revision 1.14 2000/01/18 16:38:05 kathy
28 // add loading of StUtilities and StAnalysisUtilities so that StHistUtil class can now be picked up from StAnalysisUtilities library
29 //
30 // Revision 1.13 2000/01/13 17:18:04 kathy
31 // updated bfcread_hist* macros so that they can now use the new *PrintList methods from StHistUtil to only print a subset (given a list of names) of histograms from the given Maker Directory; also updated documentation
32 //
33 // Revision 1.12 2000/01/05 22:12:03 kathy
34 // changed input file to current one
35 //
36 // Revision 1.11 1999/12/01 21:30:11 kathy
37 // added input TopDirTree to bfcread_hist* macros in order to tell which top level directory hist file has since sometimes its not bfcTree; cleaned up print statements in bfcread_dst*hist.C macros; two new macros bfcread_dst_*QA_outhistfile.C added which read dst file and book and fill histograms and write out a new *.hist.root file, instead of just sending hist to postscript - this new *.hist.root file can then be read into bfcread_hist*.C to look at it --- note that topdirtree is different!
38 //
39 // Revision 1.10 1999/11/30 19:23:05 kathy
40 // changed bfcread_dst*.C so that MakerHist is hardwired in instead of being input; wrote better documentation in bfcread_hist*.C so that it explains where top level directory is set
41 //
42 // Revision 1.9 1999/11/23 20:40:48 genevb
43 // Re-arranged load order
44 //
45 // Revision 1.8 1999/11/19 20:13:21 kathy
46 // cleaned up macros to remove uneccessary lines; also added info about new tables to QA* macros
47 //
48 // Revision 1.7 1999/11/05 16:30:16 kathy
49 // minor changes to documentation in macro
50 //
51 // Revision 1.6 1999/11/03 21:35:35 kathy
52 // small fixes for use of StIOMaker - had it wrong before
53 //
54 // Revision 1.5 1999/11/03 19:02:54 kathy
55 // changes to default input files and output file names - needed by perl script for testing
56 //
57 // Revision 1.4 1999/11/03 17:13:00 kathy
58 // fixed macros so they use StIOMaker instead of StTreeMaker
59 //
60 // Revision 1.3 1999/09/21 15:07:02 kathy
61 // change to have notes on input values at top of each macro, also clean up notes on usage and remove the usage of method St_QA_Maker::SetPntrToHistUtil which is not going to be used now that I made St_QA_Maker totally independent of the histogram printing
62 //
63 // Revision 1.2 1999/09/20 20:09:01 kathy
64 // bfcread_hist_list_all now lists all histograms in hist.root file; bfcread_hist_list now only lists those that are in the Maker that is input; bfcread_hist_to_ps prints and draws the hist that are in the input Maker, bfcread_dst_QAhist.C reads .dst.root file - runs QA_Maker and prints and draws the QA histograms
65 //
66 //
67 //======================================================================
68 // owner: Kathy Turner
69 // what it does: see below
70 //=======================================================================
71 // bfcread_hist_list.C
72 //
73 // what it does: reads the *.hist.root file produced from a chain
74 // (such as bfc) and
75 // then prints list of histograms from given input Maker
76 //
77 // inputs: MainFile - *.hist.root file from bfc output
78 // MakerHistDir - directory name of Maker that you want histograms
79 // from (this will be first input when you did constructor)
80 // -- see standard Maker names note below!
81 // TopDirTree - top level directory tree in your input hist file
82 // (this is 3rd argument of constructor for StTreeMaker that
83 // you probably used to write the *.hist.root file)
84 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !!
85 //
86 // standard Maker names in bfc
87 // (but if you run your own Maker here, then use whatever name you give it)
88 // are listed at
89 // http://www.star.bnl.gov/STAR/html/comp_l/train/tut/bfc_maker_names.html
90 //
91 //
92 // Documentation on StHistUtil class is at:
93 // http://duvall.star.bnl.gov/STARAFS/comp/pkg/dev/StRoot/StAnalysisUtilities/doc/
94 //
95 //======================================================================
96 
97 
98 class StChain;
99 StChain *chain;
100 
101 class StIOMaker;
102 StIOMaker *IOMk=0;
103 
104 //------------------------------------------------------------------------
105 
106 void bfcread_hist_list(
107  const Char_t *MainFile=
108  "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root",
109  const Char_t *MakerHistDir="EventQA",
110  const Char_t *TopDirTree="bfcTree")
111 {
112 
113  cout << "bfcread_hist_list.C, input hist file = "
114  << MainFile << endl;
115  cout << "bfcread_hist_list.C, directory name for hist = "
116  << MakerHistDir << endl;
117  cout << "bfcread_hist_list.C, top level directory in hist file = "
118  << TopDirTree << endl;
119 
120 //
121  gSystem->Load("St_base");
122  gSystem->Load("StChain");
123  gSystem->Load("StIOMaker");
124  gSystem->Load("StarClassLibrary");
125  gSystem->Load("StUtilities");
126  gSystem->Load("StAnalysisUtilities");
127  gSystem->Load("libglobal_Tables");
128 
129 // setup chain with IOMaker - can read in .dst.root, .dst.xdf files
130  StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree);
131  IOMk->SetDebug();
132  IOMk->SetIOMode("r");
133  IOMk->SetBranch("*",0,"0"); //deactivate all branches
134  IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch
135 
136 
137 // constructor for other maker (not used in chain)
138  StHistUtil *HU = new StHistUtil;
139 
140 // now must set pointer to StMaker so HistUtil can find histograms
141 // with StHistUtil methods
142 // -- input any maker pointer but must cast as type StMaker
143  HU->SetPntrToMaker((StMaker *)IOMk);
144 
145 // ONLY use StIOMaker in chain
146 // --- now execute chain member functions - 1 event (histograms) only
147  IOMk->Init();
148  IOMk->Clear();
149  IOMk->Make();
150 
151 // method to print out list of histograms
152 // - can do this anytime after they're booked
153 // - default is to print out QA hist branch
154  Int_t NoHist=0;
155  NoHist = HU->ListHists(MakerHistDir);
156  cout << " in bfcread_hist_list: Num of Hist = " << NoHist << endl;
157 
158 }
159 
160 
161 
162 
163 
164 
165 
virtual void Clear(Option_t *opt)
User defined functions.
Definition: StIOMaker.cxx:252
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual Int_t Make()
Definition: StIOMaker.cxx:183