00001 // $Id: bfcread_hist_overlay.C,v 1.7 2006/08/15 21:42:41 jeromel Exp $ 00002 // $Log: bfcread_hist_overlay.C,v $ 00003 // Revision 1.7 2006/08/15 21:42:41 jeromel 00004 // Fix rhic -> rhic.bnl.gov 00005 // 00006 // Revision 1.6 2002/01/29 20:03:08 genevb 00007 // Switched default dir from QA to EventQA 00008 // 00009 // Revision 1.5 2000/07/26 19:53:45 lansdell 00010 // made changes for creating new QA histograms 00011 // 00012 // Revision 1.4 2000/04/12 15:06:53 kathy 00013 // 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 00014 // 00015 // Revision 1.3 2000/03/20 17:32:55 kathy 00016 // setbranches in all macros so that they will work with softlinks - for StIOMaker 00017 // 00018 // Revision 1.2 2000/02/14 20:30:41 kathy 00019 // removing unneeded macros; updating documentation in bfcread macros 00020 // 00021 // Revision 1.1 2000/01/31 18:48:41 kathy 00022 // new macro to show how to use the Overlay methods that Curtis wrote - just by themselves 00023 // 00024 //====================================================================== 00025 // owner: Kathy Turner / Curtis Lansdell 00026 // what it does: see below 00027 //======================================================================= 00028 // bfcread_hist_overlay.C 00029 // 00030 // what it does: reads the *.hist.root file produced from a chain 00031 // (such as bfc) and then uses the Overlay* methods 00032 // from StHistUtil class to overlay 2 histograms 00033 // (this does a 1dim and 2dim example) 00034 // 00035 // inputs: MainFile - *.hist.root file from bfc output 00036 // MakerHistDir - directory name of Maker that you want histograms 00037 // from (this will be first input when you did constructor) 00038 // -- see standard Maker names note below! 00039 // TopDirTree - top level directory tree in your input hist file 00040 // (this is 3rd argument of constructor for StTreeMaker that 00041 // you probably used to write the *.hist.root file) 00042 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !! 00043 // PageTitle - title at top of each page - if it's "", then it's 00044 // set to MainFile by default 00045 // 00046 // 00047 // Documentation on StHistUtil class is at: 00048 // http://duvall.star.bnl.gov/STARAFS/comp/pkg/dev/StRoot/StAnalysisUtilities/doc/ 00049 // 00050 //====================================================================== 00051 00052 class StChain; 00053 StChain *chain; 00054 00055 class StIOMaker; 00056 StIOMaker *IOMk=0; 00057 00058 //------------------------------------------------------------------------ 00059 00060 void bfcread_hist_overlay( 00061 const Char_t *MainFile= 00062 "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root", 00063 const Char_t *MakerHistDir="EventQA", 00064 const Char_t *TopDirTree="bfcTree", 00065 const Char_t *PageTitle="") 00066 { 00067 00068 cout << "bfcread_hist_overlay.C, input hist file = " 00069 << MainFile << endl; 00070 cout << "bfcread_hist_overlay.C, directory name for hist = " 00071 << MakerHistDir << endl; 00072 cout << "bfcread_hist_overlay.C, top level directory in hist file = " 00073 << TopDirTree << endl; 00074 cout << "bfcread_hist_overlay.C, hist page title " << 00075 PageTitle << endl; 00076 00077 // 00078 gSystem->Load("St_base"); 00079 gSystem->Load("StChain"); 00080 gSystem->Load("StIOMaker"); 00081 gSystem->Load("StarClassLibrary"); 00082 gSystem->Load("StUtilities"); 00083 gSystem->Load("StAnalysisUtilities"); 00084 00085 00086 // setup chain with IOMaker - can read in .dst.root, .dst.xdf files 00087 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree); 00088 IOMk->SetDebug(); 00089 IOMk->SetIOMode("r"); 00090 IOMk->SetBranch("*",0,"0"); //deactivate all branches 00091 IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch 00092 00093 00094 // constructor for other maker (not used in chain) 00095 StHistUtil *HU = new StHistUtil; 00096 00097 // now must set pointer to StMaker so HistUtil can find histograms 00098 // with StHistUtil methods 00099 // -- input any maker pointer but must cast as type StMaker 00100 HU->SetPntrToMaker((StMaker *)IOMk); 00101 00102 // ONLY use StIOMaker in chain 00103 // --- now execute chain member functions - 1 event (histograms) only 00104 IOMk->Init(); 00105 IOMk->Clear(); 00106 IOMk->Make(); 00107 00108 cout <<" bfcread_hist_overlay.C, have read histograms" << endl; 00109 00110 if (PageTitle=="") PageTitle=MainFile; 00111 HU->SetGlobalTitle(PageTitle); 00112 00113 // 1Dim. overlay 00114 Int_t result = HU->Overlay1D(MakerHistDir, 00115 "TabQaGtrkRT","TabQaPtrkRT"); 00116 if (result == kStErr) 00117 cout << " !!! There was an error in Overlay1D !!!" << endl; 00118 00119 // 2Dim. overlay 00120 result = HU->Overlay2D(MakerHistDir, 00121 "TabQaGtrkLengthVEtaT","TabQaPtrkLengthVEtaT"); 00122 if (result == kStErr) 00123 cout << " !!! There was an error in Overlay2D !!!" << endl; 00124 00125 00126 cout <<" bfcread_hist_overlay.C, end of macro" << endl; 00127 00128 } 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140
1.5.9