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