StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plEana.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 // Endcap reco algo
10 
11 //=================================================
12 void plEana( 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
13 
14  cout<<iPath<<core0<<endl;
15 
16  if(page<=-1) {
17  doAll(core0,iPath,isMC,oPath,etaBin);
18  return;
19  }
20 
21 /*
22 cat mcSetD1*W*ps | ps2pdf - ~/WWW/tmp/all-W.pdf
23 */
24 
25 
26  char *nameA[]={"muEStatEve","muEStatTrk"}; //pg 1
27  char *nameB[]={"muEVRf","muEZv","muENV","muEbX48"};//pg 2
28  char *nameC[]={"muEbX7","muEbX7v"};//pg 3
29  char *nameD[]={"muEDsm1","muEDsm2","muEDsm3","muEDsm4"};//pg 4
30  char *nameE[]={"muETrNfit","muETrFitFrac","muETrch2","muETrRxyIn","muETrRxyOut","muETrch2b"};//pg 5
31  char *nameF[]={"muETr2D1","muETrPt1","muETrPt1N","muETrPt1Pr","muETrPt1NPr"};//pg 6
32  char *nameG[]={"muEeXY","muEmaxAdc","muEtotAdc","muEclAdcPt","muEclET"};//pg 7
33  char *nameH[]={"muEclET24","muEclE242D","muEclET24R"};//pg 8
34 
35  char *nameJ[]={"muEdist1","muEdist2","muEdist3","muEdist4"};//pg 9
36  char *nameK[]={"muETEMCjetETR","muETjetEMCjet2D","muETEMCjetET"};//pg 10
37  char *nameL[]={"muEEMCjetET","muEclEMCjetE2D","muETjetET"};//pg 11
38  char *nameM[]={"muETwayET","muEBwayET","muEEclETPt","muEEwayET"};//pg 12
39 
40  char *nameW[]={"muETotwayET2D","muEsPtBalance_clust","muE_WET","muE_W2D1"};//pg 13
41  char *namePB[]={"muEsPtBalance_clust", "muEsPtBalance_awayTot","muE_Weta","muE_WXY"};// pg 14 -Pt-Balance plots
42  char *nameN[]={"muETrdEdX","muE_Wdedx"}; //pg 16 -> pg 15 pg21 -> pg16
43  char *nameO[]={"muE_WglDcaSP","muE_WglDcaSN"}; // pg 17
44 
45  char *nameP[]={"muE_ETlive0","muE_ETlive1","muE_ETlive2","muE_ETlive3","muE_Wcar1","muE_Wcar2","muE_Wcar3"}; // pg 18
46 
47  //add histograms for q/pt plots etc.
48  char *nameR2[]={"muEchRecPNg","muEchRecPNp"};// pg 19
49  char *nameR3[]={"muEchRecHypCorrPNg" ,"muEchRecHypCorrPNp"};// pg 20
50 
51  char *nameSMD[]={"muE_UoffStr","muE_VoffStr"}; // pg21 -> pg 16
52 
53  TString spinPre='A';
54  char *nameS1[]={"spinEStatEve","spinEs4mon","spinEbX48","spinEbX7","spinEbX48c","spinEbX7c"};// pg 23
55  char *nameS5[]={"spinE_ET_P","spinE_ET_N","spinEQpT","spinEQpT2"};// pg 24
56  char *nameS6[]={"spinEQpT_hits","spinEQpT_hitF","spinEHitsFit_Frac"};// pg 25
57  char *nameS2[]={"spinEY0","spinEY1","spinEY2_P","spinEY2_N"};// pg 26
58  char *nameS3[]={,"spinEY3_P","spinEY3_N","spinEY4_P","spinEY4_N"};// pg 27
59  char *nameS4[]={"spinEY5_P","spinEY5_N","spinELepEta_P","spinELepEta_N"};// pg 28
60 
61  char *nameEsmd1[]={"muEsmdNhit","muEsmdEne","muEsmdRatioUV","muEclustET_esmdNhit","muEclustET_esmdEne","muEclustET_esmdRatio"};//pg 29
62  char *nameEsmd2[]={"muEclustET_esmdEneSum7","muEsPtBalance_clustPassSMD","muEsPtBalance_clustFailSMD","muEsPtBalance_esmdRatio_ET25","muEsPtBalance2_clustPassSMD","muEsPtBalance2_clustFailSMD"};//pg 30
63 
64  //use Page 30-42 TPC sectors per cut, 2 pages per cut
65 
66  gStyle->SetOptFit(1);
67  TString fullInpName=iPath; fullInpName+=core0;
68  fullInpName+=".wana.hist.root";
69  fd=new TFile(fullInpName);
70  if(! fd->IsOpen()) {
71  printf("EROR: input histo file not found, quit\n",fullInpName.Data());
72  return;
73  } else {
74  printf("Opened: %s\n",fullInpName.Data());
75  }
76 
77  //switch to TDirectory for eta binning
78  if(fd->Get("muEStatEve")==0) {
79  cout<<"Switching to etaBin="<<etaBin<<" now have to use gDirectory"<<endl;
80  spinPre+=etaBin;
81  if(!fd->cd(etaBin)) {
82  cout<<"Missing TDirectory of interest, no plots!"<<endl;
83  return;
84  }
85  }
86 
87  if(page==1||page==13){
88  //fd->ls();
89  h0=(TH1*)gDirectory->Get("muEStatEve"); assert(h0);
90  printf("%s: ",h0->GetName());
91  for(int k=1;k<=16;k++) printf("%.0f, ",h0->GetBinContent(k));
92  printf("\n");
93  }
94  // if(page>=23 && page<=25 && gDirectory->Get("AspinStatEve")==0) return; // skip spin plots if maker was not used
95 
96  //skip tpc plots if using tree reader code
97  if( ((page>=2 && page<=6) || (page>=31 && page<=43)) && !fd->cd("tpc")) return;
98  fd->cd();
99  gStyle->SetPalette(1,0);
100  gStyle->SetOptStat(0);
101  char padTit[1000];
102  sprintf(padTit,"%s",core0);
103 
104  switch (page) {
105 
106  case 1:{
107  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
108  c->Divide(1,2);gStyle->SetOptStat(0);
109  char **nameX=nameA;
110  for(int i=0;i<2;i++) {
111  printf("->%s<\n",nameX[i]);
112  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
113  c->cd(i+1); h->Draw();
114  if(i==0) h->Draw("h text");
115  }
116  c->GetPad(1)->SetLogy();
117  c->GetPad(2)->SetLogy();
118  } break;//--------------------------------------
119 
120  case 2:{
121  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
122  c->Divide(2,2);gStyle->SetOptStat(1110);
123  char **nameX=nameB;
124  for(int i=0;i<4;i++) {
125  printf("->%s<\n",nameX[i]);
126  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
127  c->cd(i+1); h->Draw();
128  if(i==1) h->Fit("gaus","","hR",-50,50);
129  }
130  c->GetPad(1)->SetLogy();
131  c->GetPad(3)->SetLogy();
132  } break;//--------------------------------------
133 
134 
135  case 3:{ // efficiency vs. bXing, only for data
136  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
137  c->Divide(1,2);gStyle->SetOptStat(10);
138  char **nameX=nameC;
139  TH1F *hA[2];
140  c->cd(1);
141  for(int i=0;i<2;i++) {
142  printf("->%s<\n",nameX[i]);
143  hA[i]=(TH1F*)gDirectory->Get(nameX[i]); assert(hA[i]);
144  if(i==0) hA[i]->Draw();
145  else hA[i]->Draw("same");
146 
147  }
148  // c->GetPad(1)->SetLogy();
149 
150  hA[0]->SetFillColor(0);
151 
152  TH1 *hEf=(TH1F*) hA[1]->Clone();
153  hEf->SetTitle("Vertex effi vs. bXing");
154  hEf->SetName("muVefbx");
155  hEf->SetFillColor(0); hEf->SetLineColor(kMagenta);
156  hEf->Divide(hA[0]);
157  c->cd(2);
158  hEf->Draw(); hEf->SetMaximum(1.1);
159  hEf->Fit("pol0","","Rh",50,100);
160 
161  } break;//--------------------------------------
162 
163  case 4:{
164  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
165  c->Divide(2,2);gStyle->SetOptStat(1001111);
166  char **nameX=nameD;
167  for(int i=0;i<4;i++) {
168  printf("->%s<\n",nameX[i]);
169  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
170  c->cd(i+1); h->Draw();
171  if(i==3) {
172  h->SetFillColor(kBlue);
173  c->cd(3);
174  h->Draw("same");
175  }
176  }
177  c->GetPad(1)->SetLogy();
178  c->GetPad(2)->SetLogy();
179  c->GetPad(3)->SetLogy();
180  } break;//--------------------------------------
181 
182  case 5:{ sprintf(padTit,"Track selection cuts, %s",core0);
183  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
184  c->Divide(3,2);gStyle->SetOptStat(110);
185  char **nameX=nameE;
186  for(int i=0;i<6;i++) {
187  printf("->%s<\n",nameX[i]);
188  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
189  c->cd(i+1); h->Draw();
190  if(i==5) h->Draw("colz");
191  }
192  //c->GetPad(1)->SetLogy();
193  } break;//--------------------------------------
194 
195 
196 
197 
198  case 6:{ sprintf(padTit,"Selected high PT tracks, %s",core0);
199  can=new TCanvas("aa","aa",800,600); TPad *c0=makeTitle(can,padTit,page);
200  TPad *cL,*cR; splitPadX(0.4,&cL,&cR);
201  cR->cd();
202  cR->Divide(2,2);gStyle->SetOptStat(10);
203  char **nameX=nameF;
204  TH1F *h1,*h2;
205  for(int i=0;i<5;i++) {
206  printf("->%s<\n",nameX[i]);
207  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
208  if(i==0) { cL->cd();
209  h->Draw("colz");
210  for( float eta=-0.8; eta<.6; eta+=1.4) // print sectors IDs
211  for(float x=-PI-.1; x<PI; x+=PI/6) {
212  int sec=tpcSec(x, eta);;
213  char txt[100];
214  sprintf(txt,"sec %d",sec);
215  tx=new TText(eta,x,txt); tx->Draw();
216  }
217  }
218 
219  if(i==1 || i==3) {cR->cd(1+i/2); h1=h; h->Draw(); h->SetMinimum(.1);}
220  if(i==4) h->SetFillColor(9);
221  if(i==2 || i==4) { h2=h; h->Draw("same"); cR->cd(2+i/2);
222  h=(TH1F*) h2->Clone(); h->SetTitle("Ratio Negtive/all");h->Divide(h1); h->Draw();
223  h->SetMinimum(0.2); h->SetMaximum(0.7);
224  }
225  if(i>0) h->SetAxisRange(0,50);
226  }
227  cR->GetPad(1)->SetLogy();
228  cR->GetPad(2)->SetLogy();
229  } break;//--------------------------------------
230 
231  case 7:{ sprintf(padTit,"ETOW response, %s",core0);
232  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
233  c->Divide(3,2);gStyle->SetOptStat(1000110);
234  char **nameX=nameG;
235  for(int i=0;i<5;i++) {
236  printf("->%s<\n",nameX[i]);
237  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
238  c->cd(i+1); h->Draw();
239  if(i==3 || i==0) h->Draw("colz");
240  if(i==3) h->SetMaximum(0.6* h->GetMaximum());
241  }
242  c->GetPad(2)->SetLogy();
243  c->GetPad(3)->SetLogy();
244  // c->GetPad(4)->SetLogz();
245  c->GetPad(5)->SetLogy();
246  } break;//--------------------------------------
247 
248  case 8:{ sprintf(padTit,"2x1 / 4x4 cluster isolation cut, %s",core0);
249  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
250  c->Divide(2,2);gStyle->SetOptStat(10);
251  char **nameX=nameH;
252  for(int i=0;i<3;i++) {
253  printf("->%s<\n",nameX[i]);
254  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
255  c->cd(i+1); h->Draw();
256  if(i==1 ) h->Draw("colz");
257  }
258  c->GetPad(1)->SetLogy();
259  c->GetPad(2)->SetLogz();
260  } break;//--------------------------------------
261 
262  case 9:{ sprintf(padTit,"3D distance between track & cluster, %s",core0);
263  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
264  c->Divide(2,2);gStyle->SetOptStat(10);
265  char **nameX=nameJ;
266  for(int i=0;i<4;i++) {
267  printf("->%s<\n",nameX[i]);
268  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
269  c->cd(i+1);
270  if(i==3) h->Draw();
271  else h->Draw("colz");
272  }
273  } break;//--------------------------------------
274 
275  case 10:{ sprintf(padTit,"separted near jet in BOW & TPC, %s",core0);
276  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
277  c->Divide(2,2);gStyle->SetOptStat(10);
278  char **nameX=nameL;
279  for(int i=0;i<3;i++) {
280  printf("->%s<\n",nameX[i]);
281  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
282  c->cd(i+1); h->Draw();
283  if(i==1 ) h->Draw("colz");
284  }
285  c->GetPad(1)->SetLogy();
286  c->GetPad(2)->SetLogz();
287  c->GetPad(3)->SetLogy();
288  } break;//--------------------------------------
289 
290 
291  case 11:{ sprintf(padTit,"TPC+BTOW near jet ET, %s",core0);
292  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
293  c->Divide(2,2);gStyle->SetOptStat(10);
294  char **nameX=nameK;
295  for(int i=0;i<3;i++) {
296  printf("->%s<\n",nameX[i]);
297  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
298  c->cd(i+1); h->Draw();
299  if(i==1 ) h->Draw("colz");
300  }
301 
302  c->GetPad(2)->SetLogz();
303 
304  } break;//--------------------------------------
305 
306  case 12:{ sprintf(padTit,"away ET veto, %s",core0);
307  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
308  c->Divide(2,2);gStyle->SetOptStat(10);
309  char **nameX=nameM;
310  for(int i=0;i<4;i++) {
311  printf("->%s<\n",nameX[i]);
312  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
313  c->cd(i+1); h->Draw();
314  if(i==2) h->SetAxisRange(0,60);
315  if(i==2 ){
316  h->Draw("colz");
317  }
318  }
319  c->GetPad(1)->SetLogy();
320  c->GetPad(2)->SetLogy();
321  c->GetPad(4)->SetLogy();
322 
323  } break;//--------------------------------------
324 
325 
326  case 13:{ sprintf(padTit,"best W selection, %s",core0);
327  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
328  c->Divide(2,2);gStyle->SetOptStat(10);
329  char **nameX=nameW;
330  for(int i=0;i<4;i++) {
331  char txt[100];
332  printf("->%s<\n",nameX[i]);
333  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
334  if(i==3) { // draw on previous
335  float sum=h->GetEntries();
336  sprintf(txt,"%.0f eve >thres",sum);
337  tx=new TText(30,52,txt); tx->Draw();
338  }
339 
340  c->cd(i+1); h->Draw();
341  if(i<3) h->SetAxisRange(0,60);
342  if(i!=2 ) h->Draw("colz");
343  if(i==0 ) h->SetAxisRange(0,60,"y");
344  if(i==1 ) {h->SetAxisRange(0,60,"x");h->SetAxisRange(-40,60,"y");}
345  if(i==2 ) {
346  h->Draw("eh"); h->SetAxisRange(0,60);
347  h->SetFillColor(8);
348  // if(strstr("run9",core0)>=0) h->SetMaximum(80);
349  }
350  }
351 
352  } break;//--------------------------------------
353 
354  case 14: { sprintf(padTit,"pT-Balance plots (out of order) %s",core0);
355  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
356  c->Divide(2,2);gStyle->SetOptStat(10);
357  char **nameX=namePB;
358  for(int i=0;i<4;i++) {
359  printf("->%s<\n",nameX[i]);
360  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
361  c->cd(i+1);
362  if(i==2) {h->Rebin(8); h->GetXaxis()->SetRangeUser(0.5,2.0);}
363  if(i<2) h->Draw("colz");
364  else h->Draw();
365  if(i==3) h->Draw("colz");
366  }
367 
368  } break;//--------------------------------------
369 
370 case 15:{ sprintf(padTit,"TPC dEdx for all & W tracks, %s",core0);
371  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
372  c->Divide(2,1);gStyle->SetOptStat(10);
373  char **nameX=nameN;
374  for(int i=0;i<2;i++) {
375  printf("->%s<\n",nameX[i]);
376  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
377  c->cd(i+1); h->Draw("colz");
378  }
379  c->GetPad(1)->SetLogz();
380  } break;//--------------------------------------
381 
382  case 16:{ sprintf(padTit,"TRack-SMD peak offset , %s",core0);
383  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
384  c->Divide(1,2);gStyle->SetOptStat(10);
385  char **nameX=nameSMD;
386  for(int i=0;i<2;i++) {
387  printf("->%s<\n",nameX[i]);
388  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
389  c->cd(i+1); h->Draw("colz");
390  for(int sec=1;sec<=12;sec++) {
391  float phiC= (3-sec)*30;
392  if(phiC<-179) phiC+=360;
393  float phiL= (phiC-15.)/180*3.1416;
394  //printf("sec=%d phiC/deg=%.0d phiL/rad=%.2f\n",sec,phiC, phiL);
395  ln=new TLine(phiL,-7,phiL,7); ln->Draw(); ln->SetLineColor(8);
396  tx=new TText(phiL+0.05,5,Form("sec %d",sec)); tx->Draw();
397  }
398  }
399  } break;//--------------------------------------
400 
401 case 17:{ sprintf(padTit,"TPC global DCA to Vertex for W tracks, %s",core0);
402  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
403  c->Divide(2,2);gStyle->SetOptStat(10);
404  char **nameX=nameO;
405  for(int i=0;i<2;i++) {
406  printf("->%s<\n",nameX[i]);
407  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
408  c->cd(i+1); h->Draw("colz");
409  h->SetAxisRange(0,60); h->SetAxisRange(-2.,2.,"y");
410  }
411  } break;//--------------------------------------
412 
413 
414 
415  case 18:{ sprintf(padTit,"electron candidate ET vs. condition, %s",core0);
416  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
417  gStyle->SetOptStat(10);
418  char **nameX=nameP;
419  c->cd(); TPad *cL,*cR; splitPadX(0.5,&cL,&cR);
420  cL->cd(); cR->Divide(1,3);
421  for(int i=0;i<7;i++) {
422  printf("->%s<\n",nameX[i]);
423  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
424  if(i==0) { h->Draw(); h->SetAxisRange(0,60);}
425  if(i>0 && i<4) h->Draw("same");
426  if(i==1) h->SetFillColor(kBlue);
427  if(i==2) h->SetFillColor(8);
428  if(i==3) h->SetFillColor(kRed);
429  if(i==4) { cR->cd(1); h->Draw(); h->SetAxisRange(0,5); }
430  if(i==5) { cR->cd(2); h->Draw();}
431  if(i==6) { cR->cd(3); h->Draw(); h->Fit("gaus","","Rh",-100,80); h->GetXaxis()->SetTitle("Z (cm)");}
432  if(i>3) {
433  h->GetXaxis()->SetTitleOffset(0.9);
434  h->GetXaxis()->SetLabelSize(0.06); h->GetXaxis()->SetTitleSize(0.05); h->SetMinimum(0.8);}
435 
436  }
437  cL->GetPad(0)->SetLogy();
438  cR->GetPad(1)->SetLogy();
439 
440  } break;//--------------------------------------
441 
442  case 19:{ sprintf(padTit,"charge separation, %s",core0);
443  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
444  c->Divide(2,1);gStyle->SetOptStat(110110);
445  ln=new TLine(0,0,80,0); ln->SetLineColor(kMagenta);
446  char **nameX=nameR2;
447  for(int i=0;i<2;i++) {
448  printf("->%s<\n",nameX[i]);
449  h=(TH2*)gDirectory->Get(nameX[i]); assert(h); h->Rebin2D(3,3);
450  c->cd(i+1); h->Draw("colz");
451  h->SetAxisRange(0,70); ln->Draw();
452  }
453  } break;//--------------------------------------
454 
455  case 20:{ sprintf(padTit,"Charge Separation Hyperbola Corrected, %s",core0);
456  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
457  c->Divide(2,1);gStyle->SetOptStat(110110);
458  ln=new TLine(0,0,70,0); ln->SetLineColor(kMagenta);
459  char **nameX=nameR3;
460  for(int i=0;i<2;i++) {
461  printf("->%s<\n",nameX[i]);
462  h=(TH2*)gDirectory->Get(nameX[i]); assert(h); h->Rebin2D(3,3);
463  c->cd(i+1); h->Draw("colz");
464  h->SetAxisRange(0,70); ln->Draw();
465  }
466  } break;//--------------------------------------
467 
468  case 23:{ sprintf(padTit,"bXing & spin QA, %s",core0);
469  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
470  c->Divide(2,3);gStyle->SetOptStat(1000010);
471  char **nameX=nameS1;
472  for(int i=0;i<6;i++) {
473  printf("->%s<\n",nameX[i]);
474  h=(TH1*)gDirectory->Get(spinPre+nameX[i]); assert(h);
475  c->cd(i+1); h->Draw();
476  if(i==1) { h->Draw("colz");}
477  }
478  c->GetPad(1)->SetLogy();
479 
480  } break;//--------------------------------------
481 
482 
483  case 24:{ sprintf(padTit,"Final Endcap Ws for spin analysis, %s",core0);
484  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
485  c->Divide(2,2);gStyle->SetOptStat(10);
486  char **nameX=nameS5;
487  for(int i=0;i<4;i++) {
488  printf("->%s<\n",nameX[i]);
489  h=(TH1*)gDirectory->Get(spinPre+nameX[i]); assert(h);
490  c->cd(i+1); h->Draw();
491  if(i==2) { hx=(TH1*) h->Clone(); h->SetFillColor(9); hx->SetFillColor(46);
492  hx->SetAxisRange(0,1); hx->Draw("same");
493  }
494 
495  if(i==3) { h->Draw("colz"); ((TH2F*)h)->Rebin2D(1,2);}
496  if(i<2) h->Rebin();
497  if(i<2||i==3) h->SetAxisRange(0,70);
498  gPad->SetGrid(0,0);
499  }
500  } break;//--------------------------------------
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(2,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  cout<<spinPre+nameX[i]<<endl;
524  h=(TH1*)gDirectory->Get(spinPre+nameX[i]); assert(h);
525  c->cd(i+1); h->Draw("h text");
526  }
527  } break;//--------------------------------------
528 
529  case 28:{ sprintf(padTit,"charge & ET vs. spin state, %s",core0);
530  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,spinPre+padTit,page);
531  c->Divide(2,2);gStyle->SetOptStat(10);
532  char **nameX=nameS4;
533  for(int i=0;i<4;i++) {
534  printf("->%s<\n",nameX[i]);
535  h=(TH1*)gDirectory->Get(spinPre+nameX[i]); assert(h);
536  c->cd(i+1); h->Draw("colz");
537  if(i>1) h->Draw();
538  }
539  } break;//--------------------------------------
540 
541  case 29:{ sprintf(padTit,"ESMD 1, %s",core0);
542  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
543  c->Divide(3,2);gStyle->SetOptStat(10);
544  char **nameX=nameEsmd1;
545  for(int i=0;i<6;i++) {
546  printf("->%s<\n",nameX[i]);
547  h=(TH2F*)gDirectory->Get(nameX[i]); assert(h);
548  if(i==1) h->Rebin2D(4,4);
549  if(i==3) h->Rebin2D(4,2);
550  if(i==4) h->Rebin2D(4,10);
551  if(i==5) h->Rebin2D(4,2);
552  if(i>2) h->GetXaxis()->SetRangeUser(0,70);
553 
554  c->cd(i+1); h->Draw("colz");
555  }
556  } break;//--------------------------------------
557 
558  case 30:{ sprintf(padTit,"ESMD 2, %s",core0);
559  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
560  c->Divide(3,2);gStyle->SetOptStat(10);
561  char **nameX=nameEsmd2;
562  for(int i=0;i<6;i++) {
563  printf("->%s<\n",nameX[i]);
564  h=(TH2F*)gDirectory->Get(nameX[i]); assert(h);
565  if(i==0) {
566  h->Rebin2D(4,10);
567  h->GetXaxis()->SetRangeUser(0,70);
568  }
569  if(i!=0 && i!=3) {
570  h->GetXaxis()->SetRangeUser(0,70);
571  h->GetYaxis()->SetRangeUser(-60,60);
572  }
573  c->cd(i+1); h->Draw("colz");
574  }
575  } break;//--------------------------------------
576 
577 
578  case 31: // TPC stats
579  case 32:
580  case 33: // TPC nFitPts
581  case 34:
582  case 35: // TPC nFit/nPossibe
583  case 36:
584  case 37: // TPC 1st hit R
585  case 38:
586  case 39: // TPC last hit R
587  case 40:
588  case 41: // TPC dE/dX
589  case 42:
590  {
591  fd->cd("tpc");
592  int iew=(page-31)%2; // East-West
593  int iCut=(page-31)/2;
594  int sec1=1, sec2=12; if(iew) {sec1=13, sec2=24; return;}
595  char *titA[]={"stats","nFitPoints", " nFit/nPossible","1st hit Rxy","last hit Rxy","dE/dX"};
596  char *titB[]={"Stat","TrNfit","TrFitFrac","TrRxyIn","TrRxyOut","TrdEdX"};
597  sprintf(padTit,"TPC %s sectors[%d,%d], %s",titA[iCut],sec1,sec2,core0);
598  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
599  c->Divide(4,3);gStyle->SetOptStat(10);
600  for(int i=0;i<12;i++) {
601  char name[100];
602  sprintf(name,"secEemcTr%d_%s",i+sec1,titB[iCut]);
603  printf("->%s<\n",name);
604  h=(TH1*)gDirectory->Get(name); assert(h);
605  c->cd(i+1);
606  if(iCut==5)
607  h->Draw("colz");
608  else
609  h->Draw();
610  int col=30+i+sec1;
611  h->SetFillColor(col);
612 
613 
614  }
615  } break;//--------------------------------------
616 
617  case 43:{ sprintf(padTit,"TPC accepted tracks, %s",core0);
618  fd->cd();
619  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
620  c->Divide(2,1);gStyle->SetOptStat(10);
621  h2=muETr2D1; // cumulative
622  c->cd(1); h2->Draw("colz");
623  c->cd(2);
624 
625  fd->cd("tpc");
626  for(int i=0;i<24;i++) {
627  char name[100];
628  sprintf(name,"secEemcTr%d_Tr2D1",i+1);
629  printf("->%s<\n",name);
630  h=(TH1*)gDirectory->Get(name); assert(h); h->SetLineColor(30+i);
631  if(i==0) h->Draw("box");
632  else h->Draw("box same");
633  }
634 
635  } break;//--------------------------------------
636 
637  default:
638  printf("page=%d NOT defined\n",page);
639  return;
640  }
641 
642  char text[100];
643  sprintf(text,"%s%s_page%03d",oPath,core0,page);
644  TString tit=text;
645  can->SetTitle(tit);
646  can->SetName(tit);
647 
648 
649  if(pl&1) can->Print(tit+".gif");
650  if(pl&2) can->Print(tit+spinPre+".ps");
651 
652 }
653 
654 //------------------------
655 void splitPadX(float x, TPad **cL, TPad **cR) {
656  (*cL) = new TPad("padL", "apdL",0.0,0.,x,0.95);
657  (*cL)->Draw();
658  (*cR) = new TPad("padL", "apdL",x+0.005,0.,1.0,0.95);
659  (*cR)->Draw();
660 }
661 
662 //------------------------
663 void splitPadY(float y, TPad **cU, TPad **cD) {
664  (*cU) = new TPad("padD", "apdD",0,y+0.005,1.0,1.);
665  (*cU)->Draw();
666  (*cD) = new TPad("padU", "apdU",0.0,0.,1.,y);
667  (*cD)->Draw();
668 
669  /* use case:
670  TPad *cU,*cD; splitPadY(0.4,&cU,&cD); cU->cd(); h->Draw()
671  */
672 }
673 
674 
675 //------------------------
676 int tpcSec(float phiRad, float etaDet){ // finds TPC sector for hit(phi,eta)
677  int sec=0;
678  float phi=phiRad/PI*180; // now in degrees
679  if (etaDet>0) { // West TPC
680  float x=75-phi;
681  while(x<0) x+=360;
682  sec=1+(int)( x/30.);
683  } else {
684  float x=phi-105;
685  while(x<0) x+=360;
686  sec=13+(int)( x/30.);
687  }
688  // printf("phi/deg=%.1f, x=%.1f\n",phi,x);
689  return sec;
690 }
691 
692 //------------------------
693 TPad *makeTitle(TCanvas *c,char *core, int page) {
694  c->Range(0,0,1,1);
695  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
696  pad0->Draw();
697  pad0->cd();
698 
699  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
700  pt->Draw();
701  TDatime dt;
702  TString txt2=core;
703  txt2+=", page=";
704  txt2+=page;
705  txt2+=", ";
706  txt2+=dt.AsString();
707  pt->AddText(txt2);
708  txt2="--";
709  pt->AddText(txt2);
710 
711  c->cd();
712  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
713  pad->Draw();
714  return pad;
715 }
716 
717 //============================
718 void doAll(char *core0="", char *iPath="", int isMC=0, char* oPath="", char* etaBin=""){
719  for(int i=1;i<=28;i++) {
720 // if( i==20) continue; //remove 20 for sign flip!
721  if( isMC && i==3) continue;
722  if( isMC &&i==4) continue;
723  if( isMC && i>=20) continue;
724 
725  plEana(i,2,core0,iPath,oPath,isMC,etaBin);
726  }
727 
728  // ESMD QA
729  //plEana(21,2,core0,iPath,oPath,isMC,etaBin);
730  for(int i = 29; i<=30; i++) plEana(i,2,core0,iPath,oPath,isMC,etaBin);
731 
732  // TPC by sector:
733  for(int i=31;i<=43;i++) plEana(i,2,core0,iPath,oPath,isMC,etaBin);
734 
735 }
736 
737 //============================
738 void doAllMC(char *core0="", char *iPath=""){
739  for(int i=1;i<=22;i++){ //was 23
740  //if(i==2) continue;
741  if(i==3) continue;
742  if(i==4) continue;
743  if(i==15) continue;
744  if(i==20 || i==22) continue;
745  plEana(i,2,core0,iPath);
746  }
747 
748  // TPC by sector:
749  for(int i=31;i<=43;i++) plEana(i,2,core0,iPath);
750 }
751 
752 
753 // $Log: plEana.C,v $
754 // Revision 1.16 2013/06/14 21:09:09 jlzhang
755 // add histo Q/pT vs. nHitsFit and Q/pT vs. nHitsPos
756 //
757 // Revision 1.15 2012/09/21 21:14:08 balewski
758 // plane/sectord dependent Z-location for ESMD implemented in matching of TPC track to ESMD shower.
759 // I'm done
760 //
761 // Revision 1.14 2012/09/21 16:59:13 balewski
762 // added ESMD peak adjustement - partialy finished
763 //
764 // Revision 1.13 2012/08/28 14:28:48 stevens4
765 // updates to movie makers
766 //
767 // Revision 1.12 2012/08/07 21:06:56 stevens4
768 // update to tree analysis to produce independent histos in a TDirectory for each eta-bin
769 //
770 // Revision 1.11 2012/07/06 20:45:19 stevens4
771 // *** empty log message ***
772 //
773 // Revision 1.10 2012/07/05 20:13:33 balewski
774 // *** empty log message ***
775 //
776 // Revision 1.9 2012/06/29 19:13:36 stevens4
777 // Include Jan's edits (previously removed with addition of TPC directory)
778 //
779 // Revision 1.8 2012/06/25 20:58:09 stevens4
780 // add directory for tpc histos
781 //
782 // Revision 1.6 2012/06/22 18:23:36 balewski
783 // *** empty log message ***
784 //
785 // Revision 1.5 2012/06/22 18:14:48 balewski
786 // removed doAllMC
787 //
788 // Revision 1.4 2012/06/22 17:36:57 stevens4
789 // *** empty log message ***
790 //
791 // Revision 1.3 2011/02/15 17:34:11 stevens4
792 // update plotting macros
793 //
794 // Revision 1.1 2011/02/10 20:33:34 balewski
795 // start
796 //