StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plEtaBins.C
1 enum {mxF=4}; // number of files to compare
2 enum {M=1}; // number of eta bins to comare
3 TFile *fdA[mxF];
4 int etaBin[M]={1};
5 /*
6 
7  cat out/comp_page01*ps |ps2pdf - ~/0x/comp_pg1.pdf
8 */
9 
10 void plEtaBins( int page=1) {
11  TString simuPath="8.28.12/";
12  TString dataPath="8.29.12/";
13  TString psPath="out/";
14 
15  fdA[0]=new TFile(dataPath+"run12long.wana.hist.root");
16  fdA[1]=new TFile(simuPath+"jba310.wana.hist.root");
17  fdA[2]=new TFile(simuPath+"jbb330.wana.hist.root");
18  fdA[3]=new TFile(simuPath+"jba311.wana.hist.root");
19 
20  TString dataNameA[mxF]={": STAR data 2012", "Pythia W+", "filter Pythia QCD" , "Pythia W-"};
21 
22  float lumScale[mxF]={72.,192/0.65,27*2.2,198/0.84};
23  float absLT=lumScale[0];
24  for(int k=0;k<mxF;k++) {
25  assert(fdA[k]->IsOpen());
26  lumScale[k]/=absLT;
27  }
28 
29  TString namePerPageB[]={"dumm","muBclET24R","muBdist4","muBjetETR","muWET","musPtBalance_clust", "musPtBalance_awayTot","muWcar3","muWeta","muChRecPNp","muWdedx"};
30  TString namePerPageE[]={"dumm","muEclET24R","muEdist4","muETEMCjetETR","muE_WET","muEsPtBalance_clust", "muEsPtBalance_awayTot","muE_Wcar3","muE_Weta","muEchRecPNp","muE_Wdedx"};
31  TString padTit;
32  TString hName;
33  gStyle->SetOptStat(1001100);
34  gStyle->SetOptFit(1);
35 
36  for(int etaBin=1; etaBin<=8;etaBin++) {
37  if(etaBin==6) continue;
38  //if(etaBin!=7) continue;
39  hName=namePerPageB[page];
40  if(etaBin==7) hName=namePerPageE[page]; // switch to full endcap
41  padTit=Form("#eta-bin=%d, absLT=%.1f/pb : ",etaBin, absLT)+hName;
42  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
43  c->Divide(2,2);
44  TH1F *h0=0;
45  float yMax=0;
46 
47  switch (page) {
48  case 1:
49  case 2:
50  case 3:
51  case 4:
52  case 7:
53  case 8:
54  { //............................
55  for(int k=0;k<mxF;k++){
56  TH1F *h=(TH1F *)fdA[k]->Get(Form("Eta%d/",etaBin)+hName); assert(h);
57  if(page==4 ||page==7 ) h->Rebin();
58  if(page==8) h->Rebin(4);
59  if(k==0) { yMax=1.1*h->GetMaximum(); h->SetLineWidth(2.);}
60  if(k==1 && page!=7) { h->SetFillColor(kRed); h->SetLineColor(kYellow); h->Draw("same"); h0->Draw("same");}
61  if(k==3) h->SetFillColor(kBlue);
62  h0=h;
63  c->cd(k+1);
64  h->Draw();
65  TString tit="";
66  if(k==0) tit+=h->GetTitle();
67  h->SetTitle(tit+dataNameA[k]);
68  h->Scale(1./lumScale[k]);
69  if(page>=4) { h->SetMaximum(yMax); }
70  if(page==4) h->SetAxisRange(0,70);
71  if(page==8) h->SetAxisRange(-1.3,1.8);
72  if(page==7){ h->Fit("gaus"); ln=new TLine(0,0,0,1e4); ln->Draw();}
73  // printf("%d %f\n",k,lumScale[k]);
74  }
75 
76  } break;
77 
78  case 5:
79  case 6:
80  case 9:
81  case 10:
82  { //............................
83  for(int k=0;k<mxF;k++){
84  TH2F *h2=(TH2F *)fdA[k]->Get(Form("Eta%d/",etaBin)+hName); assert(h);
85  c->cd(k+1);
86  h2->Draw("colz");
87  TString tit="";
88  if(k==0) tit+=h2->GetTitle();
89  h2->SetTitle(tit+dataNameA[k]);
90  h2->Scale(1./lumScale[k]);
91  if(page==9 ||page==10 ) { h2->Rebin2D(2,2); h2->SetAxisRange(0,70);}
92  // if(page==10 ) { h2->SetAxisRange(0,70);}
93  }
94 
95  } break;
96 
97  default:
98  printf("page=%d NOT defined\n",page);
99  return;
100  } // end of switch
101 
102 
103  TString tit=psPath+Form("comp_page%02d_etaBin%d",page,etaBin);
104  can->SetTitle(tit);
105  can->SetName(tit);
106  can->Print(tit+".ps");
107 
108 
109  }// end of eta bins
110 
111 
112 
113 }
114 //------------------------
115 TPad *makeTitle(TCanvas *c,char *core, int page) {
116  c->Range(0,0,1,1);
117  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
118  pad0->Draw();
119  pad0->cd();
120 
121  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
122  pt->Draw();
123  TDatime dt;
124  TString txt2=core;
125  txt2+=", page=";
126  txt2+=page;
127  txt2+=", ";
128  txt2+=dt.AsString();
129  pt->AddText(txt2);
130  txt2="--";
131  pt->AddText(txt2);
132 
133  c->cd();
134  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
135  pad->Draw();
136  return pad;
137 }
138