StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drawEvent.C
1 //*-- Author : Valeri Fine (fine@bnl.gov)
2 // $Id: drawEvent.C,v 1.14 2010/03/16 16:23:09 fisyak Exp $
3 // $Log: drawEvent.C,v $
4 // Revision 1.14 2010/03/16 16:23:09 fisyak
5 // StTpcDb requires StDetectorDbMaker
6 //
7 // Revision 1.13 2006/08/15 21:42:45 jeromel
8 // Fix rhic -> rhic.bnl.gov
9 //
10 // Revision 1.12 2005/08/31 15:03:09 fisyak
11 // Add dependence StMagF vs StarMagField
12 //
13 // Revision 1.11 2001/09/21 02:21:57 jeromel
14 // StTpcDb needed by StEventMaker.
15 //
16 // Revision 1.10 2000/04/13 21:46:34 kathy
17 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
18 //
19 // Revision 1.9 2000/04/12 15:06:53 kathy
20 // 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
21 //
22 // Revision 1.8 2000/01/19 21:00:32 kathy
23 // update macros to use standard default xdf files in /afs/rhic.bnl.gov/star/data/samples
24 //
25 // Revision 1.7 2000/01/19 16:29:51 kathy
26 // update macros to use default input files in /afs/rhic.bnl.gov/star/data/samples
27 //
28 // Revision 1.6 1999/08/20 22:49:33 fine
29 // StChain::Finish() has been removed to keep the last picture on the screen
30 //
31 // Revision 1.5 1999/08/02 00:07:10 fine
32 // use the new edition of StVirtualFiltr class
33 //
34 // Revision 1.4 1999/07/15 13:58:39 perev
35 // cleanup
36 //
37 // Revision 1.3 1999/07/14 01:47:15 fine
38 // New macros derived from doEvent to show StEventDisplayMaker
39 //
40 // Revision 1.2 1999/07/13 00:57:57 fine
41 // replace the author\'s name
42 //
43 // Revision 1.1 1999/07/13 00:54:53 fine
44 // New macro based on doEvent but with 3D graphics
45 //
46 //=======================================================================
47 // owner: Valeri Fine (fine@bnl.gov)
48 // what it does:
49 //=======================================================================
51 //
52 // doEvents.C
53 //
54 // Description:
55 // Chain to read events from files or database into StEvent and create its' 3D view
56 //
57 // Environment:
58 // Software developed for the STAR Detector at Brookhaven National Laboratory
59 //
60 // Author List:
61 // Valeri Fine, BNL 7/99
62 //
63 // History:
64 //
66 
67 // Functions included below which retrieve a single file or all files
68 // under a path
69 
70 
71 // File-scope stuff needed by setFiles, nextFile. Someone ambitious
72 // can clean this up by putting it all into a nice clean class.
73 
74 Int_t usePath = 0;
75 Int_t nFile = 0;
76 TString thePath;
77 TString theFileName;
78 TString originalPath;
79 class StChain;
80 StChain *chain=0;
81 
82 class StEventDisplayMaker;
83 StEventDisplayMaker *disp=0;
84 
85 TBrowser *b=0;
86 const char *dstFile ="/disk00001/star/auau200/two_photon/starlight/twogam/year_1b/hadronic_on/tfs/ric0022_01_14552evts.dst.root";
87 const char *xdfFile ="/afs/rhic.bnl.gov/star/data/samples/gstar.dst.xdf";
88 const char *mdcFile ="/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/tss/psc0081_07_40evts.root";
89 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
90 
91  // const Char_t *file="/afs/rhic.bnl.gov/star/data/samples/psc0016_05_35evts.root")
92  // const Char_t *file="/disk00001/star/auau200/hijing135/jetq_on/b0_3/year_1b/hadronic_on/tfs/./set0022_01_56evts_dst.xdf")
93  // const Char_t *file="/afs/rhic.bnl.gov/star/strange/genevb/year1a_90evts_dst.xdf")
94  // const Char_t *file="/disk00000/star/auau200/hijing135/default/b0_20/year2x/hadronic_on/tfs_dst/pet213_02_190evts_h_dst.xdf")
95  // const Char_t *path="-/disk00000/star/auau200/hijing135/",
96 
97 // If you specify a path, all DST files below that path will be
98 // found, and 'nevents' events from each will be analyzed.
99 // The type of DST files searched for is taken from the 'file' parameter.
100 // If 'file ends in '.xdf', XDF DSTs are searched for.
101 // If 'file ends in '.root', ROOT DSTs are searched for.
102 //
103 // If path begins with '-', 'file' will be taken to be a single file
104 // to be processed.
105 //
106 // example invocation:
107 // .x doEvents.C(10,"-","/afs/rhic.bnl.gov/star/strange/genevb/year1a_90evts_dst.xdf")
108 //
109 // example ROOT file invocation:
110 // .x doEvents.C(10,"-","/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/gstardata/psc0033_01_40evts.root")
111 //
112 // example multi-ROOT file invocation:
113 // .x doEvents.C(9999,"/disk00001/star/auau200/hijing/b0_3/jet05/year_1b/hadronic_on/tfs/","*.root")
114 
115 
116 void doEventsQQ(const Int_t nevents=999,
117  const Char_t **fileList)
118 {
119 
120  // Dynamically link needed shared libs
121  gSystem->Load("St_base");
122  gSystem->Load("StChain");
123 
124  gSystem->Load("libgen_Tables");
125  gSystem->Load("libsim_Tables");
126  gSystem->Load("libglobal_Tables");
127 
128  gSystem->Load("StUtilities");
129  gSystem->Load("StIOMaker");
130  gSystem->Load("StarClassLibrary");
131  gSystem->Load("StarMagField");
132  gSystem->Load("StMagF");
133  gSystem->Load("StEvent");
134  gSystem->Load("StDetectorDbMaker");
135  gSystem->Load("StTpcDb");
136  gSystem->Load("StEventMaker");
137  gSystem->Load("St_geom_Maker");
138  gSystem->Load("StEventDisplayMaker");
139 
140 
141  // Handling depends on whether file is a ROOT file or XDF file
142 
143  chain = new StChain("StChain");
144 
145  StFile *setFiles= new StFile();
146 
147  for (int ifil=0; fileList[ifil]; ifil++)
148  { setFiles->AddFile(fileList[ifil]);}
149 
150  St_geom_Maker *geom = new St_geom_Maker; // this maker open its own TFile !!!
151  StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree");
152  IOMk->SetDebug();
153 
154 // Maker to read events from file or database into StEvent
155  StEventMaker *readerMaker = new StEventMaker ("events","title");
156 // Sample analysis maker
157 // StAnalysisMaker *analysisMaker = new StAnalysisMaker("analysis");
158  disp = new StEventDisplayMaker;
159  disp->SetDebug();
160  // Create an user's custom filter for "Tracks"
161  St_TLA_EventFilter *trackFilter = new St_TLA_EventFilter();
162  disp->SetFilter(trackFilter,StEventDisplayMaker::kTrack);
163 
164 
165  // Initialize chain
166  Int_t iInit = chain->Init();
167  if (iInit) chain->Fatal(iInit,"on init");
168  chain->PrintInfo();
169 // chain->MakeDoc();
170 
171  // Event loop
172  int istat;
173  for (Int_t i=1; i<=nevents; i++) {
174  cout << "============================ Event " << i << " start" << endl;
175  chain->Clear();
176  istat = chain->Make(i);
177  if (istat) {
178  cout << "Last event processed. Status = " << istat << endl;
179  chain->Clear();
180  break;
181  }
182  St_DataSet *set = chain->DataSet("dst");
183  if (set) {
184  St_DataSetIter dirt(set);
185  dirt.Du();
186  }
187  cout << "============================ Event " << i << " finish" << endl;
188  }
189 
190  gROOT->LoadMacro("PadControlPanel.C");
191 }
192 void drawEvent(const Int_t nevents=2,
193  const Char_t *path="-/disk00001/star/auau200/hijing135/jetq_on/b0_3/year_1b/hadronic_on/tfs/",
194  const Char_t *file="/afs/rhic.bnl.gov/star/data/samples/gstar.dst.xdf")
195 {
196  const char *fileListQQ[]={0,0};
197  if (path[0]=='-') {
198  fileListQQ[0]=file;
199  } else {
200  fileListQQ[0] = gSystem->ConcatFileName(path,file);
201  }
202  doEventsQQ(nevents,fileListQQ);
203 }
204 
205 
206 
207 
208 
209 
210 
211 
Definition: StTree.h:125
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Make()
Definition: StChain.cxx:110