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 class StChain;
00040 StChain *chain;
00041
00042
00043 void OnlineQaTpcRaw(
00044 Int_t nevents=2,
00045 const char *MainFile=
00046 "/afs/rhic.bnl.gov/star/data/samples/june_2000_st_physics_1164058_raw_0001.daq",
00047 Int_t nevHistOut=0)
00048 {
00049
00050 cout << " OnlineQaTpcRaw.C: #events to process = " << nevents << endl;
00051 cout << " OnlineQaTpcRaw.C: input file name = " << MainFile << endl;
00052 cout << " OnlineQaTpcRaw.C: #events to write to hist file (0=all) = " <<
00053 nevHistOut << endl;
00054
00055
00056
00057 fInFile = new TString(MainFile);
00058 fFileOut = new TString(gSystem->BaseName(fInFile->Data()));
00059 fFileOut->ReplaceAll(".daq","");
00060 const char *histoDir = "./";
00061 fFileOut->Prepend(histoDir);
00062 const Char_t *outHistFile= fFileOut->Data();
00063
00064
00065
00066 const Char_t *topTree="OnlQaTpcTree";
00067 const Char_t *makerName="RawTpcQa";
00068
00069
00070 cout << " OnlineQaTpcRaw.C: output hist file name set to " <<
00071 outHistFile << ".hist.root" << endl;
00072 cout << " OnlineQaTpcRaw.C: top level Tree directory set to " <<
00073 topTree << endl;
00074 cout << " OnlineQaTpcRaw.C: maker name set to " <<
00075 makerName << endl;
00076
00077
00078 gSystem->Load("St_base");
00079 gSystem->Load("StChain");
00080 gSystem->Load("StIOMaker");
00081 gSystem->Load("StTreeMaker");
00082
00083
00084 gSystem->Load("StUtilities");
00085 gSystem->Load("StAnalysisUtilities");
00086
00087
00088 gSystem->Load("StRawTpcQaMaker");
00089
00090
00091
00092 chain = new StChain("OnlineQaTpcRawChain");
00093
00094
00095
00096 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,topTree);
00097
00098 IOMk->SetIOMode("r");
00099
00100
00101 StHistUtil *HU = new StHistUtil;
00102
00103
00104
00105 HU->SetPntrToMaker((StMaker *)IOMk);
00106
00107
00108 StRawTpcQaMaker *RTQa = new StRawTpcQaMaker(makerName);
00109
00110
00111 StTreeMaker* treeMk = new StTreeMaker("tree",outHistFile,topTree);
00112 treeMk->SetIOMode("w");
00113 treeMk->SetBranch("histBranch");
00114
00115
00116
00117 chain->Init();
00118
00119
00120
00121
00122 Int_t NoHist=0;
00123 NoHist = HU->ListHists(makerName);
00124 cout << " !!! OnlineQaTpcRaw.C, No. of Hist Booked = " << NoHist << endl;
00125
00126 int istat=0;
00127 int iev=0;
00128 int countev=0;
00129
00130
00131 EventLoop: if (iev < nevents && !istat) {
00132
00133 chain->Clear();
00134 istat = chain->Make(iev);
00135
00136
00137 iev++;
00138
00139 cout << " Called Make # " << iev << endl;
00140 cout << " istat value returned from chain Make = " << istat <<
00141
00142 endl;
00143
00144 if (!istat) {
00145
00146 countev++;
00147
00148 cout << " processed event # " << countev << endl;
00149
00150 }
00151
00152 else
00153 {
00154 cout << "Last event processed. Status = " << istat << endl;
00155 }
00156
00157 goto EventLoop;
00158
00159 }
00160
00161 cout << endl;
00162 cout << "QAInfo: End of Job " << endl;
00163 cout << "QAInfo: # times Make called = " << iev << endl;
00164 cout << "QAInfo: # events read = " << countev << endl;
00165
00166 chain->Finish();
00167
00168 }