28 int sizeOfCharPtr =
sizeof(Char_t*);
38 void create_ftpc_QA_refhists(
39 const Char_t *MainFile=
40 "/star/xtp/jcs/st_physics_7075188_raw_1030004.hist.root"
44 cout <<
"create_ftpc_refhists.C, input hist file = "
48 gSystem->Load(
"St_base");
49 gSystem->Load(
"StChain");
50 gSystem->Load(
"StIOMaker");
51 gSystem->Load(
"StarClassLibrary");
52 gSystem->Load(
"libglobal_Tables");
53 gSystem->Load(
"StUtilities");
54 gSystem->Load(
"StAnalysisUtilities");
64 IOMk->SetBranch(
"*",0,
"0");
65 IOMk->SetBranch(
"histBranch",0,
"r");
68 gROOT->SetStyle(
"Plain");
69 TCanvas *canvas =
new TCanvas(
"CanvasName",
" STAR Maker Histogram Canvas",1);
70 gStyle->SetOptStat(111111);
71 gStyle->SetStatStyle(0);
72 gStyle->SetOptDate(0);
87 istat = chain->
Make(i);
90 cout<<
"sizeOfCharPtr = "<<sizeOfCharPtr<<endl;
91 Char_t* sdefList[] = {
96 "StEHTQaPointXYFtpcE",
97 "StEHTQaPointXYFtpcW",
98 "StEHTQaPointPadTimeFtpcW",
99 "StEHTQaPointPadTimeFtpcE",
100 "StEHTQaPointPlaneF",
109 "StEHTQaGtrkImpactrF",
110 "StEHTQaPtrkMeanPtF",
111 "StEHTQaPtrkMeanEtaF",
114 "StEHTQaVtxFtpcETpcXY",
115 "StEHTQaVtxFtpcETpcZ",
116 "StEHTQaVtxFtpcWTpcZ",
117 "StEHTQaVtxFtpcWTpcXY"
119 Int_t lengofList =
sizeof(sdefList)/sizeOfCharPtr;
120 cout<<
"sdefList[0] = "<<sdefList[0]<<endl;
121 cout<<
"sizeof(sdefList) = "<<
sizeof(sdefList)<<
" sizeOfCharPtr = "<<sizeOfCharPtr<<
" lengofList = "<<lengofList<<endl;
131 cout <<
" start event # " << countev << endl;
133 ds=chain->GetDataSet(
"hist");
144 while (histContainer = (
St_ObjectSet *)nextHistList()) {
145 dirList = (TList *) histContainer->
GetObject();
147 cout <<
" QAInfo: found directory: " <<
148 histContainer->GetName() << endl;
152 if (strcmp((Char_t *)histContainer->GetName(),
"EventQAHist") == 0) {
153 cout <<
"QAInfo: Process histograms in directory EventQAHist" <<endl;
159 TIter nextHist(dirList);
161 TH1* hobjradialW = NULL;
162 TH1* hobjradialE = NULL;
164 while (o= nextHist()) {
170 for (ilg=0;ilg<lengofList;ilg++) {
171 if (strcmp(sdefList[ilg],o->GetName()) == 0) {
173 cout <<
" QAInfo: Hist name: " << o->GetName() <<
174 " ==> Title: " << o->GetTitle() << endl;
175 if ( (strcmp(
"fcl_chargestepW",o->GetName()) == 0)
176 || (strcmp(
"fcl_chargestepE",o->GetName()) == 0)
177 || (strcmp(
"StEHTQaGtrkEtaF",o->GetName()) == 0)
178 || (strcmp(
"StEHTQaGtrkPtF",o->GetName()) == 0)
179 ||(strcmp(
"StEHTQaGtrkPF",o->GetName()) == 0)
180 ) canvas->SetLogy(1);
182 if ( (strcmp(
"StEHTQaPointXYFtpcE",o->GetName()) == 0)
183 || (strcmp(
"StEHTQaPointXYFtpcW",o->GetName()) == 0)
184 || (strcmp(
"StEHTQaPointPadTimeFtpcE",o->GetName()) == 0)
185 || (strcmp(
"StEHTQaPointPadTimeFtpcW",o->GetName()) == 0)
186 || (strcmp(
"StEHTQaGtrkGoodF",o->GetName()) == 0)
187 || (strcmp(
"StEHTQaGtrkXfYfFW",o->GetName()) == 0)
188 || (strcmp(
"StEHTQaGtrkXfYfFE",o->GetName()) == 0)
189 || (strcmp(
"StEHTQaVtxFtpcETpcXY",o->GetName()) == 0)
190 || (strcmp(
"StEHTQaVtxFtpcWTpcXY",o->GetName()) == 0)) {
192 if (strcmp(
"StEHTQaGtrkGoodF",o->GetName()) == 0
193 && o->InheritsFrom(
"TH1")) {
194 TH1* hobj = (TH1*) o;
196 Float_t mean1 = hobj->GetMean(1);
197 Float_t mean2 = hobj->GetMean(2);
198 Float_t window1 = hobj->GetRMS(1);
199 Float_t window2 = hobj->GetRMS(2);
200 Float_t bwid = hobj->GetBinWidth(1);
201 if (window1 < bwid) window1 = bwid;
202 if (window2 < bwid) window2 = bwid;
203 Float_t lo = TMath::Min(mean1-5*window1,mean2-5*window2);
204 Float_t hi = TMath::Max(mean1+5*window1,mean2+5*window2);
205 hobj->SetAxisRange(lo,hi,
"X");
206 hobj->SetAxisRange(lo,hi,
"Y");
207 TLine ruler;ruler.SetLineColor(46);
208 ruler.DrawLineNDC(0.1,0.1,0.9,0.9);
212 if (strcmp(
"StEHTQaPointFtpc",o->GetName()) == 0
213 && o->InheritsFrom(
"TH1")) {
214 TH1* hobj = (TH1*) o;
215 Float_t mean = hobj->GetMean(1);
216 Float_t window = hobj->GetRMS(1);
217 Float_t bwid = hobj->GetBinWidth(1);
218 if (window < bwid) window = bwid;
219 hobj->SetAxisRange(mean-5*window,mean+5*window,
"X");
223 sprintf(filename,
"%s.gif",o->GetName());
224 canvas->Print(filename);
227 if ((strcmp(
"fcl_radialW",o->GetName()) == 0)) hobjradialW = (TH1*) o;
228 if ((strcmp(
"fcl_radialE",o->GetName()) == 0)) hobjradialE = (TH1*) o;
230 if (hobjradialW && hobjradialE) {
231 hobjradialW->SetStats(kFALSE);
232 hobjradialW->GetXaxis()->SetRangeUser(7.0,9.0);
233 hobjradialE->SetStats(kFALSE);
234 hobjradialE->GetXaxis()->SetRangeUser(7.0,9.0);
235 if ( hobjradialW->GetMaximum() >= hobjradialE->GetMaximum()) {
237 hobjradialW->SetTitle(
"FTPCW+E cluster radial position");
238 hobjradialE->SetTitle(hobjradialW->GetTitle());
240 hobjradialE->Draw(
"Same");
242 TLine ruler; ruler.SetLineColor(kBlack);
243 ruler.SetLineWidth(2);
244 ruler.DrawLine(7.8,0.,7.8,hobjradialW->GetMaximum());
245 sprintf(filename,
"%s.gif",hobjradialW->GetName());
247 hobjradialE->SetTitle((TString)
"FTPCE+W cluster radial position");
248 hobjradialW->SetTitle(hobjradialE->GetTitle());
251 hobjradialW->Draw(
"Same");
252 TLine ruler; ruler.SetLineColor(kBlack);
253 ruler.SetLineWidth(2);
254 ruler.DrawLine(7.8,0.,7.8,hobjradialE->GetMaximum());
255 sprintf(filename,
"%s.gif",hobjradialE->GetName());
259 TLegend *legend =
new TLegend(0.75,0.85,0.98,0.95);
260 legend->SetFillColor(0);
261 legend->SetHeader(
"Legend");
262 legend->SetMargin(0.25);
263 legend->AddEntry(hobjradialE,
"FtpcEast",
"l");
264 legend->AddEntry(hobjradialW,
"FtpcWest",
"l");
266 canvas->Print(filename);
275 cout <<
" QAInfo: event # " << countev
276 <<
", # directories found = " << countObj
277 <<
", # hist found = " << countHist
284 cout <<
"Last event processed. Status = " << istat << endl;
287 cout <<
" create_ftpc_refhists.C, end of macro" << endl;
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
virtual void Clear(Option_t *option="")
User defined functions.
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)