StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plFgtSSim.C
1 class TFile;
2 // FGT SlowSimu plots, check pages: 1,
3 TFile *fd=0;
4 plFgtSSim( int page=3,char *core="m1",int pl=0){ //1=gif, 2=ps, 3=both
5 
6  char *path="./";
7  //char *path="/star/data05/scratch/balewski/fgtEveGen/";
8  // core="Wprod_b";
9  core="QCDprod_c_Pt20";
10  core="pp200_QCDprodMBc";
11  TString fullInpName=path; fullInpName+=core;
12  fullInpName+=".fgt.hist.root";
13 
14  double seedThres=30; // for pages>100
15 
16  fd=new TFile(fullInpName);
17  if(! fd->IsOpen()) {
18  printf("EROR: input histo file not found, quit\n",fullInpName.Data());
19  return;
20  }
21  // fd->ls();
22  gStyle->SetPalette(1,0);
23 
24  char *nameA[]={"ss_inDE","ss_inDS","ss_inZ","ss_hitStat","ss_inXY","ss_cTof","ss_inR","ss_cPmag","ss_gXY1"};
25  char *nameB[]={"fr_pairEne","fr_nPrimPair", "fr_totEne","fr_nTotPair","fr_pathL","fr_avrTPath"};
26  char *nameC[]={"ss_hitStat","cl_Stat1D","ev_Stat1D"};
27 
28 
29  switch (page) {
30  case 1:{ // general stats from all disks
31  can=new TCanvas("aa","aa",800,500); TPad *c=makeTitle(can,core,page);
32  c->Divide(1,2);gStyle->SetOptStat(111111);
33  char **nameX=nameC;
34  for(int i=0;i<1;i++) { // tmp, w/o clust-finder
35  printf("->%s<\n",nameX[i]);
36  h=(TH1*)fd->Get(nameX[i]); assert(h);
37  c->cd(i+1); h->Draw();
38  }
39  break;
40  }//--------------------------------------
41 
42 
43 
44  case 2:{ // g2t track properties
45  can=new TCanvas("aa","aa",720,700); TPad *c=makeTitle(can,core,page);
46  c->Divide(3,3);
47  char **nameX=nameA;
48  int i;
49  for(i=0;i<9;i++) {
50  printf("->%s<\n",nameX[i]);
51  h=(TH1*)fd->Get(nameX[i]); assert(h);
52  c->cd(i+1); h->Draw();
53  if(i==4|| i==8) h->Draw("colz");
54  if(i==3 ||i==6) if(h->GetEntries()>0) c->GetPad(1+i)->SetLogz();
55  }
56  break;
57  }//--------------------------------------
58 
59  case 3: { // EVENT: 2D digitalization
60  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
61  c->Divide(2,1);
62  //c->cd(1);ss_inXY->Draw("colz"); //ss_inXY->Rebin2D();
63  c->cd(2);digXYAll->Draw("colz"); gPad->SetLogz(); //digXYAll->Rebin2D(4,4);
64 
65 
66  break;
67  }//--------------------------------------
68 
69  case 33: { // testing strip mapping
70  can=new TCanvas("aa","aa",600,600); TPad *c=makeTitle(can,core,page);
71  digXY->Draw("colz");
72  digXY->SetAxisRange(23,30,"y"); digXY->SetAxisRange(23,30,"x"); // zoom-in box 1
73  //digXY->SetAxisRange(37,38.5,"y"); digXY->SetAxisRange(0,5,"x"); // zoom-in box 2
74  //digXY->SetAxisRange(11,12.5,"y"); digXY->SetAxisRange(0,5,"x"); // zoom-in box 3
75 
76  // final plots P-plane - Rmid-zoom
77  //digXY->SetAxisRange(1,3,"y"); digXY->SetAxisRange(18,20,"x"); // zoom-in box 3
78  //digXY->SetAxisRange(1,3,"x"); digXY->SetAxisRange(18,20,"y"); // zoom-in box 3
79 
80  break;
81  }//--------------------------------------
82 
83  case 4: { // G-hits accepted per disc
84  can=new TCanvas("aa","aa",950,620); TPad *c=makeTitle(can,core,page);
85  gStyle->SetOptStat(1000010);
86  c->Divide(3,2);
87  for(int id=0; id<6;id++) {
88  c->cd(id+1);
89  h=(TH2*)fd->Get(Form("ss_gXY%d",id+1)); assert(h);
90  h->Draw("colz"); //h->Scale(2.5);
91  }
92  // c->cd(2); ss_gXY1->Draw("colz"); c->cd(5); ss_gXY6->Draw("colz"); // tmp change
93  //c->cd(2); ss_gXY0->Draw("colz"); c->cd(5); ss_gXY5->Draw("colz"); // tmp change
94  break;
95  }//--------------------------------------
96 
97 
98  case 5:{ // properties of Frank's hit distribution generator
99  gStyle->SetOptStat(110);
100  can=new TCanvas("aa","aa",800,500); TPad *c=makeTitle(can,core,page);
101  c->Divide(3,2);
102  char **nameX=nameB;
103  for(int i=0;i<6;i++) {
104  printf("->%s<\n",nameX[i]);
105  h=(TH1*)fd->Get(nameX[i]); assert(h);
106  c->cd(i+1); h->Draw();
107  if(i==5) { h->SetAxisRange(0,2);} //h->Fit("gaus");
108  }
109  break;
110  }//--------------------------------------
111 
112  case 6: { // projection on rad & phi strips
113  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
114  c->Divide(1,2);gStyle->SetOptStat(1001111);
115  c->cd(1);digRAll->Draw();
116  c->cd(2);digPAll->Draw();
117  break;
118  }//--------------------------------------
119 
120  case 7: { // ADC sums per plane
121  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
122  c->Divide(1,2);gStyle->SetOptStat(1001111);
123  c->cd(1);dg_Padc->Draw();
124  c->cd(2);dg_Radc->Draw();
125  break;
126  }//--------------------------------------
127 
128 
129 
130  case 107: { // R-cluster finder properties
131  can=new TCanvas("aa","aa",800,550); TPad *c=makeTitle(can,core,page);
132  c->Divide(3,2);gStyle->SetOptStat(111111);
133  c->cd(1);cl_RmxAmp->Draw();
134  cl_RmxAmp->Fit("landau","R","",seedThres,99999);
135  // c->cd(2);cl_rMul->Draw();
136  c->cd(2);cl_Rwid->Draw();
137  c->cd(4);cl_Rpf->Draw();
138  c->cd(5);//ev_errRad->Fit("gaus","R","",-80,80);//Draw();
139  ev_errRad->Rebin(3);
140  ev_errRad->Fit("gaus");
141  c->cd(6);ev_dRad_R->Draw("colz");
142  break;
143  }//--------------------------------------
144 
145 
146  case 108: { // Phi-cluster finder properties
147  can=new TCanvas("aa","aa",800,550); TPad *c=makeTitle(can,core,page);
148  c->Divide(3,2);gStyle->SetOptStat(111111);
149  c->cd(1);cl_PmxAmp->Draw();cl_PmxAmp->Fit("landau","R","",seedThres,99999);
150  // c->cd(2);cl_pMul->Draw();
151  c->cd(2);cl_Pwid->Draw();
152  c->cd(4);cl_Ppf->Draw(); // fr_Rdiff->Draw("colz");
153  c->cd(5);ev_RerrPhi->Fit("gaus","R","",-100,100);//->Draw();
154  c->cd(6);ev_RdPhi_R->Draw("colz");
155  break;
156  }//--------------------------------------
157 
158 
159  case 109: { // Rad vs. Phi-cluster finder properties
160  can=new TCanvas("aa","aa",500,280); TPad *c=makeTitle(can,core,page);
161  c->Divide(2,1);gStyle->SetOptStat(111111);
162  c->cd(1);cl_rpMul->Draw("colz");
163 
164  break;
165  }//--------------------------------------
166 
167 
168  case 110: { // Rad err vs. R
169  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
170  c->Divide(2,1);gStyle->SetOptStat(0);gStyle->SetOptFit(1);
171  int nReb=4;
172  c->cd(1);spreadFit(ev_dRad_R->RebinX(nReb,"dRreb"));
173  c->cd(2);spreadFit(ev_RdPhi_R->RebinX(nReb,"RdPreb"));
174  break;
175  }//--------------------------------------
176 
177 
178  case 101: { // tmp1
179  can=new TCanvas("aa","aa",1100,850); TPad *c=makeTitle(can,core,page);
180  c->Divide(3,2);gStyle->SetOptStat(111111);
181  c->cd(1);cl_rpMul->Draw("colz");
182  c->cd(4);ev_Stat1D->Draw(); ev_Stat1D->SetAxisRange(0,6);
183  float yy=ev_Stat1D->GetMaximum();
184  ev_Stat1D->SetMinimum(yy*.75);
185  c->cd(2);ev_errRad->Fit("gaus","R","",-200,200);//Draw();
186  c->cd(3);ev_dRad_R->Draw("colz");
187 
188  c->cd(5);ev_RerrPhi->Fit("gaus","R","",-60,60);//->Draw();
189  c->cd(6);ev_RdPhi_R->Draw("colz");
190 
191  break;
192  }//--------------------------------------
193 
194  case 102: { // tmp1
195  can=new TCanvas("aa","aa",500,280); TPad *c=makeTitle(can,core,page);
196  c->Divide(2,1);
197  c->cd(1);cl_RmxAmp->Fit("landau","R","",seedThres,99999);
198  c->cd(2);cl_PmxAmp->Fit("landau","R","",seedThres,99999);
199 
200  break;
201  }//--------------------------------------
202 
203  case 103: { // tmp1
204  can=new TCanvas("aa","aa",1100,400); TPad *c=makeTitle(can,core,page);
205  c->Divide(3,1);gStyle->SetOptStat(1111);
206  c->cd(1);ev_Stat1D->Draw(); ev_Stat1D->SetAxisRange(0,6);
207  float yy=ev_Stat1D->GetMaximum();
208  ev_Stat1D->SetMinimum(yy*.75);
209  c->cd(2);ev_errRad->Fit("gaus","R","",-200,200);//Draw();
210  c->cd(3);ev_RerrPhi->Fit("gaus","R","",-60,60);//->Draw();
211 
212  break;
213  }//--------------------------------------
214 
215  case 104: { // tmp1
216  can=new TCanvas("aa","aa",900,750); TPad *c=makeTitle(can,core,page);
217  c->Divide(3,2);gStyle->SetOptStat(1111);
218  c->cd(1);cl_RmxAmp->Fit("landau","R","",seedThres,99999);
219  c->cd(2);cl_Rpf->Draw();
220  c->cd(3);ev_errRad->Fit("gaus","R","",-200,200);
221 
222  c->cd(4);cl_PmxAmp->Fit("landau","R","",seedThres,99999);
223  c->cd(5);cl_Ppf->Draw();
224  c->cd(6);ev_RerrPhi->Fit("gaus","R","",-80,80);
225 
226  break;
227  }//--------------------------------------
228 
229  case 105: { // tmp1
230  can=new TCanvas("aa","aa",1100,800); TPad *c=makeTitle(can,core,page);
231  c->Divide(3,2);gStyle->SetOptStat(111111);
232  c->cd(4);ev_RokXY->Draw("colz"); // ev_RokXY->Rebin2D(2,2);
233 
234  c->cd(1);ev_Stat1D->Draw(); ev_Stat1D->SetAxisRange(0,6);
235  float yy=ev_Stat1D->GetMaximum();
236  ev_Stat1D->SetMinimum(yy*.75);
237 
238  int nReb=4;
239  c->cd(2);ev_RerrPhi->Fit("gaus","R","",-100,100);//->Draw();
240  // ev_RdPhi_R->RebinY(2);
241  c->cd(3);spreadFit(ev_RdPhi_R->RebinX(nReb,"RdPreb"),370);
242 
243  c->cd(5);ev_errRad->Fit("gaus","R","",-300,300);//Draw();
244  c->cd(6);spreadFit(ev_dRad_R->RebinX(nReb,"dRreb"),370);
245 
246  break;
247  }//--------------------------------------
248 
249 
250  default:
251  printf("page=%d NOT defined\n",page);
252 
253  }
254 
255  char text[100];
256  sprintf(text,"%s_page%03d",core,page);
257  TString tit=text;
258  can->SetTitle(tit);
259  can->SetName(tit);
260  // c->Clear();
261 
262  if(pl&1) can->Print(tit+".gif");
263  if(pl&2) can->Print(tit+".ps");
264 
265 }
266 
267 
268 //------------------------
269 TPad *makeTitle(TCanvas *c,char *core, int page) {
270 
271  c->Range(0,0,1,1);
272  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
273  pad0->Draw();
274  pad0->cd();
275 
276  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
277  pt->Draw();
278  TDatime dt;
279  TString txt2=core;
280  txt2+=", page=";
281  txt2+=page;
282  txt2+=", ";
283  txt2+=dt.AsString();
284  pt->AddText(txt2);
285  txt2="--";
286  pt->AddText(txt2);
287 
288  c->cd();
289  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
290  pad->Draw();
291  return pad;
292 }
293 
294 //============================
295 void doStat(char *name0, char *name3){
296  printf("->%s<\n",name0);
297  h0=(TH1*)fd->Get(name0); assert(h0);
298  int nEve=h0->GetEntries()/ h0->GetNbinsX();
299  printf("nEve=%d\n",nEve);
300 
301  h3=(TH1F*)fd->Get(name3); assert(h3);
302  int nb=h3->GetNbinsX();
303  int i,n=0,n1=0;
304  for(i=1; i<=nb;i++) {
305  float y=h3->GetBinContent(i);
306  if(y<=0) continue;
307  n++;
308  float r=y/nEve;
309  float er=sqrt(y)/nEve;
310  if(r>0.001){ printf("* "); n1++;}
311  else continue;
312  //intf(" ");
313 
314  printf(" HankCh=%d failProb=%.3f +/- %.3f\n", i-1,r,er);
315  }
316  printf("bigErr n1=%d n=%d\n",n1,n);
317 }
318 
319 //===================================
320 //==========================
321 //==========================
322 spreadFit( TH2* h2, double Ymx=370) {
323 
324  ln0=new TLine(0,0,450,0); ln0->SetLineColor(kBlack);ln0->SetLineWidth(2.);
325  ln0->SetLineStyle(2);
326  TString tt=h2->GetName();
327  h2->GetListOfFunctions()->Clear(); // drop strip contur
328  TString tt=h2->GetName();
329  h2->FitSlicesY();
330  TH1D*hd= (TH1D*)gROOT->FindObject(tt+"_1");
331  h2->SetAxisRange(-Ymx,Ymx,"y");
332 
333  hd->SetMarkerStyle(20);
334  h2->Draw("colz");
335  hd->Draw("same");
336 
337  //........ draw +/- 1 sig error band for projection
338  Stat_t er1[1000];
339  memset(er1,0,sizeof(er1));
340 
341  TH1D *he= (TH1D*)gROOT->FindObject(tt+"_2");
342  he->Fit("pol1","","same");
343 
344  TH1D *yu=(TH1D*) hd->Clone(); yu->SetLineColor(kMagenta);
345  yu->Add(he); yu->SetError(er1);yu->SetLineWidth(2.);
346  yu->Draw("same");
347 
348  TH1D *yd=(TH1D*) hd->Clone();
349  yd->Add(he,-1); yd->SetError(er1); yd->SetLineColor(kMagenta);
350  yd->Draw("same");yd->SetLineWidth(2.);
351  ln0->Draw();
352 
353 }
354 
355 
356 
357 plAll(char *core="d1") {
358  int i;
359  for(i=1; i<=4; i++) plFgtSS(i,core,2);
360  for(i=6; i<=7; i++) plFgtSS(i,core,2);
361  // for(i=101; i<=105; i++) plFgtSS(i,core,2); // Jan's cluster finder QA
362 }
363 
364 /*
365  .L plSS.C
366  plAll("minb_d1r");
367  plAll("minb_d6r");
368  plAll("mu2_d1r");
369  plAll("mu2_d6r");
370 cat minb_d1r*ps |ps2pdf - >minb_d1r.pdf
371 cat minb_d6r*ps |ps2pdf - >minb_d6r.pdf
372 cat mu2_d1r*ps |ps2pdf - >mu2_d1r.pdf
373 cat mu2_d6r*ps |ps2pdf - >mu2_d6r.pdf
374 
375 
376 */