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
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 class StChain;
00058 StChain *chain;
00059
00060 void bfcread_runcoBranch(
00061 Int_t nevents=1,
00062 const char *MainFile=
00063 "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root",
00064 const char *fname="qa_runco.out")
00065 {
00066
00067 if (nevents != 1){
00068 cout << " there is only 1 event in this branch!! " << endl;
00069 }
00070 nevents=1;
00071
00072 cout << " events to process = " << nevents << endl;
00073 cout << " Input File Name = " << MainFile << endl;
00074 cout << " Output file containing printouts = " << fname << endl;
00075
00076 ofstream fout(fname);
00077
00078 fout << " Running: bfcread_runcoBranch.C " << endl;
00079 fout << " events to process = " << nevents << endl;
00080 fout << " Input File Name = " << MainFile << endl;
00081 fout << " Output file containing printouts = " << fname << endl;
00082 fout << endl << endl;
00083
00084 gSystem->Load("St_base");
00085 gSystem->Load("StChain");
00086 gSystem->Load("libglobal_Tables");
00087 gSystem->Load("StIOMaker");
00088
00089
00090 chain = new StChain("bfc");
00091 chain->SetDebug();
00092
00093 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
00094 IOMk->SetDebug();
00095 IOMk->SetIOMode("r");
00096 IOMk->SetBranch("*",0,"0");
00097 IOMk->SetBranch("runcoBranch",0,"r");
00098
00099
00100 chain->Init();
00101
00102 TDataSet *ds=0;
00103 TTable *tabl=0;
00104 TDataSet *obj=0;
00105
00106
00107 int istat=0;
00108 int i=0;
00109 int countev=0;
00110 int countevrds=0;
00111
00112
00113 EventLoop: if (i < nevents && !istat) {
00114
00115 chain->Clear();
00116 istat = chain->Make(i);
00117
00118
00119 i++;
00120
00121
00122 int countObj=0;
00123 int countObjInDir=0;
00124 int countTable=0;
00125
00126 if (!istat) {
00127
00128 countev++;
00129
00130 cout << " start event # " << countev << endl;
00131
00132 ds=chain->GetDataSet("runco");
00133 TDataSetIter tabiter(ds);
00134 if (ds) {
00135 countevrds++;
00136
00137 while (obj = tabiter.Next()) {
00138 cout << " QAInfo: found object: " << obj->GetName() << endl;
00139 fout << " QAInfo: found object: " << obj->GetName() << endl;
00140
00141 countObj++;
00142
00143
00144
00145 TDataSet *objindir=0;
00146 TDataSetIter objindiriter(obj);
00147 while(objindir = objindiriter.Next()) {
00148 cout << " QAInfo: has sub-object = " << objindir->GetName() << endl;
00149 fout << " QAInfo: has sub-object = " << objindir->GetName() << endl;
00150 countObjInDir++;
00151
00152
00153 if (objindir->InheritsFrom("TTable")) {
00154 tabl = (TTable *)objindiriter.Find(objindir->GetName());
00155 if (tabl) {
00156 countTable++;
00157 cout << " QAInfo: it's a table with #rows = "
00158 << objindir->GetName() << ", " << tabl->GetNRows() << endl;
00159 fout << " QAInfo: it's a table with #rows = "
00160 << objindir->GetName() << ", " << tabl->GetNRows() << endl;
00161
00162 }
00163 }
00164 }
00165 }
00166 }
00167
00168 cout << " QAInfo: event # " << countev
00169 << ", # directories found = " << countObj
00170 << ", # sub-objects found = " << countObjInDir
00171 << ", # tables found = " << countTable
00172 << endl << endl;
00173
00174 fout << " QAInfo: event # " << countev
00175 << ", # directories found = " << countObj
00176 << ", # sub-objects found = " << countObjInDir
00177 << ", # tables found = " << countTable
00178 << endl << endl;
00179
00180 }
00181
00182 else
00183 {
00184 cout << "Last event processed. Status = " << istat << endl;
00185 }
00186
00187
00188 goto EventLoop;
00189 }
00190
00191
00192
00193 cout << endl;
00194 cout << "QAInfo: End of Job " << endl;
00195 cout << "QAInfo: # times Make called = " << i << endl;
00196 cout << "QAInfo: # events read = " << countev << endl;
00197 cout << "QAInfo: # events with runco dataset = " << countevrds << endl;
00198
00199 fout << endl;
00200 fout << "QAInfo: End of Job " << endl;
00201 fout << "QAInfo: # times Make called = " << i << endl;
00202 fout << "QAInfo: # events read = " << countev << endl;
00203 fout << "QAInfo: # events with runco dataset = " << countevrds << endl;
00204
00205 chain->Finish();
00206 }
00207
00208
00209