00001 // $Id: bfcread_hist_list_all.C,v 1.15 2006/08/15 21:42:40 jeromel Exp $ 00002 // $Log: bfcread_hist_list_all.C,v $ 00003 // Revision 1.15 2006/08/15 21:42:40 jeromel 00004 // Fix rhic -> rhic.bnl.gov 00005 // 00006 // Revision 1.14 2000/07/26 19:53:45 lansdell 00007 // made changes for creating new QA histograms 00008 // 00009 // Revision 1.13 2000/06/12 19:58:54 lansdell 00010 // loaded global shared library 00011 // 00012 // Revision 1.12 2000/04/18 20:44:53 kathy 00013 // St_DataSet,St_DataSetIter,St_Table classes are nowchanged to TDataSet,TDataSetIter,TTable 00014 // 00015 // Revision 1.11 2000/04/12 15:06:52 kathy 00016 // 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 00017 // 00018 // Revision 1.10 2000/01/19 16:29:51 kathy 00019 // update macros to use default input files in /afs/rhic.bnl.gov/star/data/samples 00020 // 00021 // Revision 1.9 2000/01/05 22:12:03 kathy 00022 // changed input file to current one 00023 // 00024 // Revision 1.8 1999/12/01 21:30:11 kathy 00025 // 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! 00026 // 00027 // Revision 1.7 1999/11/30 19:23:05 kathy 00028 // 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 00029 // 00030 // Revision 1.6 1999/11/19 20:13:22 kathy 00031 // cleaned up macros to remove uneccessary lines; also added info about new tables to QA* macros 00032 // 00033 // Revision 1.5 1999/11/03 21:35:35 kathy 00034 // small fixes for use of StIOMaker - had it wrong before 00035 // 00036 // Revision 1.4 1999/11/03 19:02:54 kathy 00037 // changes to default input files and output file names - needed by perl script for testing 00038 // 00039 // Revision 1.3 1999/11/03 17:13:00 kathy 00040 // fixed macros so they use StIOMaker instead of StTreeMaker 00041 // 00042 // Revision 1.2 1999/09/21 15:07:03 kathy 00043 // 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 00044 // 00045 // Revision 1.1 1999/09/20 20:09:02 kathy 00046 // 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 00047 // 00048 //======================================================================= 00049 // owner: Kathy Turner 00050 // what it does: reads the *.hist.root file produced from a chain 00051 // (such as bfc) and 00052 // then lists all histogram branches and the names and 00053 // titles of the histograms in the branches 00054 // 00055 // inputs: MainFile - *.hist.root file from bfc output 00056 // TopDirTree - top level directory tree in your input hist file 00057 // (this is 3rd argument of constructor for StTreeMaker that 00058 // you probably used to write the *.hist.root file) 00059 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !!// 00060 // 00061 //======================================================================= 00062 00063 class StChain; 00064 class TDataSet; 00065 00066 StChain *chain; 00067 TDataSet *Event; 00068 00069 void bfcread_hist_list_all( 00070 const Char_t *MainFile= 00071 "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root", 00072 const Char_t *TopDirTree="bfcTree") 00073 { 00074 cout << "bfcread_hist_list_all.C, input hist file = " 00075 << MainFile << endl; 00076 cout << "bfcread_hist_list_all.C, top level directory in hist file = " 00077 << TopDirTree << endl; 00078 // 00079 gSystem->Load("St_base"); 00080 gSystem->Load("StChain"); 00081 gSystem->Load("StUtilities"); 00082 gSystem->Load("StIOMaker"); 00083 gSystem->Load("StarClassLibrary"); 00084 gSystem->Load("libglobal_Tables"); 00085 00086 00087 // setup chain with IOMaker - can read in .dst.root, .dst.xdf files 00088 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree); 00089 IOMk->SetDebug(); 00090 IOMk->SetIOMode("r"); 00091 IOMk->SetBranch("*",0,"0"); //deactivate all branches 00092 // IOMk->SetBranch("tpc_tracks",0,"r"); //activate tpc_tracks Branch 00093 // IOMk->SetBranch("geantBranch",0,"r"); //activate geant Branch 00094 IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch 00095 00096 00097 // --- now execute chain member functions 00098 IOMk->Init(); 00099 IOMk->Clear(); 00100 IOMk->Make(); 00101 00102 // Now look at histograms: 00103 Event = IOMk->GetDataSet("hist"); 00104 if (Event) { 00105 cout << "Here is list of all histograms: " << endl; 00106 Event->ls(9); 00107 } 00108 00109 TDataSetIter nextHistList(Event); 00110 St_ObjectSet *histContainer = 0; 00111 TList *dirList = 0; 00112 while (histContainer = (St_ObjectSet *)nextHistList()) { 00113 dirList = (TList *) histContainer->GetObject(); 00114 TIter nextHist(dirList); 00115 TObject *o = 0; 00116 cout << " --- " << histContainer->GetName() << endl; 00117 while (o= nextHist()) { 00118 cout << " Hist name: " << o->GetName() << " ==> Title: " 00119 << o->GetTitle() << endl; 00120 } 00121 } 00122 00123 } 00124 00125 00126
1.5.9