00001 //*-- Author : Valeri Fine (fine@bnl.gov) 00002 // $Id: drawEvent.C,v 1.14 2010/03/16 16:23:09 fisyak Exp $ 00003 // $Log: drawEvent.C,v $ 00004 // Revision 1.14 2010/03/16 16:23:09 fisyak 00005 // StTpcDb requires StDetectorDbMaker 00006 // 00007 // Revision 1.13 2006/08/15 21:42:45 jeromel 00008 // Fix rhic -> rhic.bnl.gov 00009 // 00010 // Revision 1.12 2005/08/31 15:03:09 fisyak 00011 // Add dependence StMagF vs StarMagField 00012 // 00013 // Revision 1.11 2001/09/21 02:21:57 jeromel 00014 // StTpcDb needed by StEventMaker. 00015 // 00016 // Revision 1.10 2000/04/13 21:46:34 kathy 00017 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global 00018 // 00019 // Revision 1.9 2000/04/12 15:06:53 kathy 00020 // 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 00021 // 00022 // Revision 1.8 2000/01/19 21:00:32 kathy 00023 // update macros to use standard default xdf files in /afs/rhic.bnl.gov/star/data/samples 00024 // 00025 // Revision 1.7 2000/01/19 16:29:51 kathy 00026 // update macros to use default input files in /afs/rhic.bnl.gov/star/data/samples 00027 // 00028 // Revision 1.6 1999/08/20 22:49:33 fine 00029 // StChain::Finish() has been removed to keep the last picture on the screen 00030 // 00031 // Revision 1.5 1999/08/02 00:07:10 fine 00032 // use the new edition of StVirtualFiltr class 00033 // 00034 // Revision 1.4 1999/07/15 13:58:39 perev 00035 // cleanup 00036 // 00037 // Revision 1.3 1999/07/14 01:47:15 fine 00038 // New macros derived from doEvent to show StEventDisplayMaker 00039 // 00040 // Revision 1.2 1999/07/13 00:57:57 fine 00041 // replace the author\'s name 00042 // 00043 // Revision 1.1 1999/07/13 00:54:53 fine 00044 // New macro based on doEvent but with 3D graphics 00045 // 00046 //======================================================================= 00047 // owner: Valeri Fine (fine@bnl.gov) 00048 // what it does: 00049 //======================================================================= 00051 // 00052 // doEvents.C 00053 // 00054 // Description: 00055 // Chain to read events from files or database into StEvent and create its' 3D view 00056 // 00057 // Environment: 00058 // Software developed for the STAR Detector at Brookhaven National Laboratory 00059 // 00060 // Author List: 00061 // Valeri Fine, BNL 7/99 00062 // 00063 // History: 00064 // 00066 00067 // Functions included below which retrieve a single file or all files 00068 // under a path 00069 00070 00071 // File-scope stuff needed by setFiles, nextFile. Someone ambitious 00072 // can clean this up by putting it all into a nice clean class. 00073 00074 Int_t usePath = 0; 00075 Int_t nFile = 0; 00076 TString thePath; 00077 TString theFileName; 00078 TString originalPath; 00079 class StChain; 00080 StChain *chain=0; 00081 00082 class StEventDisplayMaker; 00083 StEventDisplayMaker *disp=0; 00084 00085 TBrowser *b=0; 00086 const char *dstFile ="/disk00001/star/auau200/two_photon/starlight/twogam/year_1b/hadronic_on/tfs/ric0022_01_14552evts.dst.root"; 00087 const char *xdfFile ="/afs/rhic.bnl.gov/star/data/samples/gstar.dst.xdf"; 00088 const char *mdcFile ="/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/tss/psc0081_07_40evts.root"; 00089 const char *fileList[] = {dstFile,xdfFile,mdcFile,0}; 00090 00091 // const Char_t *file="/afs/rhic.bnl.gov/star/data/samples/psc0016_05_35evts.root") 00092 // const Char_t *file="/disk00001/star/auau200/hijing135/jetq_on/b0_3/year_1b/hadronic_on/tfs/./set0022_01_56evts_dst.xdf") 00093 // const Char_t *file="/afs/rhic.bnl.gov/star/strange/genevb/year1a_90evts_dst.xdf") 00094 // const Char_t *file="/disk00000/star/auau200/hijing135/default/b0_20/year2x/hadronic_on/tfs_dst/pet213_02_190evts_h_dst.xdf") 00095 // const Char_t *path="-/disk00000/star/auau200/hijing135/", 00096 00097 // If you specify a path, all DST files below that path will be 00098 // found, and 'nevents' events from each will be analyzed. 00099 // The type of DST files searched for is taken from the 'file' parameter. 00100 // If 'file ends in '.xdf', XDF DSTs are searched for. 00101 // If 'file ends in '.root', ROOT DSTs are searched for. 00102 // 00103 // If path begins with '-', 'file' will be taken to be a single file 00104 // to be processed. 00105 // 00106 // example invocation: 00107 // .x doEvents.C(10,"-","/afs/rhic.bnl.gov/star/strange/genevb/year1a_90evts_dst.xdf") 00108 // 00109 // example ROOT file invocation: 00110 // .x doEvents.C(10,"-","/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/gstardata/psc0033_01_40evts.root") 00111 // 00112 // example multi-ROOT file invocation: 00113 // .x doEvents.C(9999,"/disk00001/star/auau200/hijing/b0_3/jet05/year_1b/hadronic_on/tfs/","*.root") 00114 00115 00116 void doEventsQQ(const Int_t nevents=999, 00117 const Char_t **fileList) 00118 { 00119 00120 // Dynamically link needed shared libs 00121 gSystem->Load("St_base"); 00122 gSystem->Load("StChain"); 00123 00124 gSystem->Load("libgen_Tables"); 00125 gSystem->Load("libsim_Tables"); 00126 gSystem->Load("libglobal_Tables"); 00127 00128 gSystem->Load("StUtilities"); 00129 gSystem->Load("StIOMaker"); 00130 gSystem->Load("StarClassLibrary"); 00131 gSystem->Load("StarMagField"); 00132 gSystem->Load("StMagF"); 00133 gSystem->Load("StEvent"); 00134 gSystem->Load("StDetectorDbMaker"); 00135 gSystem->Load("StTpcDb"); 00136 gSystem->Load("StEventMaker"); 00137 gSystem->Load("St_geom_Maker"); 00138 gSystem->Load("StEventDisplayMaker"); 00139 00140 00141 // Handling depends on whether file is a ROOT file or XDF file 00142 00143 chain = new StChain("StChain"); 00144 00145 StFile *setFiles= new StFile(); 00146 00147 for (int ifil=0; fileList[ifil]; ifil++) 00148 { setFiles->AddFile(fileList[ifil]);} 00149 00150 St_geom_Maker *geom = new St_geom_Maker; // this maker open its own TFile !!! 00151 StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree"); 00152 IOMk->SetDebug(); 00153 00154 // Maker to read events from file or database into StEvent 00155 StEventMaker *readerMaker = new StEventMaker ("events","title"); 00156 // Sample analysis maker 00157 // StAnalysisMaker *analysisMaker = new StAnalysisMaker("analysis"); 00158 disp = new StEventDisplayMaker; 00159 disp->SetDebug(); 00160 // Create an user's custom filter for "Tracks" 00161 St_TLA_EventFilter *trackFilter = new St_TLA_EventFilter(); 00162 disp->SetFilter(trackFilter,StEventDisplayMaker::kTrack); 00163 00164 00165 // Initialize chain 00166 Int_t iInit = chain->Init(); 00167 if (iInit) chain->Fatal(iInit,"on init"); 00168 chain->PrintInfo(); 00169 // chain->MakeDoc(); 00170 00171 // Event loop 00172 int istat; 00173 for (Int_t i=1; i<=nevents; i++) { 00174 cout << "============================ Event " << i << " start" << endl; 00175 chain->Clear(); 00176 istat = chain->Make(i); 00177 if (istat) { 00178 cout << "Last event processed. Status = " << istat << endl; 00179 chain->Clear(); 00180 break; 00181 } 00182 St_DataSet *set = chain->DataSet("dst"); 00183 if (set) { 00184 St_DataSetIter dirt(set); 00185 dirt.Du(); 00186 } 00187 cout << "============================ Event " << i << " finish" << endl; 00188 } 00189 00190 gROOT->LoadMacro("PadControlPanel.C"); 00191 } 00192 void drawEvent(const Int_t nevents=2, 00193 const Char_t *path="-/disk00001/star/auau200/hijing135/jetq_on/b0_3/year_1b/hadronic_on/tfs/", 00194 const Char_t *file="/afs/rhic.bnl.gov/star/data/samples/gstar.dst.xdf") 00195 { 00196 const char *fileListQQ[]={0,0}; 00197 if (path[0]=='-') { 00198 fileListQQ[0]=file; 00199 } else { 00200 fileListQQ[0] = gSystem->ConcatFileName(path,file); 00201 } 00202 doEventsQQ(nevents,fileListQQ); 00203 } 00204 00205 00206 00207 00208 00209 00210 00211
1.5.9