|
[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ repository ]
STAR Offline Software
Cross Reference
|
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // $Id: doEvents.C,v 1.49 2000/04/21 13:40:08 wenaus Exp $
4 //
5 // Description:
6 // Chain to read events from files or database into StEvent and analyze.
7 // what it does: reads .dst.root or .xdf files and then runs StEventMaker
8 // to fill StEvent and StAnalysisMaker to show example of analysis
9 //
10 // Environment:
11 // Software developed for the STAR Detector at Brookhaven National Laboratory
12 //
13 // Ways to run:
14 // If you specify a path, all DST files below that path will be
15 // found, and the first 'nevents' events in the file set will be
16 // analyzed.
17 // The type of DST files searched for is taken from the 'file' parameter.
18 // If 'file ends in '.dst.root', ROOT DSTs are searched for.
19 // If 'file ends in '.xdf', XDF DSTs are searched for.
20 //
21 // If path begins with '-', 'file' will be taken to be a single file
22 // to be processed.
23 //
24 // example invocation:
25 // .x doEvents.C(10,"-","some_directory/some_dst_file.xdf")
26 //
27 // example ROOT file invocation:
28 // .x doEvents.C(10,"-","some_directory/some_dst_file.root")
29 //
30 // example multi-ROOT file invocation:
31 // .x doEvents.C(9999,"some_directory","*.dst.root")
32 //
33 // Author List: Torre Wenaus, BNL 2/99
34 // Victor Perevoztchikov
35 //
36 ///////////////////////////////////////////////////////////////////////////////
37 //
38 // $Log: doEvents.C,v $
39 // Revision 1.49 2000/04/21 13:40:08 wenaus
40 // correct the doc for nevents in multifile mode
41 //
42 // Revision 1.48 2000/04/18 21:43:12 fine
43 // make TurnDisplay macro available for doEvents
44 //
45 // Revision 1.47 2000/04/13 22:14:03 perev
46 // StFile -> StFileI
47 //
48 // Revision 1.46 2000/04/13 21:46:34 kathy
49 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
50 //
51 // Revision 1.45 2000/04/12 17:33:45 kathy
52 // put loading of libtpc_Tables back in since Iwona is going back to original tpt_track table
53 //
54 // Revision 1.44 2000/04/12 15:29:05 kathy
55 // comment out libtpc by default
56 //
57 // Revision 1.43 2000/04/12 15:06:53 kathy
58 // 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
59 //
60 // Revision 1.42 2000/04/07 15:54:26 perev
61 // GC added
62 //
63 // Revision 1.41 2000/03/20 17:32:55 kathy
64 // setbranches in all macros so that they will work with softlinks - for StIOMaker
65 //
66 // Revision 1.40 2000/03/17 23:10:06 kathy
67 // make sure the dst branch is explicitly set in the macros using dst.root files as input - otherwise they don't work properly with soft links
68 //
69 // Revision 1.39 2000/01/11 18:20:20 ullrich
70 // Add latests improvements from Victor.
71 //
72 // Revision 1.38 2000/01/10 22:06:09 kathy
73 // add owner name and comments
74 //
75 // Revision 1.37 1999/11/17 14:34:00 ullrich
76 // Added version with no arguments which prints usage info.
77 //
78 // Revision 1.36 1999/11/17 14:23:40 ullrich
79 // Updated for new StEvent/StEventMaker.
80 //
81 // owner: Torre Wenaus,Victor Perevoztchikov
82 // what it does: reads .dst.root or .dst.xdf file or files, fills StEvent &
83 // then runs StAnalysisMaker
84 ///////////////////////////////////////////////////////////////////////////////
85 Int_t usePath = 0;
86 Int_t nFile = 0;
87 TString thePath;
88 TString theFileName;
89 TString originalPath;
90 class StChain;
91 StChain *chain=0;
92 class StEventDisplayMaker;
93 StEventDisplayMaker *dsMaker = 0;
94 TBrowser *b=0;
95
96 const char *dstFile = 0;
97 const char *xdfFile = 0;
98 const char *mdcFile = 0;
99 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
100
101 void doEvents()
102 {
103 cout << "Usage: doEvents.C(nevents,\"-\",\"some_directory/some_dst_file.xdf\")" << endl;
104 cout << " doEvents.C(nevents,\"-\",\"some_directory/some_dst_file.root\")" << endl;
105 cout << " doEvents.C(nevents,\"some_directory\",\"*.dst.root\")" << endl;
106 }
107 void doEvents(Int_t,const Char_t **,const char *qaflag = "");
108 void doEvents(Int_t nevents=999, const Char_t *path, const Char_t *file,
109 const char *qaflag = "off");
110
111
112 void doEvents(Int_t nevents, const Char_t **fileList, const char *qaflag)
113 {
114 //
115 // First load some shared libraries we need
116 //
117
118 gSystem->Load("St_base");
119 gSystem->Load("StChain");
120
121 gSystem->Load("libgen_Tables");
122 gSystem->Load("libsim_Tables");
123 gSystem->Load("libglobal_Tables");
124
125 gSystem->Load("StUtilities");
126 gSystem->Load("StIOMaker");
127 gSystem->Load("StarClassLibrary");
128 gSystem->Load("StEvent");
129 gSystem->Load("StMagF");
130 gSystem->Load("StEventMaker");
131 gSystem->Load("StAnalysisMaker");
132
133 //
134 // Handling depends on whether file is a ROOT file or XDF file
135 //
136 chain = new StChain("StChain");
137 StFileI *setFiles =0;
138 if (fileList) { //Normal case
139 setFiles= new StFile(fileList);
140 } else { //Grand Chalenge
141 gSystem->Load("StChallenger");
142 setFiles = StChallenger::Challenge();
143 setFiles->SetDebug();
144 Int_t Argc=4;
145 const char *Argv[4]= {
146 "-s","dst;hist;runco",
147 "-q","-5<=qxa_3<0.3 && 22>qxc_1>18"
148 };
149 setFiles->Init(Argc,Argv);
150 }
151 StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree");
152 IOMk->SetIOMode("r");
153 IOMk->SetBranch("*",0,""); //deactivate all branches
154 IOMk->SetBranch("dstBranch",0,"r");
155 IOMk->SetBranch("runcoBranch",0,"r");
156 IOMk->SetDebug();
157
158 //
159 // Maker to read events from file or database into StEvent
160 //
161 StEventMaker *readerMaker = new StEventMaker("events","title");
162
163
164 //
165 // Sample analysis maker
166 //
167 StAnalysisMaker *analysisMaker = new StAnalysisMaker("analysis");
168
169 //
170 // Initialize chain
171 //
172 Int_t iInit = chain->Init();
173 if (iInit) chain->Fatal(iInit,"on init");
174 chain->PrintInfo();
175
176 //
177 // Event loop
178 //
179 int istat=0,i=1;
180 EventLoop: if (i <= nevents && istat!=2) {
181 cout << "============================ Event " << i
182 << " start ============================" << endl;
183 chain->Clear();
184 istat = chain->Make(i);
185 if (istat==2) {cout << "Last event processed. Status = " << istat << endl;}
186 if (istat==3) {cout << "Error event processed. Status = " << istat << endl;}
187 i++;
188 goto EventLoop;
189 }
190
191 i--;
192 cout << "============================ Event " << i
193 << " finish ============================" << endl;
194 if (nevents > 1) {
195 chain->Clear();
196 chain->Finish();
197 }
198 else {
199 if (!b) {
200 b = new TBrowser;
201 }
202 }
203 }
204
205 void doEvents(const Int_t nevents, const Char_t *path, const Char_t *file,const char *qaflag)
206 {
207 const char *fileListQQ[]={0,0};
208 if (strncmp(path,"GC",2)==0) {
209 fileListQQ=0;
210 } else if (path[0]=='-') {
211 fileListQQ[0]=file;
212 } else {
213 fileListQQ[0] = gSystem->ConcatFileName(path,file);
214 }
215 doEvents(nevents,fileListQQ,qaflag);
216 }
217
218
219
220
221
222
223
224
225
|
[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ repository ]
|