00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class StChain;
00047 StChain *chain;
00048
00049 void bfcread_dstBranch(
00050 Int_t nevents=2,
00051 const char *MainFile=
00052 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root",
00053 const char *fname="qa_dst.out")
00054 {
00055
00056 cout << " events to process = " << nevents << endl;
00057 cout << " Input File Name = " << MainFile << endl;
00058 cout << " Output file containing printouts = " << fname << endl;
00059
00060 ofstream fout(fname);
00061
00062 fout << " Running: bfcread_dstBranch.C " << endl;
00063 fout << " events to process = " << nevents << endl;
00064 fout << " Input File Name = " << MainFile << endl;
00065 fout << " Output file containing printouts = " << fname << endl;
00066 fout << endl << endl;
00067
00068 gSystem->Load("St_base");
00069 gSystem->Load("StChain");
00070 gSystem->Load("libglobal_Tables");
00071 gSystem->Load("StIOMaker");
00072
00073
00074 chain = new StChain("bfc");
00075 chain->SetDebug();
00076
00077 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
00078 IOMk->SetDebug();
00079 IOMk->SetIOMode("r");
00080 IOMk->SetBranch("*",0,"0");
00081 IOMk->SetBranch("dstBranch",0,"r");
00082
00083
00084 chain->Init();
00085
00086 TTable *tabl=0;
00087
00088 TDataSet *obj=0;
00089 TDataSet *ddb=0;
00090 TDataSet *ddstBranch=0;
00091
00092 int istat=0;
00093 int iev=0;
00094
00095 Float_t countev=0.0;
00096
00097 Float_t countevdstB=0.0;
00098 Float_t countevdst=0.0;
00099 Float_t countevdstTab=0.0;
00100 Float_t countevdstRE=0.0;
00101 Float_t countevobjd=0.0;
00102 Float_t countevtabd=0.0;
00103 Float_t countevobjb=0.0;
00104 Float_t countevtabb=0.0;
00105
00106
00107 EventLoop: if (iev < nevents && !istat) {
00108
00109 Int_t Countevobjd=0;
00110 Int_t Countevtabd=0;
00111 Int_t Countevobjb=0;
00112 Int_t Countevtabb=0;
00113
00114 Int_t counthold=0;
00115 Int_t countre=0;
00116
00117 chain->Clear();
00118 istat = chain->Make(iev);
00119
00120
00121 iev++;
00122
00123 cout << " Call Make # " << iev << endl;
00124 cout << " istat value returned from chain Make = " << istat << endl;
00125
00126 if (!istat) {
00127
00128 countev++;
00129 cout << " start event # " << countev << endl;
00130 fout << " start event # " << countev << endl;
00131
00132 ddstBranch=chain->GetDataSet("dstBranch");
00133
00134 TDataSetIter dstbranchIter(ddstBranch);
00135
00136 if (ddstBranch) {
00137
00138 countevdstB++;
00139
00140 cout << endl << " QAInfo: in dstBranch " << endl;
00141 fout << endl << " QAInfo: in dstBranch " << endl;
00142
00143 while (ddb=dstbranchIter.Next()) {
00144
00145 cout << endl << " QAInfo: found object: " << ddb->GetName() << endl;
00146 fout << endl << " QAInfo: found object: " << ddb->GetName() << endl;
00147
00148 TString dsName = ddb->GetName();
00149
00150 if (dsName == "BfcStatus") {
00151 countevobjb++;
00152 Countevobjb++;
00153 }
00154 else {
00155 countevobjd++;
00156 Countevobjd++;
00157 }
00158
00159 if (ddb->InheritsFrom("TTable")) {
00160
00161 tabl = (TTable *)ddb;
00162 cout << " QAInfo: it's a table with #rows = "
00163 << tabl->GetNRows() << endl;
00164 fout << " QAInfo: it's a table with #rows = "
00165 << tabl->GetNRows() << endl;
00166
00167 if (dsName == "BfcStatus") {
00168 countevtabb++;
00169 Countevtabb++;
00170
00171 TDataSetIter bfcstatiter(ddb);
00172 St_dst_bfc_status *bfcstat =
00173 (St_dst_bfc_status *) bfcstatiter.Find("BfcStatus");
00174 dst_bfc_status_st *bth = bfcstat->GetTable();
00175
00176 Int_t ij = 0;
00177 for (ij=0; ij< bfcstat->GetNRows(); ij++)
00178 {
00179 cout << " QAInfo: BfcStatus table -- row " << ij <<
00180 ", Maker: " << bth[ij]->maker_name <<
00181 " has istat = " << bth[ij]->status << endl;
00182 fout << " QAInfo: BfcStatus table -- row " << ij <<
00183 ", Maker: " << bth[ij]->maker_name <<
00184 " has istat = " << bth[ij]->status << endl;
00185 }
00186 }
00187 else{
00188 countevtabd++;
00189 Countevtabd++;
00190 }
00191
00192 }
00193
00194
00195 if (dsName == "dst") {
00196
00197 countevdst++;
00198
00199 cout << " QAInfo: in dst object " << endl;
00200 fout << " QAInfo: in dst object " << endl;
00201
00202
00203
00204 TDataSetIter tabiter(ddb);
00205
00206
00207 while (obj = tabiter.Next()) {
00208
00209 cout << " QAInfo: found object: " << obj->GetName() << endl;
00210 fout << " QAInfo: found object: " << obj->GetName() << endl;
00211
00212 countevobjd++;
00213 Countevobjd++;
00214
00215 TString dstobjName = obj->GetName();
00216 if (dstobjName == "RunEvent") {
00217 countre=1;
00218 }
00219
00220
00221 if (obj->InheritsFrom("TTable")) {
00222 tabl = (TTable *)tabiter.Find(obj->GetName());
00223 if (tabl) {
00224 counthold=1;
00225 countevtabd++;
00226 Countevtabd++;
00227
00228 cout << " QAInfo: it's a table with #rows = "
00229 << tabl->GetNRows() << endl;
00230 fout << " QAInfo: it's a table with #rows = "
00231 << tabl->GetNRows() << endl;
00232
00233 }
00234 }
00235
00236
00237 }
00238
00239 }
00240
00241
00242 }
00243
00244 cout << endl << " QAInfo: ev# " << countev <<
00245 ", #dst obj/tab, #Bfc obj/tab found = " <<
00246 Countevobjd << " " <<
00247 Countevtabd << " " <<
00248 Countevobjb << " " <<
00249 Countevtabb << endl << endl;
00250
00251 fout << endl << " QAInfo: ev# " << countev <<
00252 ", #dst obj/tab, #Bfc obj/tab found = " <<
00253 Countevobjd << " " <<
00254 Countevtabd << " " <<
00255 Countevobjb << " " <<
00256 Countevtabb << endl << endl;
00257
00258
00259 }
00260
00261 if (counthold) countevdstTab++;
00262 if (countre) countevdstRE++;
00263
00264 }
00265
00266 else
00267 {
00268 cout << "Last event processed. Status = " << istat << endl;
00269 }
00270
00271 goto EventLoop;
00272
00273 }
00274
00275 countevobjd /= countev;
00276 countevtabd /= countev;
00277 countevobjb /= countev;
00278 countevtabb /= countev;
00279
00280 cout << endl;
00281 cout << " QAInfo: End of Job " << endl;
00282 cout << " QAInfo: # times Make called = " << iev << endl;
00283 cout << " QAInfo: # events read = " << countev << endl;
00284 cout << " QAInfo: # events with dstBranch dataset = " << countevdstB << endl;
00285 cout << " QAInfo: # events with dst dataset = " << countevdst << endl;
00286 cout << " QAInfo: # events with RunEvent object = " << countevdstRE << endl;
00287 cout << " QAInfo: # events with dst Tables = " << countevdstTab << endl;
00288 cout << " QAInfo: avg # dst tables per event = " << countevtabd << endl;
00289 cout << " QAInfo: avg # dst objects per event = " << countevobjd << endl;
00290 cout << " QAInfo: avg # Bfc tables per event = " << countevtabb << endl;
00291 cout << " QAInfo: avg # Bfc objects per event = " << countevobjb << endl << endl;
00292
00293 fout << endl;
00294 fout << " QAInfo: End of Job " << endl;
00295 fout << " QAInfo: # times Make called = " << iev << endl;
00296 fout << " QAInfo: # events read = " << countev << endl;
00297 fout << " QAInfo: # events with dstBranch dataset = " << countevdstB << endl;
00298 fout << " QAInfo: # events with dst dataset = " << countevdst << endl;
00299 fout << " QAInfo: # events with RunEvent object = " << countevdstRE << endl;
00300 fout << " QAInfo: # events with dst Tables = " << countevdstTab << endl;
00301 fout << " QAInfo: avg # dst tables per event = " << countevtabd << endl;
00302 fout << " QAInfo: avg # dst objects per event = " << countevobjd << endl;
00303 fout << " QAInfo: avg # Bfc tables per event = " << countevtabb << endl;
00304 fout << " QAInfo: avg # Bfc objects per event = " << countevobjb << endl << endl;
00305
00306 chain->Finish();
00307
00308 }
00309
00310