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 class StChain;
00032 StChain *chain;
00033
00034 void bfcread_dst_geant_Branch(
00035 Int_t nevents=2,
00036 const char *MainFile=
00037 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root",
00038 const char *fname="qa_dst_geant.out")
00039 {
00040
00041
00042 cout << " events to process = " << nevents << endl;
00043 cout << " Input File Name = " << MainFile << endl;
00044 cout << " Output file containing printouts = " << fname << endl;
00045
00046 ofstream fout(fname);
00047
00048 fout << " Running: bfcread_dst_geant_Branch.C " << endl;
00049 fout << " events to process = " << nevents << endl;
00050 fout << " Input File Name = " << MainFile << endl;
00051 fout << " Output file containing printouts = " << fname << endl;
00052 fout << endl << endl;
00053
00054
00055 gSystem->Load("St_base");
00056 gSystem->Load("StChain");
00057
00058 gSystem->Load("libglobal_Tables");
00059 gSystem->Load("libgen_Tables");
00060 gSystem->Load("libsim_Tables");
00061
00062 gSystem->Load("StIOMaker");
00063
00064
00065 chain = new StChain("bfc");
00066 chain->SetDebug();
00067
00068 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
00069 IOMk->SetDebug();
00070 IOMk->SetIOMode("r");
00071 IOMk->SetBranch("*",0,"0");
00072 IOMk->SetBranch("dstBranch",0,"r");
00073 IOMk->SetBranch("geantBranch",0,"r");
00074
00075
00076 chain->Init();
00077
00078 TDataSet *ds=0;
00079 TTable *tabl=0;
00080 TDataSet *obj=0;
00081
00082 Float_t tottabcntrdst=0;
00083 Float_t tottabcntrgeant=0;
00084
00085 Float_t totobjcntrdst=0;
00086 Float_t totobjcntrgeant=0;
00087
00088 int istat=0;
00089 int i=0;
00090
00091 int countev=0;
00092
00093 int countevgds=0;
00094 int countevgobj=0;
00095 int countevgtab=0;
00096
00097 int countevdds=0;
00098 int countevdobj=0;
00099 int countevdtab=0;
00100
00101
00102 EventLoop: if (i < nevents && !istat) {
00103
00104 chain->Clear();
00105 istat = chain->Make(i);
00106
00107
00108 i++;
00109
00110
00111
00112
00113
00114
00115 int countObjDst=0;
00116 int countObjGeant=0;
00117 int countTableDst=0;
00118 int countTableGeant=0;
00119
00120 if (!istat) {
00121
00122 countev++;
00123
00124 cout << " start event # " << countev << endl;
00125
00126
00127
00128 ds=chain->GetDataSet("dst");
00129 TDataSetIter tabiter(ds);
00130 if (ds) {
00131 countevdds++;
00132
00133 while (obj = tabiter.Next()) {
00134 cout << " QAInfo: dst, found object: " << obj->GetName() << endl;
00135 fout << " QAInfo: dst, found object: " << obj->GetName() << endl;
00136
00137 countObjDst++;
00138 totobjcntrdst++;
00139
00140
00141 if (obj->InheritsFrom("TTable")) {
00142 tabl = (TTable *)tabiter.Find(obj->GetName());
00143 if (tabl) {
00144 countTableDst++;
00145 tottabcntrdst++;
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 }
00151 }
00152
00153
00154 }
00155 if (countObjDst) countevdobj++;
00156 if (countTableDst) countevdtab++;
00157 }
00158
00159
00160
00161
00162
00163
00164 ds=chain->GetDataSet("geant");
00165 TDataSetIter tabiter(ds);
00166 if (ds) {
00167 countevgds++;
00168
00169 while (obj = tabiter.Next()) {
00170 cout << " QAInfo: geant, found object: " << obj->GetName() << endl;
00171 fout << " QAInfo: geant, found object: " << obj->GetName() << endl;
00172
00173 countObjGeant++;
00174 totobjcntrgeant++;
00175
00176
00177 if (obj->InheritsFrom("TTable")) {
00178 tabl = (TTable *)tabiter.Find(obj->GetName());
00179 if (tabl) {
00180 countTableGeant++;
00181 tottabcntrgeant++;
00182 cout << " QAInfo: it's a table with #rows = "
00183 << tabl->GetNRows() << endl;
00184 fout << " QAInfo: it's a table with #rows = "
00185 << tabl->GetNRows() << endl;
00186 }
00187 }
00188
00189
00190 }
00191 if (countObjGeant) countevgobj++;
00192 if (countTableGeant) countevgtab++;
00193 }
00194
00195
00196
00197 cout << " QAInfo: event # " << countev <<
00198 ", DST Branch - # objects found = "
00199 << countObjDst << ", # tables found = "
00200 << countTableDst << endl;
00201 cout << " QAInfo: event # " << countev <<
00202 ", GEANT Branch - # objects found = "
00203 << countObjGeant << ", # tables found = "
00204 << countTableGeant << endl << endl;
00205
00206
00207 fout << " QAInfo: event # " << countev <<
00208 ", DST Branch - # objects found = "
00209 << countObjDst << ", # tables found = "
00210 << countTableDst << endl;
00211 fout << " QAInfo: event # " << countev <<
00212 ", GEANT Branch - # objects found = "
00213 << countObjGeant << ", # tables found = "
00214 << countTableGeant << endl << endl;
00215
00216 }
00217
00218 else
00219 {
00220 cout << "Last event processed. Status = " << istat << endl;
00221 }
00222
00223 goto EventLoop;
00224
00225 }
00226
00227 tottabcntrdst /= countev;
00228 totobjcntrdst /= countev;
00229 tottabcntrgeant /= countev;
00230 totobjcntrgeant /= countev;
00231
00232 cout << endl;
00233 cout << "QAInfo: End of Job " << endl;
00234 cout << "QAInfo: # times Make called = " << i << endl;
00235 cout << "QAInfo: # events read = " << countev << endl;
00236 cout << "QAInfo: # events with geant dataset = " << countevgds << endl;
00237 cout << "QAInfo: # with objects = " << countevgobj << endl;
00238 cout << "QAInfo: # with tables = " << countevgtab << endl;
00239 cout << "QAInfo: avg # tables per event = " << tottabcntrgeant << endl;
00240 cout << "QAInfo: avg # objects per event = " << totobjcntrgeant << endl
00241 << endl;
00242 cout << "QAInfo: # events with dst dataset = " << countevdds << endl;
00243 cout << "QAInfo: # with objects = " << countevdobj << endl;
00244 cout << "QAInfo: # with tables = " << countevdtab << endl;
00245 cout << "QAInfo: avg # tables per event = " << tottabcntrdst << endl;
00246 cout << "QAInfo: avg # objects per event = " << totobjcntrdst << endl
00247 << endl;
00248
00249 fout << endl;
00250 fout << "QAInfo: # times Make called = " << i << endl;
00251 fout << "QAInfo: # events read = " << countev << endl;
00252 fout << "QAInfo: # events with geant dataset = " << countevgds << endl;
00253 fout << "QAInfo: # with objects = " << countevgobj << endl;
00254 fout << "QAInfo: # with tables = " << countevgtab << endl;
00255 fout << "QAInfo: avg # tables per event = " << tottabcntrgeant << endl;
00256 fout << "QAInfo: avg # objects per event = " << totobjcntrgeant << endl
00257 << endl;
00258 fout << "QAInfo: # events with dst dataset = " << countevdds << endl;
00259 fout << "QAInfo: # with objects = " << countevdobj << endl;
00260 fout << "QAInfo: # with tables = " << countevdtab << endl;
00261 fout << "QAInfo: avg # tables per event = " << tottabcntrdst << endl;
00262 fout << "QAInfo: avg # objects per event = " << totobjcntrdst << endl
00263 << endl;
00264
00265
00266 chain->Finish();
00267 }
00268
00269
00270
00271
00272
00273