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=0,int pl=2, char *core0="run12long", char *iPath="../9.10.12/", char *oPath="./out/z/"){ //1=gif, 2=ps, 3=both
5  //core0="jba322";
6  if(page==0) {
7  doAll(core0,iPath);
8  return;
9  }
10 
11 
12  char *nameA[]={"_Z_EventType"}; //pg 1
13  char *nameB[]={"_Z_et1iso","_Z_et1val","_Z_et1frac","_Z_et2iso","_Z_et2val","_Z_et2frac"}; //pg 2
14  char *nameC[]={"_Z_phi12","_Z_ZmassLike","_Z_chRecPNp","_Z_ZmassUnlike"};
15  char *nameD[]={"muEne_Deta","_Z_Ene_Deta"};// pg 4
16 
17  char *nameE[]={"_Z_Endcap_EventType","_Z_Y2","_Z_etaZ"}; //pg 5
18  char *nameF[]={"_Z_Eet1iso","_Z_Eet1val","_Z_Eet1frac","_Z_Eet2iso","_Z_Eet2val","_Z_Eet2frac"}; //pg 6
19  char *nameG[]={"_Z_Ephi12","_Z_ELike_chRecPNp","_Z_E_ZmassLike","_Z_Eeta12","_Z_EUnlike_chRecPNp","_Z_E_ZmassUnlike"} //pg7
20 
21  gStyle->SetOptFit(1);
22  TString fullInpName=iPath; fullInpName+=core0;
23  fullInpName+=".wana.hist.root";
24  fd=new TFile(fullInpName);
25  if(! fd->IsOpen()) {
26  printf("EROR: input histo file not found, quit\n",fullInpName.Data());
27  return;
28  } else {
29  printf("Opened: %s\n",fullInpName.Data());
30  }
31 
32  //switch to TDirectory for eta binning
33  if(fd->Get("muStatEve")==0)
34  fd->cd("Z");
35 
36  if(page==1){
37  //fd->ls();
38  h0=(TH1*)gDirectory->Get("_Z_EventType"); assert(h0);
39  printf("%s: ",h0->GetName());
40  for(int k=1;k<=14;k++) printf("%.0f, ",h0->GetBinContent(k));
41  printf("\n");
42  }
43  gStyle->SetPalette(1,0);
44  gStyle->SetOptStat(0);
45  char padTit[1000];
46  sprintf(padTit,"%s",core0);
47 
48  switch (page) {
49 
50  case 1:{
51  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
52  c->Divide(1,1);gStyle->SetOptStat(0);
53  char **nameX=nameA;
54  for(int i=0;i<1;i++) {
55  char txt[100];
56  printf("->%s<\n",nameX[i]);
57  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
58  c->cd(i+1); h->Draw();
59  if(i==0) h->Draw("h text");
60  }
61  c->GetPad(1)->SetLogy();
62 
63  } break;//--------------------------------------
64 
65  case 2:{
66  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
67  c->Divide(3,2);gStyle->SetOptStat(1110);
68  char **nameX=nameB;
69  for(int i=0;i<6;i++) {
70  char txt[100];
71  printf("->%s<\n",nameX[i]);
72  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
73  c->cd(i+1); h->Draw();
74  }
75  c->GetPad(2)->SetLogy();
76 
77  } break;//--------------------------------------
78 
79 
80  case 3:{
81  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
82  //can->SetGrayscale();
83  c->Divide(2,2);gStyle->SetOptStat(10);
84  char **nameX=nameC;
85  for(int i=0;i<4;i++) {
86  char txt[100];
87  printf("->%s<\n",nameX[i]);
88  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
89  c->cd(i+1); h->Draw();
90  if(i==2) {
91  h2=(TH2F*) h;
92  h2->Rebin2D(2,2); //h2->SetMaximum(3);
93  h2->Draw("colz");
94  //h2->Draw("box"); h2->SetFillColor(kBlack);
95  //h3=(TH2F*)pubchRecPNp; h3->Rebin2D(2,2);
96  //h3->Draw("colz same");
97  //h2->Draw("box same");
98  }
99  if(i==3) {
100  //h->SetFillColor(kYellow);
101  //h->SetMaximum(4);
102  h->SetAxisRange(0,130);
103  //h->Fit("gaus","","RH",75.,115.);
104  }
105  }
106 
107 
108  } break;//--------------------------------------
109 
110  case 4:{
111  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
112  c->Divide(1,2);gStyle->SetOptStat(1110);
113  char **nameX=nameD;
114  for(int i=0;i<2;i++) {
115  char txt[100];
116  if(i==0) continue;
117  printf("->%s<\n",nameX[i]);
118  h2=(TH2F*)gDirectory->Get(nameX[i]); assert(h2);
119  h2->Rebin2D(2,2);
120  c->cd(i+1); h2->Draw("colz");
121  }
122 
123  } break;//--------------------------------------
124 
125  case 5:{
126  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
127  c->Divide(2,2);gStyle->SetOptStat(0);
128  char **nameX=nameE;
129  for(int i=0;i<3;i++) {
130  char txt[100];
131  printf("->%s<\n",nameX[i]);
132  h=(TH1*)gDirectory->Get(nameX[i]); //assert(h);
133  if(h==0) continue;
134  c->cd(i+1); h->Draw();
135  if(i<2) { h->Draw("h text");
136  h->SetMarkerSize(2); // for bigger text
137  }
138  if(i==2) { h->Rebin(8); h->Draw(); }
139 
140  }
141  c->GetPad(1)->SetLogy();
142 
143  } break;//--------------------------------------
144 
145  case 6:{
146  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
147  c->Divide(3,2);gStyle->SetOptStat(1110);
148  char **nameX=nameF;
149  for(int i=0;i<6;i++) {
150  char txt[100];
151  printf("->%s<\n",nameX[i]);
152  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
153  c->cd(i+1); h->Draw();
154  }
155  c->GetPad(2)->SetLogy();
156 
157  } break;//--------------------------------------
158 
159  case 7:{
160  can=new TCanvas("aa","aa",800,600); TPad *c=makeTitle(can,padTit,page);
161  //can->SetGrayscale();
162  c->Divide(3,2);gStyle->SetOptStat(10);
163  char **nameX=nameG;
164  for(int i=0;i<6;i++) {
165  char txt[100];
166  printf("->%s<\n",nameX[i]);
167  h=(TH1*)gDirectory->Get(nameX[i]); assert(h);
168  c->cd(i+1); h->Draw();
169  if(i==3) h->Draw("colz");
170  if(i==1 || i==4) {
171  h2=(TH2F*) h;
172  h2->Rebin2D(2,2); //h2->SetMaximum(3);
173  h2->Draw("colz");
174  //h2->Draw("box"); h2->SetFillColor(kBlack);
175  //h3=(TH2F*)pubchRecPNp; h3->Rebin2D(2,2);
176  //h3->Draw("colz same");
177  //h2->Draw("box same");
178  }
179  //if(i==3) {
180  //h->SetFillColor(kYellow);
181  //h->SetMaximum(4);
182  //h->SetAxisRange(0,130);
183  //h->Fit("gaus","","RH",75.,115.);
184  //}
185  }
186 
187 
188  } break;//--------------------------------------
189 
190 
191  default:
192  printf("page=%d NOT defined\n",page);
193 
194  }
195 
196  char text[100];
197  sprintf(text,"%s%s_page%03d",oPath,core0,page);
198  TString tit=text;
199  can->SetTitle(tit);
200  can->SetName(tit);
201 
202 
203  if(pl&1) can->Print(tit+".gif");
204  if(pl&2) can->Print(tit+".ps");
205 
206 }
207 
208 //------------------------
209 void splitPadX(float x, TPad **cL, TPad **cR) {
210  (*cL) = new TPad("padL", "apdL",0.0,0.,x,0.95);
211  (*cL)->Draw();
212  (*cR) = new TPad("padL", "apdL",x+0.005,0.,1.0,0.95);
213  (*cR)->Draw();
214 }
215 
216 //------------------------
217 TPad *makeTitle(TCanvas *c,char *core, int page) {
218  c->Range(0,0,1,1);
219  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
220  pad0->Draw();
221  pad0->cd();
222 
223  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
224  pt->Draw();
225  TDatime dt;
226  TString txt2=core;
227  txt2+=", page=";
228  txt2+=page;
229  txt2+=", ";
230  txt2+=dt.AsString();
231  pt->AddText(txt2);
232  txt2="--";
233  pt->AddText(txt2);
234 
235  c->cd();
236  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
237  pad->Draw();
238  return pad;
239 }
240 
241 //============================
242 void doAll(char *core0="", char *iPath=""){
243  for(int i=1;i<=7;i++) {
244  plZana(i,2,core0,iPath);
245  }
246 }
247 
248 
249 
250 
251 // $Log: plZana.C,v $
252 // Revision 1.6 2012/09/18 15:46:00 balewski
253 // added etaZ to movie
254 //
255 // Revision 1.5 2012/09/14 21:02:31 balewski
256 // *lumi-maker re-written to accumulate alternative rel lumi monitors,
257 // * added spin sorting to Zs
258 //
259 // Revision 1.4 2012/08/28 14:28:49 stevens4
260 // updates to movie makers
261 //
262 // Revision 1.3 2012/08/07 21:06:56 stevens4
263 // update to tree analysis to produce independent histos in a TDirectory for each eta-bin
264 //
265 // Revision 1.2 2012/06/22 17:36:57 stevens4
266 // *** empty log message ***
267 //
268 // Revision 1.1 2011/02/22 21:38:05 balewski
269 // First 100 Ws in run 11
270 //
271 // Revision 1.8 2010/03/14 22:50:34 balewski
272 // *** empty log message ***
273 //
274 // Revision 1.7 2010/02/04 03:48:25 balewski
275 // add ET for lumi monitor
276 //
277 // Revision 1.6 2010/01/10 03:01:39 balewski
278 // cleanup & nicer histos
279 //
280 // Revision 1.5 2010/01/06 14:11:17 balewski
281 // one Z-plot added
282 //
283 // Revision 1.4 2010/01/06 05:21:59 balewski
284 // cleanup
285 //
286 // Revision 1.3 2010/01/06 04:22:18 balewski
287 // added Q/PT plot for Zs, more cleanup
288 //
289 // Revision 1.2 2010/01/05 03:23:02 balewski
290 // change logic for filling btow status tables, added printout to Z-code
291 //
292 // Revision 1.1 2010/01/04 05:12:02 balewski
293 // added 4x4 cut to Z-algo, cleanup
294 //
295 // Revision 1.3 2009/12/30 18:37:08 balewski
296 // code tagged in the form close to that used for the Fall 2009 DNP preliminary Jacobian peak
297 //
298 // Revision 1.2 2009/12/08 16:53:01 balewski
299 // *** empty log message ***
300 //
301 // Revision 1.1 2009/11/23 23:00:20 balewski
302 // code moved spin-pool
303 //