00001 // $Id: bfcread_hist_to_ps.C,v 1.31 2011/02/07 20:29:57 genevb Exp $ 00002 // $Log: bfcread_hist_to_ps.C,v $ 00003 // Revision 1.31 2011/02/07 20:29:57 genevb 00004 // Allow detectors specification 00005 // 00006 // Revision 1.30 2006/08/15 21:42:42 jeromel 00007 // Fix rhic -> rhic.bnl.gov 00008 // 00009 // Revision 1.29 2006/05/18 16:38:04 genevb 00010 // Introduce StHistUtil::GetRunYear() 00011 // 00012 // Revision 1.28 2006/03/28 02:04:42 genevb 00013 // Allow non-PostScript output 00014 // 00015 // Revision 1.27 2002/01/29 20:03:08 genevb 00016 // Switched default dir from QA to EventQA 00017 // 00018 // Revision 1.26 2000/09/05 19:52:20 lansdell 00019 // fixed a minor syntax error 00020 // 00021 // Revision 1.25 2000/06/21 21:15:22 kathy 00022 // now allow the zone settings for horizontal & vertical axes to be set during input to macro 00023 // 00024 // Revision 1.24 2000/06/12 19:58:54 lansdell 00025 // loaded global shared library 00026 // 00027 // Revision 1.23 2000/04/12 15:06:53 kathy 00028 // 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 00029 // 00030 // Revision 1.22 2000/03/20 17:32:55 kathy 00031 // setbranches in all macros so that they will work with softlinks - for StIOMaker 00032 // 00033 // Revision 1.21 2000/02/29 18:25:14 kathy 00034 // fix typo 00035 // 00036 // Revision 1.20 2000/02/14 20:30:41 kathy 00037 // removing unneeded macros; updating documentation in bfcread macros 00038 // 00039 // Revision 1.19 2000/01/26 19:28:15 kathy 00040 // put in call to method SetDefaultLogXList 00041 // 00042 // Revision 1.18 2000/01/19 16:29:51 kathy 00043 // update macros to use default input files in /afs/rhic.bnl.gov/star/data/samples 00044 // 00045 // Revision 1.17 2000/01/18 16:38:05 kathy 00046 // add loading of StUtilities and StAnalysisUtilities so that StHistUtil class can now be picked up from StAnalysisUtilities library 00047 // 00048 // Revision 1.16 2000/01/13 17:18:04 kathy 00049 // 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 00050 // 00051 // Revision 1.15 2000/01/10 21:59:17 kathy 00052 // must now load St_global when running St_QA_Maker 00053 // 00054 // Revision 1.14 2000/01/10 21:24:03 kathy 00055 // St_QA_Maker now requires that St_global be loaded because it uses the prop_one_track function from pams/global/egr 00056 // 00057 // Revision 1.13 2000/01/05 22:12:03 kathy 00058 // changed input file to current one 00059 // 00060 // Revision 1.12 1999/12/01 21:30:11 kathy 00061 // 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! 00062 // 00063 // Revision 1.11 1999/11/30 19:23:06 kathy 00064 // 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 00065 // 00066 // Revision 1.10 1999/11/23 20:42:16 genevb 00067 // Re-arranged load order 00068 // 00069 // Revision 1.9 1999/11/19 20:13:22 kathy 00070 // cleaned up macros to remove uneccessary lines; also added info about new tables to QA* macros 00071 // 00072 // Revision 1.8 1999/11/05 22:50:40 kathy 00073 // now input global title for all output pages in the macro for printing & drawing histograms 00074 // 00075 // Revision 1.7 1999/11/05 16:30:16 kathy 00076 // minor changes to documentation in macro 00077 // 00078 // Revision 1.6 1999/11/03 21:35:35 kathy 00079 // small fixes for use of StIOMaker - had it wrong before 00080 // 00081 // Revision 1.5 1999/11/03 19:02:55 kathy 00082 // changes to default input files and output file names - needed by perl script for testing 00083 // 00084 // Revision 1.4 1999/11/03 17:13:02 kathy 00085 // fixed macros so they use StIOMaker instead of StTreeMaker 00086 // 00087 // Revision 1.3 1999/09/21 15:07:03 kathy 00088 // 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 00089 // 00090 // Revision 1.2 1999/09/20 20:28:12 kathy 00091 // fix to give macro correct name 00092 // 00093 // Revision 1.1 1999/09/20 20:09:02 kathy 00094 // 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 00095 // 00096 // 00097 //====================================================================== 00098 // owner: Kathy Turner 00099 // what it does: see below 00100 //======================================================================= 00101 // bfcread_hist_to_ps.C 00102 // 00103 // what it does: reads the *.hist.root file produced from a chain 00104 // (such as bfc) and 00105 // then draws & sends to ps file the 00106 // histograms from given input Maker 00107 // 00108 // inputs: MainFile - *.hist.root file from bfc output 00109 // MakerHistDir - directory name of Maker that you want histograms 00110 // from (this will be first input when you did constructor) 00111 // -- see standard Maker names note below! 00112 // TopDirTree - top level directory tree in your input hist file 00113 // (this is 3rd argument of constructor for StTreeMaker that 00114 // you probably used to write the *.hist.root file) 00115 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !! 00116 // psFile - output postscript file name 00117 // PageTitle - title at top of each page - if it's "", then it's 00118 // set to MainFile by default 00119 // PrintList - name of subset histogram list that you want printed 00120 // - these are defined in StHistUtil, method SetDefaultPrintList 00121 // - default = "", prints all histograms in directory MakerHistDir 00122 // DetList - names of detectors to include (e.g. "tpc ftpc bemc") 00123 // 00124 // 00125 // standard Maker names in bfc 00126 // (but if you run your own Maker here, then use whatever name you give it) 00127 // are listed at 00128 // http://www.star.bnl.gov/STAR/html/comp_l/train/tut/bfc_maker_names.html 00129 // 00130 // 00131 // Documentation on StHistUtil class is at: 00132 // http://duvall.star.bnl.gov/STARAFS/comp/pkg/dev/StRoot/StAnalysisUtilities/doc/ 00133 // 00134 //====================================================================== 00135 00136 class StChain; 00137 StChain *chain; 00138 00139 class StIOMaker; 00140 StIOMaker *IOMk=0; 00141 00142 //------------------------------------------------------------------------ 00143 00144 void bfcread_hist_to_ps( 00145 const Char_t *MainFile= 00146 "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root", 00147 const Char_t *MakerHistDir="EventQA", 00148 const Char_t *TopDirTree="bfcTree", 00149 const Char_t *psFile="QA_hist.ps", 00150 const Char_t *PageTitle="", 00151 const Char_t *PrintList="", 00152 const Int_t ZoneH=2, 00153 const Int_t ZoneV=3, 00154 const Char_t *DetList=0 00155 ) 00156 { 00157 00158 cout << "bfcread_hist_to_ps.C, input hist file = " 00159 << MainFile << endl; 00160 cout << "bfcread_hist_to_ps.C, directory name for hist = " 00161 << MakerHistDir << endl; 00162 cout << "bfcread_hist_to_ps.C, top level directory in hist file = " 00163 << TopDirTree << endl; 00164 cout << "bfcread_hist_to_ps.C, output ps file = " 00165 << psFile << endl; 00166 cout << "bfcread_hist_to_ps.C, page title for histograms = " 00167 << PageTitle << endl; 00168 cout << "bfcread_hist_to_ps.C, subset list name of which histograms to draw,print = " 00169 << PrintList << endl; 00170 cout << "bfcread_hist_to_ps.C, # histograms on page horizontally = " 00171 << ZoneH << endl; 00172 cout << "bfcread_hist_to_ps.C, # histograms on page vertically = " 00173 << ZoneV << endl; 00174 00175 // 00176 gSystem->Load("St_base"); 00177 gSystem->Load("StChain"); 00178 gSystem->Load("StIOMaker"); 00179 gSystem->Load("StarClassLibrary"); 00180 gSystem->Load("libglobal_Tables"); 00181 gSystem->Load("StUtilities"); 00182 gSystem->Load("StAnalysisUtilities"); 00183 00184 00185 // setup chain with IOMaker - can read in .dst.root, .dst.xdf files 00186 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree); 00187 IOMk->SetDebug(); 00188 IOMk->SetIOMode("r"); 00189 IOMk->SetBranch("*",0,"0"); //deactivate all branches 00190 IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch 00191 00192 00193 // constructor for other maker (not used in chain) 00194 StHistUtil *HU = new StHistUtil; 00195 00196 // now must set pointer to StMaker so HistUtil can find histograms 00197 // with StHistUtil methods 00198 // -- input any maker pointer but must cast as type StMaker 00199 HU->SetPntrToMaker((StMaker *)IOMk); 00200 00201 // ONLY use StIOMaker in chain 00202 // --- now execute chain member functions - 1 event (histograms) only 00203 IOMk->Init(); 00204 IOMk->Clear(); 00205 IOMk->Make(); 00206 00207 // method to print out list of histograms 00208 // - can do this anytime after they're booked 00209 // - default is to print out QA hist branch 00210 Int_t NoHist=0; 00211 NoHist = HU->ListHists(MakerHistDir); 00212 cout << " in bfcread_hist_list: Num of Hist = " << NoHist << endl; 00213 00214 // Set the default canvas style to plain (so it won't print out grey!) 00215 gROOT->SetStyle("Plain"); 00216 // gStyle->SetOptStat(111111); 00217 00218 HU->SetDetectors(DetList); 00219 HU->SetHistsNamesDraw("*","*"); 00220 HU->GetRunYear(MainFile); 00221 HU->SetOutFile(psFile); 00222 HU->SetZones(ZoneH,ZoneV); 00223 HU->SetPaperSize(); 00224 HU->SetDefaultLogXList(MakerHistDir); 00225 HU->SetDefaultLogYList(MakerHistDir); 00226 if (PageTitle=="") PageTitle=MainFile; 00227 HU->SetGlobalTitle(PageTitle); 00228 00229 HU->SetDefaultPrintList(MakerHistDir,PrintList); 00230 00231 Int_t numLog = 0; 00232 numLog = HU->ExamineLogYList(); 00233 cout <<" bfcread_hist_to_ps.C, Number hist to plot with log scale = " << numLog << endl; 00234 00235 Int_t numPrint = 0; 00236 numPrint = HU->ExaminePrintList(); 00237 cout << " bfcread_hist_to_ps.C, Number hist to print = " << numPrint << endl; 00238 00239 // Now draw the actual histograms to canvas and to ps file 00240 HU->DrawHists(MakerHistDir); 00241 00242 cout <<" bfcread_hist_to_ps.C, end of macro" << endl; 00243 00244 } 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256
1.5.9