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 class StIOMaker;
00051 StIOMaker *IOMk=0;
00052
00053
00054
00055 void bfcread_hist_integrated_to_ps(
00056 int nfiles=3,
00057 const Char_t *fileName="filelist",
00058 const Char_t *MakerHistDir="EventQA",
00059 const Char_t *TopDirTree="bfcTree",
00060 const Char_t *psFile="QA_hist.ps",
00061 const Char_t *PageTitle="",
00062 const Char_t *PrintList="",
00063 const Int_t ZoneH=2,
00064 const Int_t ZoneV=3
00065 )
00066 {
00067
00068 cout << "bfcread_hist_integrated_to_ps.C, input file list = "
00069 << fileName << endl;
00070 cout << "bfcread_hist_integrated_to_ps.C, directory name for hist = "
00071 << MakerHistDir << endl;
00072 cout << "bfcread_hist_integrated_to_ps.C, top level directory in hist file = "
00073 << TopDirTree << endl;
00074 cout << "bfcread_hist_integrated_to_ps.C, output ps file = "
00075 << psFile << endl;
00076 cout << "bfcread_hist_integrated_to_ps.C, page title for histograms = "
00077 << PageTitle << endl;
00078 cout << "bfcread_hist_integrated_to_ps.C, subset list name of which histograms to draw,print = "
00079 << PrintList << endl;
00080 cout << "bfcread_hist_integrated_to_ps.C, # histograms on page horizontally = "
00081 << ZoneH << endl;
00082 cout << "bfcread_hist_integrated_to_ps.C, # histograms on page vertically = "
00083 << ZoneV << endl;
00084
00085
00086 gSystem->Load("St_base");
00087 gSystem->Load("StChain");
00088 gSystem->Load("StIOMaker");
00089 gSystem->Load("StUtilities");
00090 gSystem->Load("StAnalysisUtilities");
00091 gSystem->Load("libglobal_Tables");
00092 gSystem->Load("libtpc_Tables");
00093 gSystem->Load("libStDb_Tables.so");
00094 gSystem->Load("StDetectorDbMaker");
00095 gSystem->Load("StTpcDb");
00096 gSystem->Load("StEvent");
00097 gSystem->Load("StPmdUtil");
00098 gSystem->Load("St_QA_Maker");
00099
00100
00101 char **fList = new char[8192][256];
00102 ifstream fin(fileName);
00103 if (fin) {
00104 int j=0;
00105 cout << "Input file " << fileName << " found." << endl;
00106 for (Int_t i=0;i<nfiles;i++){
00107 char *line = new char[256];
00108 fin >> line;
00109 if (fin.eof()) break;
00110 fList[j] = line;
00111 cout << " Added file : " << fList[j] << endl;
00112 j++;
00113 }
00114 }
00115 fin.close();
00116
00117
00118 StFile* fff = new StFile(fList);
00119 StIOMaker *IOMk = new StIOMaker("IO","r",fff,TopDirTree);
00120 IOMk->SetDebug();
00121 IOMk->SetIOMode("r");
00122 IOMk->SetBranch("*",0,"0");
00123 IOMk->SetBranch("histBranch",0,"r");
00124
00125
00126 TString HMname = MakerHistDir;
00127 HMname.Prepend("Summed");
00128 const char* MakerHistDirS = HMname.Data();
00129 StHistMaker *HM = new StHistMaker(MakerHistDirS);
00130
00131 StHistUtil *SHU[2];
00132 StHistUtil *HU;
00133 SHU[0] = new StHistUtil;
00134 SHU[1] = new StHistUtil;
00135 Bool_t firstSet[2];
00136 Int_t SHUidx, prefixNum, nPrefixes = SHU[0]->GetNumOfPosPrefixes();
00137
00138
00139
00140 for (SHUidx=0;SHUidx<2;SHUidx++) {
00141 HU = SHU[SHUidx];
00142 HU->SetPntrToMaker(IOMk);
00143 HU->IgnorePrefixes();
00144 HU->SetDefaultPrintList(MakerHistDir,PrintList);
00145 firstSet[SHUidx] = kTRUE;
00146 }
00147
00148
00149
00150 IOMk->Init();
00151 HM->Init();
00152
00153 Int_t istat=0;
00154 Int_t ifl=0;
00155
00156 while (ifl<nfiles && istat==0) {
00157
00158 cout << endl << "Now processing file : " << ifl+1 << endl << endl;
00159
00160
00161
00162 IOMk->Clear();
00163 istat = IOMk->Open();
00164 istat = IOMk->Make();
00165
00166
00167 if (!(IOMk->GetDataSet("hist"))) {
00168 cout << " No histogram branch found in file!" << endl;
00169 } else {
00170
00171 Int_t hCCount = 0;
00172
00173
00174 for (prefixNum=0; prefixNum < nPrefixes; prefixNum++) {
00175 SHUidx = (prefixNum>0 ? 1 : 0);
00176 HU = SHU[SHUidx];
00177
00178 TList* dirList = HU->FindHists(MakerHistDir,HU->GetPrefix(prefixNum));
00179 if (dirList && (dirList->GetSize())) {
00180
00181 if (firstSet[SHUidx]) {
00182 firstSet[SHUidx] = kFALSE;
00183
00184
00185 hCCount = HU->CopyHists(dirList);
00186 cout << "bfcread_hist_integrated_to_ps.C, # histograms copied with prefix " <<
00187 HU->GetPrefix(prefixNum) << " = " << hCCount << endl;
00188
00189 HM->SetHArraySize(HU->getNewHistSize());
00190 HM->SetHArray(HU->getNewHist());
00191 HM->Make();
00192 } else {
00193 hCCount = HU->AddHists(dirList);
00194 cout << "bfcread_hist_integrated_to_ps.C, # histograms added with prefix " <<
00195 HU->GetPrefix(prefixNum) << " = " << hCCount << endl;
00196 }
00197 delete dirList;
00198 }
00199
00200 }
00201
00202 }
00203
00204 ifl++;
00205 istat = IOMk->Close();
00206 }
00207
00208
00209
00210
00211
00212
00213 Int_t NoHist=0;
00214 NoHist = HU->ListHists(MakerHistDirS);
00215 cout << " in bfcread_hist_list: Num of Hist = " << NoHist << endl;
00216
00217
00218 gROOT->SetStyle("Plain");
00219
00220
00221 HU->SetHistsNamesDraw("*","*");
00222 HU->GetRunYear(fList[0]);
00223 HU->SetOutFile(psFile);
00224 HU->SetZones(ZoneH,ZoneV);
00225 HU->SetPaperSize();
00226 HU->SetDefaultLogXList(MakerHistDirS);
00227 HU->SetDefaultLogYList(MakerHistDirS);
00228 if (PageTitle=="") PageTitle=fileName;
00229 HU->SetGlobalTitle(PageTitle);
00230
00231
00232 Int_t numLog = 0;
00233 numLog = HU->ExamineLogYList();
00234 cout <<" bfcread_hist_integrated_to_ps.C, Number hist to plot with log scale = " << numLog << endl;
00235
00236 Int_t numPrint = 0;
00237 numPrint = HU->ExaminePrintList();
00238 cout << " bfcread_hist_integrated_to_ps.C, Number hist to print = " << numPrint << endl;
00239
00240
00241 HU->DrawHists(MakerHistDirS);
00242
00243 cout <<" bfcread_hist_integrated_to_ps.C, end of macro" << endl;
00244
00245 }
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257