StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plWana.C
1 TCanvas *can=0;
2 const float PI=2*acos(0);
3 TString spinPre='A';
4 /* to fix/change colors of lines embedded in histos do:
5 root [5] TLine* ln = (TLine*)muWET->GetListOfFunctions()->At(0)
6 root [6] ln->SetLineColor(kRed)
7 root [7] muWET->Draw()
8 */
9 
10 //=================================================
11 plWana( int page=13,int pl=0, char *core0="R10096140", char *iPath="", char *oPath=""){ //1=gif, 2=ps, 3=both
12  //iPath="./";
13  //iPath="/star/data05/scratch/stevens4/wAnalysis";
14  //iPath="/star/data05/scratch/balewski/2009-Wana-SL09g-march15-PRL/data/";
15  iPath="/star/data05/scratch/balewski/2009-Wana-SL10j-aW/data/";
16  //core0="R10090018";
17  //core0="run9setABCD";
18  core0="sum";
19  //core0="mcSetD1_ppWprod";
20  //core0="mcSetD2_ppQCD10_inf_filter_tot";
21  // core0="mcSetD1_ppZprod";
22 
23  if(page==0) {
24  doAll();
25  return;
26  }
27  if(page==-1) {
28  doAllMC();
29  return;
30  }
31 
32 /*
33 cat mcSetD1*W*ps | ps2pdf - ~/WWW/tmp/all-W.pdf
34 */
35 
36 
37  char *nameA[]={"muStatEve","muStatTrk","muStatBtow"}; //pg 1
38  char *nameB[]={"muVRf","muZv","muNV","mubX48"};//pg 2
39  char *nameC[]={"mubX7","mubX7v"};//pg 3
40  char *nameD[]={"muDsm1","muDsm2","muDsm3","muDsm4"};//pg 4
41  char *nameE[]={"muTrNfit","muTrFitFrac","muTrch2","muTrRxyIn","muTrRxyOut","muTrch2b"};//pg 5
42  char *nameF[]={"muTr2D1","muTrPt1","muTrPt1N","muTrPt1Pr","muTrPt1NPr"};//pg 6
43  char *nameG[]={"muBmaxAdc","muBtotAdc","muBclAdcPt","muBclET"};//pg 7
44  char *nameH[]={"muBclET24","muBclE242D","muBclET24R"};//pg 8
45 
46  char *nameJ[]={"muBdist1","muBdist2","muBdist3","muBdist4"};//pg 9
47  char *nameK[]={"muBjetETR","muTjetBjet2D","muTBjetET"};//pg 10
48  char *nameL[]={"muBjetET","muBclEjetE2D","muTjetET"};//pg 11
49  char *nameM[]={"muTwayET","muBwayET","muBclETPt","muEwayET"};//pg 12
50 
51  char *nameW[]={"muTotwayET2D","musPtBalance_clust","muWET","muW2D1"};//pg 13
52  char *namePB[]={"musPtBalance_clust", "musPtBalance_awayTot","muWeta"};// pg 14 -Pt-Balance plots
53  char *nameB1[]={"muSEadc1","muSPadc1"}; // pg 15 BSMD spectra
54  char *nameN[]={"muTrdEdX","muWdedx"}; //pg 16
55  char *nameO[]={"muWglDca","muWglDcaSP","muWglDcaSN"}; // pg 17
56 
57  char *nameP[]={"muETlive0","muETlive1", "muETlive2","muETlive3","muWcar1","muWcar2","muWcar3"}; // pg 18
58 
59  char *nameQ[]={"pubJoe1","pubJoe2","pubJoe3","pubJoe4","pubJoe5","pubJoe6","pubJoe7","pubJoe8"};// pg 19
60 
61  char *nameR1[]={"pubStatEve","pubCrR","pubWET","pubchEtaCP","pubchEtaCN"};// pg 20
62  char *nameR2[]={"pubchRecPNg","pubchRecPNp"};// pg 21
63  char *nameR3[]={"pubchWETPg" ,"pubchWETPp","pubchCFP0" ,"pubchWETNp","pubchWETNg" ,"pubchCFN0"};// pg 22
64 
65  char *nameS1[]={"spinStatEve","spins4mon","spinbX48","spinbX7","spinbX48c","spinbX7c"};// pg 23
66  char *nameS5[]={"spinET_P","spinET_N","spinQpT","spinQpT2"};// pg 24
67  char *nameS2[]={"spinY0","spinY1","spinY2_P","spinY2_N"};// pg 25
68  char *nameS3[]={,"spinY3_P","spinY3_N","spinY4_P","spinY4_N"};// pg 26
69  char *nameS4[]={"spinY5_P","spinY5_N","spinLepEta"};// pg 27
70 
71  //use Page 30 -42 TPC sectors per cut, 2 pages per cut
72 
73  gStyle->SetOptFit(1);
74  TString fullInpName=iPath; fullInpName+=core0;
75  fullInpName+=".wana.hist.root";
76  fd=new TFile(fullInpName);
77  if(! fd->IsOpen()) {
78  printf("EROR: input histo file not found, quit\n",fullInpName.Data());
79  return;
80  } else {
81  printf("Opened: %s\n",fullInpName.Data());
82  }
83  if(page==1){
84  fd->ls();
85  h0=(TH1*)fd->Get("muStatEve"); assert(h0);
86  printf("%s: ",h0->GetName());
87  for(int k=1;k<=10;k++) printf("%.0f, ",h0->GetBinContent(k));
88  printf("\n");
89  }
90  if(page>=23 && page<=25 && fd->Get("AspinStatEve")==0) return; // skip spin plots if maker was not used
91 
92  gStyle->SetPalette(1,0);
93  gStyle->SetOptStat(0);
94  char padTit[1000];
95  sprintf(padTit,"%s",core0);
96 
97  switch (page) {
98 
99  case 1:{
100  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
101  c->Divide(1,2);gStyle->SetOptStat(0);
102  char **nameX=nameA;
103  for(int i=0;i<2;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==0) h->Draw("h text");
108  }
109  c->GetPad(1)->SetLogy();
110  c->GetPad(2)->SetLogy();
111  } break;//--------------------------------------
112 
113  case 2:{
114  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
115  c->Divide(2,2);gStyle->SetOptStat(1110);
116  char **nameX=nameB;
117  for(int i=0;i<4;i++) {
118  printf("->%s<\n",nameX[i]);
119  h=(TH1*)fd->Get(nameX[i]); assert(h);
120  c->cd(i+1); h->Draw();
121  if(i==1) h->Fit("gaus","","hR",-50,50);
122  }
123  c->GetPad(1)->SetLogy();
124  c->GetPad(3)->SetLogy();
125  } break;//--------------------------------------
126 
127 
128  case 3:{ // efficiency vs. bXing, only for data
129  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
130  c->Divide(1,2);gStyle->SetOptStat(10);
131  char **nameX=nameC;
132  TH1F *hA[2];
133  c->cd(1);
134  for(int i=0;i<2;i++) {
135  printf("->%s<\n",nameX[i]);
136  hA[i]=(TH1F*)fd->Get(nameX[i]); assert(hA[i]);
137  if(i==0) hA[i]->Draw();
138  else hA[i]->Draw("same");
139 
140  }
141  // c->GetPad(1)->SetLogy();
142 
143  hA[0]->SetFillColor(0);
144 
145  TH1 *hEf=(TH1F*) hA[1]->Clone();
146  hEf->SetTitle("Vertex effi vs. bXing");
147  hEf->SetName("muVefbx");
148  hEf->SetFillColor(0); hEf->SetLineColor(kMagenta);
149  hEf->Divide(hA[0]);
150  c->cd(2);
151  hEf->Draw(); hEf->SetMaximum(1.1);
152  hEf->Fit("pol0","","Rh",50,100);
153 
154  } break;//--------------------------------------
155 
156  case 4:{
157  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
158  c->Divide(2,2);gStyle->SetOptStat(1001111);
159  char **nameX=nameD;
160  for(int i=0;i<4;i++) {
161  printf("->%s<\n",nameX[i]);
162  h=(TH1*)fd->Get(nameX[i]); assert(h);
163  c->cd(i+1); h->Draw();
164  if(i==3) {
165  h->SetFillColor(kBlue);
166  c->cd(3);
167  h->Draw("same");
168  }
169  }
170  c->GetPad(1)->SetLogy();
171  c->GetPad(2)->SetLogy();
172  c->GetPad(3)->SetLogy();
173  } break;//--------------------------------------
174 
175  case 5:{ sprintf(padTit,"Track selection cuts, %s",core0);
176  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
177  c->Divide(3,2);gStyle->SetOptStat(110);
178  char **nameX=nameE;
179  for(int i=0;i<6;i++) {
180  printf("->%s<\n",nameX[i]);
181  h=(TH1*)fd->Get(nameX[i]); assert(h);
182  c->cd(i+1); h->Draw();
183  if(i==5) h->Draw("colz");
184  }
185  //c->GetPad(1)->SetLogy();
186  } break;//--------------------------------------
187 
188 
189 
190 
191  case 6:{ sprintf(padTit,"Selected high PT tracks, %s",core0);
192  can=new TCanvas("aa","aa",800,600); TPad *c0=makeTitle(can,padTit,page);
193  TPad *cL,*cR; splitPadX(0.4,&cL,&cR);
194  cR->cd();
195  cR->Divide(2,2);gStyle->SetOptStat(10);
196  char **nameX=nameF;
197  TH1F *h1,*h2;
198  for(int i=0;i<5;i++) {
199  printf("->%s<\n",nameX[i]);
200  h=(TH1*)fd->Get(nameX[i]); assert(h);
201  if(i==0) { cL->cd();
202  h->Draw("colz");
203  for( float eta=-0.8; eta<.6; eta+=1.4) // print sectors IDs
204  for(float x=-PI-.1; x<PI; x+=PI/6) {
205  int sec=tpcSec(x, eta);;
206  char txt[100];
207  sprintf(txt,"sec %d",sec);
208  tx=new TText(eta,x,txt); tx->Draw();
209  }
210  }
211 
212  if(i==1 || i==3) {cR->cd(1+i/2); h1=h; h->Draw(); h->SetMinimum(.1);}
213  if(i==4) h->SetFillColor(9);
214  if(i==2 || i==4) { h2=h; h->Draw("same"); cR->cd(2+i/2);
215  h=(TH1F*) h2->Clone(); h->SetTitle("Ratio Negtive/all");h->Divide(h1); h->Draw();
216  h->SetMinimum(0.2); h->SetMaximum(0.7);
217  }
218  if(i>0) h->SetAxisRange(0,50);
219  }
220  cR->GetPad(1)->SetLogy();
221  cR->GetPad(2)->SetLogy();
222  } break;//--------------------------------------
223 
224  case 7:{ sprintf(padTit,"BTOW response, %s",core0);
225  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
226  c->Divide(2,2);gStyle->SetOptStat(1000110);
227  char **nameX=nameG;
228  for(int i=0;i<4;i++) {
229  printf("->%s<\n",nameX[i]);
230  h=(TH1*)fd->Get(nameX[i]); assert(h);
231  c->cd(i+1); h->Draw();
232  if(i==2 ) h->Draw("colz");
233  if(i==2) h->SetMaximum(0.6* h->GetMaximum());
234  }
235  c->GetPad(1)->SetLogy();
236  c->GetPad(2)->SetLogy();
237  c->GetPad(3)->SetLogz();
238  c->GetPad(4)->SetLogy();
239  } break;//--------------------------------------
240 
241  case 8:{ sprintf(padTit,"2x2 / 4x4 cluster isolation cut, %s",core0);
242  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
243  c->Divide(2,2);gStyle->SetOptStat(10);
244  char **nameX=nameH;
245  for(int i=0;i<3;i++) {
246  printf("->%s<\n",nameX[i]);
247  h=(TH1*)fd->Get(nameX[i]); assert(h);
248  c->cd(i+1); h->Draw();
249  if(i==1 ) h->Draw("colz");
250  }
251  c->GetPad(1)->SetLogy();
252  c->GetPad(2)->SetLogz();
253  } break;//--------------------------------------
254 
255  case 9:{ sprintf(padTit,"3D distance between track & cluster, %s",core0);
256  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
257  c->Divide(2,2);gStyle->SetOptStat(10);
258  char **nameX=nameJ;
259  for(int i=0;i<4;i++) {
260  printf("->%s<\n",nameX[i]);
261  h=(TH1*)fd->Get(nameX[i]); assert(h);
262  c->cd(i+1);
263  if(i==3) h->Draw();
264  else h->Draw("colz");
265  }
266  } break;//--------------------------------------
267 
268  case 10:{ sprintf(padTit,"separted near jet in BOW & TPC, %s",core0);
269  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
270  c->Divide(2,2);gStyle->SetOptStat(10);
271  char **nameX=nameL;
272  for(int i=0;i<3;i++) {
273  printf("->%s<\n",nameX[i]);
274  h=(TH1*)fd->Get(nameX[i]); assert(h);
275  c->cd(i+1); h->Draw();
276  if(i==1 ) h->Draw("colz");
277  }
278  c->GetPad(1)->SetLogy();
279  c->GetPad(2)->SetLogz();
280  c->GetPad(3)->SetLogy();
281  } break;//--------------------------------------
282 
283 
284  case 11:{ sprintf(padTit,"TPC+BTOW near jet ET, %s",core0);
285  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
286  c->Divide(2,2);gStyle->SetOptStat(10);
287  char **nameX=nameK;
288  for(int i=0;i<3;i++) {
289  printf("->%s<\n",nameX[i]);
290  h=(TH1*)fd->Get(nameX[i]); assert(h);
291  c->cd(i+1); h->Draw();
292  if(i==1 ) h->Draw("colz");
293  }
294 
295  c->GetPad(2)->SetLogz();
296 
297  } break;//--------------------------------------
298 
299  case 12:{ sprintf(padTit,"away ET veto, %s",core0);
300  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
301  c->Divide(2,2);gStyle->SetOptStat(10);
302  char **nameX=nameM;
303  for(int i=0;i<4;i++) {
304  printf("->%s<\n",nameX[i]);
305  h=(TH1*)fd->Get(nameX[i]); assert(h);
306  c->cd(i+1); h->Draw();
307  if(i==2) h->SetAxisRange(0,60);
308  if(i==2 ){
309  h->Draw("colz");
310  }
311  }
312  c->GetPad(1)->SetLogy();
313  c->GetPad(2)->SetLogy();
314  c->GetPad(4)->SetLogy();
315 
316  } break;//--------------------------------------
317 
318 
319  case 13:{ sprintf(padTit,"best W selection, %s",core0);
320  can=new TCanvas("aa","aa",900,800); TPad *c=makeTitle(can,padTit,page);
321  c->Divide(2,2);gStyle->SetOptStat(10);
322  char **nameX=nameW;
323  for(int i=0;i<4;i++) {
324  char txt[100];
325  printf("->%s<\n",nameX[i]);
326  h=(TH1*)fd->Get(nameX[i]); assert(h);
327  if(i==3) { // draw on previous
328  float sum=h->GetEntries();
329  sprintf(txt,"%.0f eve >thres",sum);
330  tx=new TText(30,55,txt); tx->Draw();
331  }
332 
333  c->cd(i+1); h->Draw();
334  if(i<3) h->SetAxisRange(0,60);
335  if(i!=2 ) h->Draw("colz");
336  if(i==0 ) h->SetAxisRange(0,60,"y");
337  if(i==1 ) {h->SetAxisRange(0,60,"x");h->SetAxisRange(-40,60,"y");}
338  if(i==2 ) {
339  h->Draw("eh"); h->SetAxisRange(0,60);
340  // if(strstr("run9",core0)>=0) h->SetMaximum(80);
341  }
342  }
343 
344  } break;//--------------------------------------
345 
346  case 14: { sprintf(padTit,"pT-Balance plots (out of order) %s",core0);
347  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
348  c->Divide(2,2);gStyle->SetOptStat(10);
349  char **nameX=namePB;
350  for(int i=0;i<3;i++) {
351  printf("->%s<\n",nameX[i]);
352  h=(TH1*)fd->Get(nameX[i]); assert(h);
353  c->cd(i+1);
354  if(i<2) h->Draw("colz");
355  else h->Draw();
356  if(i==2) h->Rebin(4);
357  }
358 
359  } break;//--------------------------------------
360 
361 
362  case 15:{ sprintf(padTit,"BSMD raw spectra, %s",core0);
363  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
364  c->Divide(1,2);gStyle->SetOptStat(10);
365  char **nameX=nameB1;
366  for(int i=0;i<2;i++) {
367  printf("->%s<\n",nameX[i]);
368  h=(TH1*)fd->Get(nameX[i]); assert(h);
369  c->cd(i+1); h->Draw();
370  }
371  c->GetPad(1)->SetLogy();
372  c->GetPad(2)->SetLogy();
373 
374  } break;//--------------------------------------
375 
376 case 16:{ sprintf(padTit,"TPC dEdx for all & W tracks, %s",core0);
377  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
378  c->Divide(2,1);gStyle->SetOptStat(10);
379  char **nameX=nameN;
380  for(int i=0;i<2;i++) {
381  printf("->%s<\n",nameX[i]);
382  h=(TH1*)fd->Get(nameX[i]); assert(h);
383  c->cd(i+1); h->Draw("colz");
384  }
385  c->GetPad(1)->SetLogz();
386  } break;//--------------------------------------
387 
388 case 17:{ sprintf(padTit,"TPC global DCA to Vertex for W tracks, %s",core0);
389  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
390  c->Divide(2,2);gStyle->SetOptStat(10);
391  char **nameX=nameO;
392  for(int i=0;i<3;i++) {
393  printf("->%s<\n",nameX[i]);
394  h=(TH1*)fd->Get(nameX[i]); assert(h);
395  c->cd(i+1); h->Draw("colz");
396  h->SetAxisRange(0,60); h->SetAxisRange(-2.,2.,"y");
397  }
398  } break;//--------------------------------------
399 
400 
401 
402  case 18:{ sprintf(padTit,"electron candidate ET vs. condition, %s",core0);
403  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
404  gStyle->SetOptStat(10);
405  char **nameX=nameP;
406  c->cd(); TPad *cL,*cR; splitPadX(0.5,&cL,&cR);
407  cL->cd(); cR->Divide(1,3);
408  for(int i=0;i<7;i++) {
409  printf("->%s<\n",nameX[i]);
410  h=(TH1*)fd->Get(nameX[i]); assert(h);
411  if(i==0) { h->Draw(); h->SetAxisRange(0,60);}
412  if(i>0 && i<4) h->Draw("same");
413  if(i==1) h->SetFillColor(kBlue);
414  if(i==2) h->SetFillColor(8);
415  if(i==3) h->SetFillColor(kRed);
416  if(i==4) { cR->cd(1); h->Draw(); h->SetAxisRange(0,5); }
417  if(i==5) { cR->cd(2); h->Draw();}
418  if(i==6) { cR->cd(3); h->Draw(); h->Fit("gaus","","Rh",-100,80); h->GetXaxis()->SetTitle("Z (cm)");}
419  if(i>3) {
420  h->GetXaxis()->SetTitleOffset(0.9);
421  h->GetXaxis()->SetLabelSize(0.06); h->GetXaxis()->SetTitleSize(0.05); h->SetMinimum(0.8);}
422 
423  }
424  cL->GetPad(0)->SetLogy();
425  cR->GetPad(1)->SetLogy();
426 
427  } break;//--------------------------------------
428 
429 case 19:{ sprintf(padTit,"Background study for Joe, %s",core0);
430  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
431  c->Divide(3,3);gStyle->SetOptStat(10);
432  char **nameX=nameQ;
433  for(int i=0;i<8;i++) {
434  printf("->%s<\n",nameX[i]);
435  h=(TH1*)fd->Get(nameX[i]); assert(h);
436  c->cd(i+1); h->Draw();
437  h->SetFillColor(30+i*5);
438  if(i==7) h->Draw("colz");
439  }
440  c->GetPad(1)->SetLogy();
441  } break;//--------------------------------------
442 
443 
444  case 20:{ sprintf(padTit,"pub-maker misc, %s",core0);
445  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
446  c->Divide(2,2);gStyle->SetOptStat(10);
447  char **nameX=nameR1;
448  for(int i=0;i<3;i++) {
449  printf("->%s<\n",nameX[i]);
450  h=(TH1*)fd->Get(nameX[i]); assert(h);
451  if(i==4) {
452  h->Draw("same e");
453  break;
454  }
455  c->cd(i+1); h->Draw();
456  if(i==1) h->Draw("colz");
457  if(i==0) h->Draw("h text");
458  }
459  c->GetPad(2)->SetLogz();
460  c->GetPad(1)->SetLogy();
461  } break;//--------------------------------------
462 
463 
464  case 21:{ sprintf(padTit,"charge separation, %s",core0);
465  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
466  c->Divide(2,1);gStyle->SetOptStat(10);
467  char **nameX=nameR2;
468  for(int i=0;i<2;i++) {
469  printf("->%s<\n",nameX[i]);
470  h=(TH1*)fd->Get(nameX[i]); assert(h);
471  c->cd(i+1); h->Draw("colz");
472  }
473  } break;//--------------------------------------
474 
475 
476  case 22:{ sprintf(padTit,"charge separation, %s",core0);
477  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
478  c->Divide(3,2);gStyle->SetOptStat(10);
479  char **nameX=nameR3;
480  for(int i=0;i<6;i++) {
481  printf("->%s<\n",nameX[i]);
482  h=(TH1*)fd->Get(nameX[i]); assert(h);
483  c->cd(i+1); h->Draw();
484  }
485  } break;//--------------------------------------
486 
487 
488 
489  case 23:{ sprintf(padTit,"bXing & spin QA, %s",core0);
490  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
491  c->Divide(2,3);gStyle->SetOptStat(1000010);
492  char **nameX=nameS1;
493  for(int i=0;i<6;i++) {
494  printf("->%s<\n",nameX[i]);
495  h=(TH1*)fd->Get(spinPre+nameX[i]); assert(h);
496  c->cd(i+1); h->Draw();
497  if(i==1) { h->Draw("colz");}
498  }
499  c->GetPad(1)->SetLogy();
500 
501  } break;//--------------------------------------
502 
503 
504  case 24:{ sprintf(padTit,"Final Ws for spin analysis, %s",core0);
505  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
506  c->Divide(2,2);gStyle->SetOptStat(10);
507  char **nameX=nameS5;
508  for(int i=0;i<4;i++) {
509  printf("->%s<\n",nameX[i]);
510  h=(TH1*)fd->Get(spinPre+nameX[i]); assert(h);
511  c->cd(i+1); h->Draw();
512  if(i==2) { hx=(TH1*) h->Clone(); h->SetFillColor(9); hx->SetFillColor(46);
513  hx->SetAxisRange(0,1); hx->Draw("same");
514  }
515 
516  if(i==3) { h->Draw("colz"); ((TH2F*)h)->Rebin2D(1,2);}
517  if(i<2) h->Rebin();
518  if(i<2||i==3) h->SetAxisRange(0,70);
519  gPad->SetGrid(0,0);
520  }
521  } break;//--------------------------------------
522 
523 
524 
525  case 25:
526  case 26:
527  { sprintf(padTit,"spin sorting: lumi & Ws, %s",core0);
528  char **nameX=nameS2;
529  if(page==26) { nameX=nameS3;sprintf(padTit,"spin sorting: QCD background, %s",core0);}
530  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
531  c->Divide(2,2);gStyle->SetOptStat(1000010);
532 
533  for(int i=0;i<4;i++) {
534  printf("->%s<\n",nameX[i]);
535  h=(TH1*)fd->Get(spinPre+nameX[i]); assert(h);
536  c->cd(i+1); h->Draw("h text");
537  }
538  } break;//--------------------------------------
539 
540  case 27:{ sprintf(padTit,"charge & ET vs. spin state, %s",core0);
541  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
542  c->Divide(2,2);gStyle->SetOptStat(10);
543  char **nameX=nameS4;
544  for(int i=0;i<3;i++) {
545  printf("->%s<\n",nameX[i]);
546  h=(TH1*)fd->Get(spinPre+nameX[i]); assert(h);
547  c->cd(i+1); h->Draw("colz");
548  if(i==2) h->Draw();
549  }
550  } break;//--------------------------------------
551 
552 
553 
554  case 30: // TPC stats
555  case 31:
556  case 32: // TPC nFitPts
557  case 33:
558  case 34: // TPC nFit/nPossibe
559  case 35:
560  case 36: // TPC 1st hit R
561  case 37:
562  case 38: // TPC last hit R
563  case 39:
564  case 40: // TPC dE/dX
565  case 41:
566  {
567  int iew=(page-30)%2; // East-West
568  int iCut=(page-30)/2;
569  int sec1=1, sec2=12; if(iew) sec1=13, sec2=24;
570  char *titA[]={"stats","nFitPoints", " nFit/nPossible","1st hit Rxy","last hit Rxy","dE/dX"};
571  char *titB[]={"Stat","TrNfit","TrFitFrac","TrRxyIn","TrRxyOut","TrdEdX"};
572  sprintf(padTit,"TPC %s sectors[%d,%d], %s",titA[iCut],sec1,sec2,core0);
573  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
574  c->Divide(4,3);gStyle->SetOptStat(10);
575  for(int i=0;i<12;i++) {
576  char name[100];
577  sprintf(name,"sec%d_%s",i+sec1,titB[iCut]);
578  printf("->%s<\n",name);
579  h=(TH1*)fd->Get(name); assert(h);
580  c->cd(i+1);
581  if(iCut==5)
582  h->Draw("colz");
583  else
584  h->Draw();
585  int col=30+i+sec1;
586  h->SetFillColor(col);
587 
588 
589  }
590  } break;//--------------------------------------
591 
592  case 42:{ sprintf(padTit,"TPC accepted tracks, %s",core0);
593  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
594  c->Divide(2,1);gStyle->SetOptStat(10);
595  h2=muTr2D1; // cumulative
596  c->cd(1); h2->Draw("colz");
597  c->cd(2);
598 
599  for(int i=0;i<24;i++) {
600  char name[100];
601  sprintf(name,"sec%d_Tr2D1",i+1);
602  printf("->%s<\n",name);
603  h=(TH1*)fd->Get(name); assert(h); h->SetLineColor(30+i);
604  if(i==0) h->Draw("box");
605  else h->Draw("box same");
606  }
607 
608  } break;//--------------------------------------
609 
610  default:
611  printf("page=%d NOT defined\n",page);
612  return;
613  }
614 
615  char text[100];
616  sprintf(text,"%s%s_page%03d",oPath,core0,page);
617  TString tit=text;
618  can->SetTitle(tit);
619  can->SetName(tit);
620 
621 
622  if(pl&1) can->Print(tit+".gif");
623  if(pl&2) can->Print(tit+spinPre+".ps");
624 
625 }
626 
627 //------------------------
628 void splitPadX(float x, TPad **cL, TPad **cR) {
629  (*cL) = new TPad("padL", "apdL",0.0,0.,x,0.95);
630  (*cL)->Draw();
631  (*cR) = new TPad("padL", "apdL",x+0.005,0.,1.0,0.95);
632  (*cR)->Draw();
633 }
634 
635 //------------------------
636 void splitPadY(float y, TPad **cU, TPad **cD) {
637  (*cU) = new TPad("padD", "apdD",0,y+0.005,1.0,1.);
638  (*cU)->Draw();
639  (*cD) = new TPad("padU", "apdU",0.0,0.,1.,y);
640  (*cD)->Draw();
641 
642  /* use case:
643  TPad *cU,*cD; splitPadY(0.4,&cU,&cD); cU->cd(); h->Draw()
644  */
645 }
646 
647 
648 //------------------------
649 int tpcSec(float phiRad, float etaDet){ // finds TPC sector for hit(phi,eta)
650  int sec=0;
651  float phi=phiRad/PI*180; // now in degrees
652  if (etaDet>0) { // West TPC
653  float x=75-phi;
654  while(x<0) x+=360;
655  sec=1+(int)( x/30.);
656  } else {
657  float x=phi-105;
658  while(x<0) x+=360;
659  sec=13+(int)( x/30.);
660  }
661  printf("phi/deg=%.1f, x=%.1f\n",phi,x);
662  return sec;
663 }
664 
665 //------------------------
666 TPad *makeTitle(TCanvas *c,char *core, int page) {
667  c->Range(0,0,1,1);
668  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
669  pad0->Draw();
670  pad0->cd();
671 
672  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
673  pt->Draw();
674  TDatime dt;
675  TString txt2=core;
676  txt2+=", page=";
677  txt2+=page;
678  txt2+=", ";
679  txt2+=dt.AsString();
680  pt->AddText(txt2);
681  txt2="--";
682  pt->AddText(txt2);
683 
684  c->cd();
685  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
686  pad->Draw();
687  return pad;
688 }
689 
690 //============================
691 void doAll(){
692  for(int i=1;i<=27;i++) {
693  plWana(i,2);
694  }
695  // TPC by sector:
696  for(int i=30;i<=42;i++) plWana(i,2);
697 
698 }
699 
700 //============================
701 void doAllMC(){
702  for(int i=1;i<=23;i++){
703  if(i==2) continue;
704  if(i==3) continue;
705  if(i==4) continue;
706  plWana(i,2);
707  }
708  // TPC by sector:
709  for(int i=30;i<=42;i++) plWana(i,2);
710 }
711 
712 
713 // $Log: plWana.C,v $
714 // Revision 1.17 2010/11/09 23:00:56 balewski
715 // added chi2/dof for East & West TPC separately
716 //
717 // Revision 1.16 2010/03/22 16:11:44 balewski
718 // better computation of AL(QCD)
719 //
720 // Revision 1.15 2010/03/20 18:38:43 balewski
721 // *** empty log message ***
722 //
723 // Revision 1.14 2010/03/18 16:52:19 balewski
724 // corrected sPtBalance for no-endcap
725 //
726 // Revision 1.13 2010/03/15 17:05:51 balewski
727 // cleanup, used for W AL sort March 15, 2010
728 //
729 // Revision 1.12 2010/03/14 22:50:34 balewski
730 // *** empty log message ***
731 //
732 // Revision 1.11 2010/02/04 03:48:25 balewski
733 // add ET for lumi monitor
734 //
735 // Revision 1.10 2010/01/30 02:02:56 balewski
736 // manore tunes
737 //
738 // Revision 1.9 2010/01/28 20:10:08 balewski
739 // added eta dependent spin sorting
740 //
741 // Revision 1.8 2010/01/27 22:12:26 balewski
742 // spin code matched to x-section code
743 //
744 // Revision 1.7 2010/01/26 19:28:07 balewski
745 // added pt-balanc eplots
746 //
747 // Revision 1.6 2010/01/21 00:15:30 balewski
748 // added sector & run dependent TPC cuts on Rin, Rout
749 //
750 // Revision 1.4 2010/01/10 03:01:39 balewski
751 // cleanup & nicer histos
752 //
753 // Revision 1.3 2009/12/30 18:37:08 balewski
754 // code tagged in the form close to that used for the Fall 2009 DNP preliminary Jacobian peak
755 //
756 // Revision 1.2 2009/12/08 16:53:01 balewski
757 // *** empty log message ***
758 //
759 // Revision 1.1 2009/11/23 23:00:20 balewski
760 // code moved spin-pool
761 //