00001 // $Id: bfcread.C,v 1.26 2006/08/15 21:43:07 jeromel Exp $ 00002 // $Log: bfcread.C,v $ 00003 // Revision 1.26 2006/08/15 21:43:07 jeromel 00004 // Fix rhic -> rhic.bnl.gov 00005 // 00006 // Revision 1.25 2000/04/18 20:37:25 kathy 00007 // St_DataSet,St_DataSetIter,St_Table classes are nowchanged to TDataSet,TDataSetIter,TTable 00008 // 00009 // Revision 1.24 2000/04/13 21:46:22 kathy 00010 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global 00011 // 00012 // Revision 1.23 2000/04/12 16:13:40 kathy 00013 // have changed so that macro loads only table libraries needed instead of all table libraries 00014 // 00015 // Revision 1.22 2000/03/20 17:50:40 kathy 00016 // fix all macros so that they set all branches on that are needed - otherwise won't work with soft links 00017 // 00018 // Revision 1.21 2000/01/19 15:46:05 kathy 00019 // change default input files to point to ones in /afs/rhic.bnl.gov/star/data/samples 00020 // 00021 // Revision 1.20 2000/01/05 22:11:57 kathy 00022 // changed input file to current one 00023 // 00024 // Revision 1.19 1999/09/13 14:33:49 kathy 00025 // update bfcread.C so that it now uses IOMaker instead of TreeMaker - tested it for .dst.root,.dst.xdf, .*.root files - works for all 00026 // 00027 // Revision 1.18 1999/07/27 00:47:04 kathy 00028 // remove the for loop from bfcread.C and replace with basically while and go to statements; this is due to the for loop problem in CINT - see my email on 26Jul99 to starsoft 00029 // 00030 // Revision 1.17 1999/07/13 01:13:02 kathy 00031 // moved rch.C to obsolete, put in id,log,owner into HbtExample, removed loading of StRootEvent and changed default input file in bfcread.C and Example_readdst_qa_tables.C 00032 // 00033 // Revision 1.16 1999/06/27 22:45:34 fisyak 00034 // Merge StRootEvent and StEvent 00035 // 00036 // Revision 1.15 1999/06/22 18:09:02 kathy 00037 // change default input file 00038 // 00039 // Revision 1.14 1999/06/17 18:26:15 kathy 00040 // bfcread: change default input file; Example.. fix so works if you just execute it 00041 // 00042 // Revision 1.13 1999/06/07 17:31:23 kathy 00043 // clean up some macros 00044 // 00045 // Revision 1.12 1999/05/21 15:33:57 kathy 00046 // made sure Log & Id are in each file and also put in standard comment line with name of owner 00047 // 00048 // Revision 1.11 1999/05/20 18:43:21 kathy 00049 // removing unecessary macros 00050 // 00051 //====================================================================== 00052 // owner: Victor Perevoztchikov 00053 // what it does: reads output files from bfc and displays data in browser 00054 // - more info below 00055 //======================================================================= 00056 // bfcread.C 00057 // 00058 // Kathy's notes (9/13/99): 00059 // - example to show how to read in file (.dst.xdf, .dst.root, .*.root) 00060 // produced from bfc.C and: 00061 // - run another maker (St_QA_Maker) - commented out for now 00062 // - look at it using the browser 00063 // 00064 // This example is reading in the "dst" branch of the root file. 00065 // (i.e. the input file is .dst.root) 00066 // If you want to read in a different branch, you must change: 00067 // - the input file name, e.g. *.bname.root (or .dst.xdf) 00068 // - IOMk->SetBranch("bnameBranch",0,"r"); 00069 // - chain->GetDataSet("bname"); 00070 // 00071 // 00072 // This example is for debugging/testing purposes and therefore does 00073 // not have chain->Finish(); at end 00074 // 00075 //====================================================================== 00076 00077 class StChain; 00078 class TDataSet; 00079 00080 TDataSet *Event; 00081 StChain *chain; 00082 TBrowser *brow=0; 00083 00084 void bfcread( 00085 Int_t nevents=1, 00086 const char *MainFile= 00087 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root") 00088 { 00089 // 00090 gSystem->Load("St_base"); 00091 gSystem->Load("StChain"); 00092 00093 gSystem->Load("libglobal_Tables"); 00094 gSystem->Load("libgen_Tables"); 00095 gSystem->Load("libsim_Tables"); 00096 00097 gSystem->Load("StIOMaker"); 00098 00099 00100 // Setup top part of chain 00101 chain = new StChain("bfc"); 00102 chain->SetDebug(); 00103 00104 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree"); 00105 IOMk->SetDebug(); 00106 IOMk->SetIOMode("r"); 00107 IOMk->SetBranch("*",0,"0"); //deactivate all branches 00108 IOMk->SetBranch("dstBranch",0,"r"); //activate dst Branch 00109 00110 00111 // How to add other makers to chain (must also load library!) 00112 // St_QA_Maker *qa = new St_QA_Maker; 00113 00114 // --- now execute chain member functions 00115 chain->Init(); 00116 00117 // Event loop 00118 int istat=0,i=1; 00119 EventLoop: if (i <= nevents && !istat) { 00120 cout << "============================ Event " << i << " start" << endl; 00121 chain->Clear(); 00122 istat = chain->Make(i); 00123 cout << " istat value returned from chain Make = " << istat << endl; 00124 if (istat) {cout << "Last event processed. Status = " << istat << endl;} 00125 i++; goto EventLoop; 00126 } 00127 00128 00129 cout << " bfcread: passed event loop " << endl; 00130 00131 Event = chain->GetDataSet("dst"); 00132 if (Event) { 00133 Event->ls(9); 00134 brow = new TBrowser("BName","BTitle"); 00135 } 00136 00137 // Comment out for now because it clears data so you can't 00138 // look at data in browser! 00139 // Call finish routines: 00140 // chain->Finish(); 00141 00142 } 00143 00144 00145
1.5.9