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_prefixes_add_to_ps(
00056 const Char_t *MainFile=
00057 "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root",
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_prefixes_add_to_ps.C, input hist file = "
00069 << MainFile << endl;
00070 cout << "bfcread_hist_prefixes_add_to_ps.C, directory name for hist = "
00071 << MakerHistDir << endl;
00072 cout << "bfcread_hist_prefixes_add_to_ps.C, top level directory in hist file = "
00073 << TopDirTree << endl;
00074 cout << "bfcread_hist_prefixes_add_to_ps.C, output ps file = "
00075 << psFile << endl;
00076 cout << "bfcread_hist_prefixes_add_to_ps.C, page title for histograms = "
00077 << PageTitle << endl;
00078 cout << "bfcread_hist_prefixes_add_to_ps.C, subset list name of which histograms to draw,print = "
00079 << PrintList << endl;
00080 cout << "bfcread_hist_prefixes_add_to_ps.C, # histograms on page horizontally = "
00081 << ZoneH << endl;
00082 cout << "bfcread_hist_prefixes_add_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 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree);
00102 IOMk->SetDebug();
00103 IOMk->SetIOMode("r");
00104 IOMk->SetBranch("*",0,"0");
00105 IOMk->SetBranch("histBranch",0,"r");
00106
00107 TString HMname = MakerHistDir;
00108 HMname.Prepend("Summed");
00109 const char* MakerHistDirS = HMname.Data();
00110
00111
00112 StHistMaker *HM = new StHistMaker(MakerHistDirS);
00113
00114
00115
00116 StHistUtil *HO = new StHistUtil;
00117 StHistUtil *HU = new StHistUtil;
00118
00119
00120
00121 HO->SetPntrToMaker(IOMk);
00122 HU->SetPntrToMaker(IOMk);
00123 HO->IgnorePrefixes();
00124 HU->IgnorePrefixes();
00125
00126
00127
00128 IOMk->Init();
00129 IOMk->Clear();
00130 IOMk->Make();
00131 HM->Init();
00132
00133
00134 HO->SetDefaultPrintList(MakerHistDir,PrintList);
00135 TList* dirList = HO->FindHists(MakerHistDir,HO->GetPrefix(0));
00136 Int_t hCCount = 0;
00137
00138 int prefixNum;
00139 int nPrefixes = HO->GetNumOfPosPrefixes();
00140 Bool_t firstSet = kTRUE;
00141 for (prefixNum=0; prefixNum < nPrefixes; prefixNum++) {
00142
00143
00144 dirList = HO->FindHists(MakerHistDir,HO->GetPrefix(prefixNum));
00145 if (dirList->GetSize()) {
00146
00147 if (firstSet) {
00148 firstSet = kFALSE;
00149
00150
00151 hCCount = HO->CopyHists(dirList);
00152 cout << "bfcread_hist_prefixes_add_to_ps.C, # histograms copied with prefix " <<
00153 HO->GetPrefix(prefixNum) << " = " << hCCount << endl;
00154
00155 HM->SetHArraySize(HO->getNewHistSize());
00156 HM->SetHArray(HO->getNewHist());
00157 HM->Make();
00158 } else {
00159 hCCount = HO->AddHists(dirList);
00160 cout << "bfcread_hist_prefixes_add_to_ps.C, # histograms added with prefix " <<
00161 HO->GetPrefix(prefixNum) << " = " << hCCount << endl;
00162 }
00163 }
00164
00165 }
00166
00167
00168
00169
00170
00171
00172 Int_t NoHist=0;
00173 NoHist = HU->ListHists(MakerHistDirS);
00174 cout << " in bfcread_hist_list: Num of Hist = " << NoHist << endl;
00175
00176
00177 gROOT->SetStyle("Plain");
00178
00179
00180 HU->SetHistsNamesDraw("*","*");
00181 HU->GetRunYear(MainFile);
00182 HU->SetOutFile(psFile);
00183 HU->SetZones(ZoneH,ZoneV);
00184 HU->SetPaperSize();
00185 HU->SetDefaultLogXList(MakerHistDirS);
00186 HU->SetDefaultLogYList(MakerHistDirS);
00187 if (PageTitle=="") PageTitle=MainFile;
00188 HU->SetGlobalTitle(PageTitle);
00189
00190 HU->SetDefaultPrintList(MakerHistDirS,PrintList);
00191
00192 Int_t numLog = 0;
00193 numLog = HU->ExamineLogYList();
00194 cout <<" bfcread_hist_prefixes_add_to_ps.C, Number hist to plot with log scale = " << numLog << endl;
00195
00196 Int_t numPrint = 0;
00197 numPrint = HU->ExaminePrintList();
00198 cout << " bfcread_hist_prefixes_add_to_ps.C, Number hist to print = " << numPrint << endl;
00199
00200
00201 HU->DrawHists(MakerHistDirS);
00202
00203 cout <<" bfcread_hist_prefixes_add_to_ps.C, end of macro" << endl;
00204
00205 }
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217