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
00047 class StChain;
00048 StChain *chain;
00049
00050 void bfcread_eventBranch(
00051 Int_t nevents=2,
00052 const char *MainFile=
00053 "/afs/rhic.bnl.gov/star/data/samples/gstar.event.root",
00054 const char *fname="qa_event.out")
00055 {
00056
00057 cout << " events to process = " << nevents << endl;
00058 cout << " Input File Name = " << MainFile << endl;
00059 cout << " Output file containing printouts = " << fname << endl;
00060
00061 ofstream fout(fname);
00062
00063 fout << " Running: bfcread_eventBranch.C " << endl;
00064 fout << " events to process = " << nevents << endl;
00065 fout << " Input File Name = " << MainFile << endl;
00066 fout << " Output file containing printouts = " << fname << endl;
00067 fout << endl << endl;
00068
00069 gSystem->Load("St_base");
00070 gSystem->Load("StChain");
00071 gSystem->Load("libglobal_Tables");
00072 gSystem->Load("StUtilities");
00073 gSystem->Load("StIOMaker");
00074 gSystem->Load("StarClassLibrary");
00075 gSystem->Load("StBichsel");
00076 gSystem->Load("StEvent");
00077
00078 gSystem->Load("StAnalysisMaker");
00079
00080
00081
00082 chain = new StChain("AChain");
00083 chain->SetDebug();
00084
00085 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
00086 IOMk->SetDebug();
00087 IOMk->SetIOMode("r");
00088 IOMk->SetBranch("*",0,"0");
00089 IOMk->SetBranch("eventBranch",0,"r");
00090
00091
00092
00093 StAnalysisMaker *analysisMaker = new StAnalysisMaker("analysis");
00094
00095
00096 chain->Init();
00097
00098 TTable *tabl=0;
00099 TDataSet *deventBranch=0;
00100 TDataSet *dde=0;
00101
00102 int countev=0;
00103 int countevB=0;
00104 int countevBfc=0;
00105 int countevSt=0;
00106
00107 Float_t countevobj=0.0;
00108 Float_t countevtab=0.0;
00109
00110 int istat=0;
00111 int ijk=1;
00112
00113 EventLoop: if (ijk <= nevents && istat!=2) {
00114
00115 Int_t Countevobj=0;
00116 Int_t Countevtab=0;
00117
00118 cout << endl << "============================ Event " << ijk
00119 << " start ============================" << endl;
00120
00121 fout << endl << "============================ Event " << ijk
00122 << " start ============================" << endl;
00123
00124 chain->Clear();
00125 istat = chain->Make(ijk);
00126
00127 if (!istat) {
00128 countev++;
00129 deventBranch=chain->GetDataSet("eventBranch");
00130 TDataSetIter eventBIter(deventBranch);
00131
00132 if (deventBranch) {
00133 countevB++;
00134 cout << endl << " QAInfo: in eventBranch " << endl;
00135 fout << endl << " QAInfo: in eventBranch " << endl;
00136
00137 while (dde=eventBIter.Next()) {
00138 countevobj++;
00139 Countevobj++;
00140
00141 cout << " QAInfo: found object: " << dde->GetName() << endl;
00142 fout << " QAInfo: found object: " << dde->GetName() << endl;
00143
00144 if (dde->InheritsFrom("TTable")) {
00145 tabl = (TTable *)dde;
00146 cout << " QAInfo: it's a table with #rows = "
00147 << tabl->GetNRows() << endl;
00148 fout << " QAInfo: it's a table with #rows = "
00149 << tabl->GetNRows() << endl;
00150 countevtab++;
00151 Countevtab++;
00152 }
00153
00154 TString deName = dde->GetName();
00155 if (deName == "BfcStatus") {
00156 countevBfc++;
00157
00158 TDataSetIter bfcstatiter(dde);
00159 St_dst_bfc_status *bfcstat =
00160 (St_dst_bfc_status *) bfcstatiter.Find("BfcStatus");
00161 dst_bfc_status_st *bth = bfcstat->GetTable();
00162
00163 Int_t ij = 0;
00164 for (ij=0; ij< bfcstat->GetNRows(); ij++)
00165 {
00166 cout <<
00167 " QAInfo: BfcStatus table -- row " << ij <<
00168 ", Maker: " << bth[ij]->maker_name <<
00169 " has istat = " << bth[ij]->status << endl;
00170 fout <<
00171 " QAInfo: BfcStatus table -- row " << ij <<
00172 ", Maker: " << bth[ij]->maker_name <<
00173 " has istat = " << bth[ij]->status << endl;
00174 }
00175 }
00176 elseif (deName == "StEvent") {
00177 countevSt++;
00178 }
00179 }
00180 }
00181
00182 cout << endl << " QAInfo: ev# " << countev <<
00183 ", # objects/tables found in eventBranch = " <<
00184 Countevobj << " " <<
00185 Countevtab << endl << endl;
00186
00187 fout << endl << " QAInfo: ev# " << countev <<
00188 ", # objects/tables found in eventBranch = " <<
00189 Countevobj << " " <<
00190 Countevtab << endl << endl;
00191
00192 }
00193
00194 elseif (istat==2)
00195 {cout << "Last event processed. Status = " << istat << endl;}
00196
00197 elseif (istat==3)
00198 {cout << "Error event processed. Status = " << istat << endl;}
00199
00200 ijk++;
00201
00202 goto EventLoop;
00203 }
00204
00205 countevobj /= countev;
00206 countevtab /= countev;
00207
00208 cout << endl;
00209 cout << " QAInfo: End of Job " << endl;
00210 cout << " QAInfo: # times Make called = " << ijk << endl;
00211 cout << " QAInfo: # events read = " << countev << endl;
00212 cout << " QAInfo: #ev with eventBranch dataset = " << countevB << endl;
00213 cout << " QAInfo: #ev with StEvent dataset = " << countevSt << endl;
00214 cout << " QAInfo: #ev with BfcStatus table = " << countevBfc << endl;
00215 cout << " QAInfo: avg # tables per event = " << countevtab << endl;
00216 cout << " QAInfo: avg # objects per event = " << countevobj << endl << endl;
00217
00218 fout << endl;
00219 fout << " QAInfo: End of Job " << endl;
00220 fout << " QAInfo: # times Make called = " << ijk << endl;
00221 fout << " QAInfo: # events read = " << countev << endl;
00222 fout << " QAInfo: #ev with eventBranch dataset = " << countevB << endl;
00223 fout << " QAInfo: #ev with StEvent dataset = " << countevSt << endl;
00224 fout << " QAInfo: #ev with BfcStatus table = " << countevBfc << endl;
00225 fout << " QAInfo: avg # tables per event = " << countevtab << endl;
00226 fout << " QAInfo: avg # objects per event = " << countevobj << endl << endl;
00227
00228 chain->Finish();
00229
00230 }
00231
00232
00233
00234
00235
00236