StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcread_hist_list_all.C
1 // $Id: bfcread_hist_list_all.C,v 1.15 2006/08/15 21:42:40 jeromel Exp $
2 // $Log: bfcread_hist_list_all.C,v $
3 // Revision 1.15 2006/08/15 21:42:40 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.14 2000/07/26 19:53:45 lansdell
7 // made changes for creating new QA histograms
8 //
9 // Revision 1.13 2000/06/12 19:58:54 lansdell
10 // loaded global shared library
11 //
12 // Revision 1.12 2000/04/18 20:44:53 kathy
13 // St_DataSet,St_DataSetIter,St_Table classes are nowchanged to TDataSet,TDataSetIter,TTable
14 //
15 // Revision 1.11 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.10 2000/01/19 16:29:51 kathy
19 // update macros to use default input files in /afs/rhic.bnl.gov/star/data/samples
20 //
21 // Revision 1.9 2000/01/05 22:12:03 kathy
22 // changed input file to current one
23 //
24 // Revision 1.8 1999/12/01 21:30:11 kathy
25 // 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!
26 //
27 // Revision 1.7 1999/11/30 19:23:05 kathy
28 // 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
29 //
30 // Revision 1.6 1999/11/19 20:13:22 kathy
31 // cleaned up macros to remove uneccessary lines; also added info about new tables to QA* macros
32 //
33 // Revision 1.5 1999/11/03 21:35:35 kathy
34 // small fixes for use of StIOMaker - had it wrong before
35 //
36 // Revision 1.4 1999/11/03 19:02:54 kathy
37 // changes to default input files and output file names - needed by perl script for testing
38 //
39 // Revision 1.3 1999/11/03 17:13:00 kathy
40 // fixed macros so they use StIOMaker instead of StTreeMaker
41 //
42 // Revision 1.2 1999/09/21 15:07:03 kathy
43 // 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
44 //
45 // Revision 1.1 1999/09/20 20:09:02 kathy
46 // 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
47 //
48 //=======================================================================
49 // owner: Kathy Turner
50 // what it does: reads the *.hist.root file produced from a chain
51 // (such as bfc) and
52 // then lists all histogram branches and the names and
53 // titles of the histograms in the branches
54 //
55 // inputs: MainFile - *.hist.root file from bfc output
56 // TopDirTree - top level directory tree in your input hist file
57 // (this is 3rd argument of constructor for StTreeMaker that
58 // you probably used to write the *.hist.root file)
59 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !!//
60 //
61 //=======================================================================
62 
63 class StChain;
64 class TDataSet;
65 
66 StChain *chain;
68 
69 void bfcread_hist_list_all(
70  const Char_t *MainFile=
71  "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root",
72  const Char_t *TopDirTree="bfcTree")
73 {
74  cout << "bfcread_hist_list_all.C, input hist file = "
75  << MainFile << endl;
76  cout << "bfcread_hist_list_all.C, top level directory in hist file = "
77  << TopDirTree << endl;
78 //
79  gSystem->Load("St_base");
80  gSystem->Load("StChain");
81  gSystem->Load("StUtilities");
82  gSystem->Load("StIOMaker");
83  gSystem->Load("StarClassLibrary");
84  gSystem->Load("libglobal_Tables");
85 
86 
87 // setup chain with IOMaker - can read in .dst.root, .dst.xdf files
88  StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree);
89  IOMk->SetDebug();
90  IOMk->SetIOMode("r");
91  IOMk->SetBranch("*",0,"0"); //deactivate all branches
92 // IOMk->SetBranch("tpc_tracks",0,"r"); //activate tpc_tracks Branch
93 // IOMk->SetBranch("geantBranch",0,"r"); //activate geant Branch
94  IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch
95 
96 
97 // --- now execute chain member functions
98  IOMk->Init();
99  IOMk->Clear();
100  IOMk->Make();
101 
102 // Now look at histograms:
103  Event = IOMk->GetDataSet("hist");
104  if (Event) {
105  cout << "Here is list of all histograms: " << endl;
106  Event->ls(9);
107  }
108 
109  TDataSetIter nextHistList(Event);
110  St_ObjectSet *histContainer = 0;
111  TList *dirList = 0;
112  while (histContainer = (St_ObjectSet *)nextHistList()) {
113  dirList = (TList *) histContainer->GetObject();
114  TIter nextHist(dirList);
115  TObject *o = 0;
116  cout << " --- " << histContainer->GetName() << endl;
117  while (o= nextHist()) {
118  cout << " Hist name: " << o->GetName() << " ==> Title: "
119  << o->GetTitle() << endl;
120  }
121  }
122 
123 }
124 
125 
126 
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
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
Definition: AgUStep.h:26
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56