StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plZana.C
1 TCanvas *can=0;
2 
3 //=================================================
4 plZana( int page=3,int pl=0, char *core0="R10096140", char *iPath="", char *oPath=""){ //1=gif, 2=ps, 3=both
5  iPath="./";
6  iPath="/star/data05/scratch/balewski/2009-Wana-SL09g-feb24/data/";
7  //iPath="/star/data05/scratch/stevens4/wAnalysisOut/apsXsec/rcfMC/";
8  core0="run9setP1234";
9  //core0="rcf10014";;
10  //core0="mcSetD1_ppWprod";
11  //core0="mcSetD2_ppQCD10_inf_filter";
12  //core0="mcSetD1_ppZprod";
13 
14  if(page==0) {
15  doAll();
16  return;
17  }
18 
19 
20  char *nameA[]={"_Z_EventType"}; //pg 1
21  char *nameB[]={"_Z_et1iso","_Z_et1val","_Z_et1frac","_Z_et2iso","_Z_et2val","_Z_et2frac"}; //pg 2
22  char *nameC[]={"_Z_phi12","_Z_ZmassLike","_Z_chRecPNp","_Z_ZmassUnlike"};
23  char *nameD[]={"muEne_Deta","_Z_Ene_Deta"};// pg 4
24 
25  gStyle->SetOptFit(1);
26  TString fullInpName=iPath; fullInpName+=core0;
27  fullInpName+=".wana.hist.root";
28  fd=new TFile(fullInpName);
29  if(! fd->IsOpen()) {
30  printf("EROR: input histo file not found, quit\n",fullInpName.Data());
31  return;
32  } else {
33  printf("Opened: %s\n",fullInpName.Data());
34  }
35  if(page==1){
36  fd->ls();
37  h0=(TH1*)fd->Get("_Z_EventType"); assert(h0);
38  printf("%s: ",h0->GetName());
39  for(int k=1;k<=14;k++) printf("%.0f, ",h0->GetBinContent(k));
40  printf("\n");
41  }
42  gStyle->SetPalette(1,0);
43  gStyle->SetOptStat(0);
44  char padTit[1000];
45  sprintf(padTit,"%s",core0);
46 
47  switch (page) {
48 
49  case 1:{
50  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
51  c->Divide(1,1);gStyle->SetOptStat(0);
52  char **nameX=nameA;
53  for(int i=0;i<1;i++) {
54  char txt[100];
55  printf("->%s<\n",nameX[i]);
56  h=(TH1*)fd->Get(nameX[i]); assert(h);
57  c->cd(i+1); h->Draw();
58  if(i==0) h->Draw("h text");
59  }
60  c->GetPad(1)->SetLogy();
61 
62  } break;//--------------------------------------
63 
64  case 2:{
65  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
66  c->Divide(3,2);gStyle->SetOptStat(1110);
67  char **nameX=nameB;
68  for(int i=0;i<6;i++) {
69  char txt[100];
70  printf("->%s<\n",nameX[i]);
71  h=(TH1*)fd->Get(nameX[i]); assert(h);
72  c->cd(i+1); h->Draw();
73  }
74  c->GetPad(2)->SetLogy();
75 
76  } break;//--------------------------------------
77 
78 
79  case 3:{
80  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
81  //can->SetGrayscale();
82  c->Divide(2,2);gStyle->SetOptStat(10);
83  char **nameX=nameC;
84  for(int i=0;i<4;i++) {
85  char txt[100];
86  printf("->%s<\n",nameX[i]);
87  h=(TH1*)fd->Get(nameX[i]); assert(h);
88  c->cd(i+1); h->Draw();
89  if(i==2) {
90  h2=(TH2F*) h;
91  h2->Rebin2D(2,2);h2->SetMaximum(3);
92  h2->Draw("box"); h2->SetFillColor(kBlack);
93  h3=(TH2F*)pubchRecPNp; h3->Rebin2D(2,2);
94  h3->Draw("colz same");
95  h2->Draw("box same");
96  }
97  if(i==3) {
98  //h->SetFillColor(kYellow);
99  h->SetAxisRange(0,130);
100  h->Fit("gaus","","RH",75.,115.);
101  }
102  }
103 
104 
105  } break;//--------------------------------------
106 
107  case 4:{
108  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
109  c->Divide(1,2);gStyle->SetOptStat(1110);
110  char **nameX=nameD;
111  for(int i=0;i<2;i++) {
112  char txt[100];
113  printf("->%s<\n",nameX[i]);
114  h2=(TH2F*)fd->Get(nameX[i]); assert(h2);
115  h2->Rebin2D(2,2);
116  c->cd(i+1); h2->Draw("colz");
117  }
118 
119 
120  } break;//--------------------------------------
121 
122  default:
123  printf("page=%d NOT defined\n",page);
124 
125  }
126 
127  char text[100];
128  sprintf(text,"%s%s_page%03d",oPath,core0,page);
129  TString tit=text;
130  can->SetTitle(tit);
131  can->SetName(tit);
132 
133 
134  if(pl&1) can->Print(tit+".gif");
135  if(pl&2) can->Print(tit+".ps");
136 
137 }
138 
139 //------------------------
140 void splitPadX(float x, TPad **cL, TPad **cR) {
141  (*cL) = new TPad("padL", "apdL",0.0,0.,x,0.95);
142  (*cL)->Draw();
143  (*cR) = new TPad("padL", "apdL",x+0.005,0.,1.0,0.95);
144  (*cR)->Draw();
145 }
146 
147 //------------------------
148 TPad *makeTitle(TCanvas *c,char *core, int page) {
149  c->Range(0,0,1,1);
150  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
151  pad0->Draw();
152  pad0->cd();
153 
154  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
155  pt->Draw();
156  TDatime dt;
157  TString txt2=core;
158  txt2+=", page=";
159  txt2+=page;
160  txt2+=", ";
161  txt2+=dt.AsString();
162  pt->AddText(txt2);
163  txt2="--";
164  pt->AddText(txt2);
165 
166  c->cd();
167  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
168  pad->Draw();
169  return pad;
170 }
171 
172 //============================
173 void doAll(){
174  for(int i=1;i<=4;i++) {
175  plZana(i,2);
176  }
177 }
178 
179 
180 
181 
182 // $Log: plZana.C,v $
183 // Revision 1.8 2010/03/14 22:50:34 balewski
184 // *** empty log message ***
185 //
186 // Revision 1.7 2010/02/04 03:48:25 balewski
187 // add ET for lumi monitor
188 //
189 // Revision 1.6 2010/01/10 03:01:39 balewski
190 // cleanup & nicer histos
191 //
192 // Revision 1.5 2010/01/06 14:11:17 balewski
193 // one Z-plot added
194 //
195 // Revision 1.4 2010/01/06 05:21:59 balewski
196 // cleanup
197 //
198 // Revision 1.3 2010/01/06 04:22:18 balewski
199 // added Q/PT plot for Zs, more cleanup
200 //
201 // Revision 1.2 2010/01/05 03:23:02 balewski
202 // change logic for filling btow status tables, added printout to Z-code
203 //
204 // Revision 1.1 2010/01/04 05:12:02 balewski
205 // added 4x4 cut to Z-algo, cleanup
206 //
207 // Revision 1.3 2009/12/30 18:37:08 balewski
208 // code tagged in the form close to that used for the Fall 2009 DNP preliminary Jacobian peak
209 //
210 // Revision 1.2 2009/12/08 16:53:01 balewski
211 // *** empty log message ***
212 //
213 // Revision 1.1 2009/11/23 23:00:20 balewski
214 // code moved spin-pool
215 //