StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plFgtSS.C
1 class TFile;
2 // FGT SlowSimu plots
3 TFile *fd=0;
4 plFgtSS( int page=1,char *core="d1",int pl=0){ //1=gif, 2=ps, 3=both
5  // core="R7098001a";
6  char *path="./";
7  TString fullInpName=path; fullInpName+=core;
8  fullInpName+=".fgt.hist.root";
9 
10  double seedThres=30;
11 
12  fd=new TFile(fullInpName);
13  if(! fd->IsOpen()) {
14  printf("EROR: input histo file not found, quit\n",fullInpName.Data());
15  return;
16  }
17  // fd->ls();
18  gStyle->SetPalette(1,0);
19 
20  char *nameA[]={"ss_inDE","ss_inDS","ss_inZ","ss_hitStat","ss_inXY","ss_cTof","ss_inR","ss_cPmag","ss_gXY1"};
21  char *nameB[]={"fr_pairEne","fr_nPrimPair", "fr_totEne","fr_nTotPair","fr_pathL","fr_avrTPath"};
22  char *nameC[]={"ss_hitStat","cl_Stat1D","ev_Stat1D"};
23 
24 
25  switch (page) {
26  case 1:{ // general stats from all disks
27  can=new TCanvas("aa","aa",800,500); TPad *c=makeTitle(can,core,page);
28  c->Divide(1,3);gStyle->SetOptStat(111111);
29  char **nameX=nameC;
30  for(int i=0;i<3;i++) {
31  printf("->%s<\n",nameX[i]);
32  h=(TH1*)fd->Get(nameX[i]); assert(h);
33  c->cd(i+1); h->Draw();
34  }
35  break;
36  }//--------------------------------------
37 
38 
39 
40  case 2:{ // g2t track properties
41  can=new TCanvas("aa","aa",800,700); TPad *c=makeTitle(can,core,page);
42  c->Divide(3,3);
43  char **nameX=nameA;
44  int i;
45  for(i=0;i<9;i++) {
46  printf("->%s<\n",nameX[i]);
47  h=(TH1*)fd->Get(nameX[i]); assert(h);
48  c->cd(i+1); h->Draw();
49  if(i==4|| i==8) h->Draw("colz");
50  if(i==3) if(h->GetEntries()>0) c->GetPad(1+i)->SetLogz();
51  }
52  break;
53  }//--------------------------------------
54 
55  case 3: { // EVENT: 2D digitalization
56  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
57  c->Divide(2,1);
58  c->cd(1);ss_inXY->Draw("colz");
59  c->cd(2);digXY->Draw("colz");
60  break;
61  }//--------------------------------------
62 
63  case 4: { // EVENT: zoom in of digXY
64  can=new TCanvas("aa","aa",400,420); TPad *c=makeTitle(can,core,page);
65  digXY->SetAxisRange(14.,15.,"x");
66  digXY->SetAxisRange(35.,36.,"y");
67  digXY->Draw("colz");
68  break;
69  }//--------------------------------------
70 
71  case 5: { // EVENT: projection on rad & phi strips
72  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
73  c->Divide(1,2);gStyle->SetOptStat(1001111);
74  c->cd(1);digRad->Draw();
75  c->cd(2);digPhi->Draw();
76  break;
77  }//--------------------------------------
78 
79  case 6:{ // properties of Frank's hit distribution generator
80  can=new TCanvas("aa","aa",800,500); TPad *c=makeTitle(can,core,page);
81  c->Divide(3,2);
82  char **nameX=nameB;
83  for(int i=0;i<6;i++) {
84  printf("->%s<\n",nameX[i]);
85  h=(TH1*)fd->Get(nameX[i]); assert(h);
86  c->cd(i+1); h->Draw();
87  if(i==5) { h->SetAxisRange(0,2);} //h->Fit("gaus");
88  }
89  break;
90  }//--------------------------------------
91 
92  case 7: { // R-cluster finder properties
93  can=new TCanvas("aa","aa",800,550); TPad *c=makeTitle(can,core,page);
94  c->Divide(3,2);gStyle->SetOptStat(111111);
95  c->cd(1);cl_RmxAmp->Draw();
96  cl_RmxAmp->Fit("landau","R","",seedThres,99999);
97  // c->cd(2);cl_rMul->Draw();
98  c->cd(2);cl_Rwid->Draw();
99  c->cd(4);cl_Rpf->Draw();
100  c->cd(5);//ev_errRad->Fit("gaus","R","",-80,80);//Draw();
101  ev_errRad->Rebin(3);
102  ev_errRad->Fit("gaus");
103  c->cd(6);ev_dRad_R->Draw("colz");
104  break;
105  }//--------------------------------------
106 
107 
108  case 8: { // Phi-cluster finder properties
109  can=new TCanvas("aa","aa",800,550); TPad *c=makeTitle(can,core,page);
110  c->Divide(3,2);gStyle->SetOptStat(111111);
111  c->cd(1);cl_PmxAmp->Draw();cl_PmxAmp->Fit("landau","R","",seedThres,99999);
112  // c->cd(2);cl_pMul->Draw();
113  c->cd(2);cl_Pwid->Draw();
114  c->cd(4);cl_Ppf->Draw(); // fr_Rdiff->Draw("colz");
115  c->cd(5);ev_RerrPhi->Fit("gaus","R","",-100,100);//->Draw();
116  c->cd(6);ev_RdPhi_R->Draw("colz");
117  break;
118  }//--------------------------------------
119 
120 
121  case 9: { // Rad vs. Phi-cluster finder properties
122  can=new TCanvas("aa","aa",500,280); TPad *c=makeTitle(can,core,page);
123  c->Divide(2,1);gStyle->SetOptStat(111111);
124  c->cd(1);cl_rpMul->Draw("colz");
125 
126  break;
127  }//--------------------------------------
128 
129 
130  case 10: { // Rad err vs. R
131  can=new TCanvas("aa","aa",800,420); TPad *c=makeTitle(can,core,page);
132  c->Divide(2,1);gStyle->SetOptStat(0);gStyle->SetOptFit(1);
133  int nReb=4;
134  c->cd(1);spreadFit(ev_dRad_R->RebinX(nReb,"dRreb"));
135  c->cd(2);spreadFit(ev_RdPhi_R->RebinX(nReb,"RdPreb"));
136  break;
137  }//--------------------------------------
138 
139 
140  case 101: { // tmp1
141  can=new TCanvas("aa","aa",1100,850); TPad *c=makeTitle(can,core,page);
142  c->Divide(3,2);gStyle->SetOptStat(111111);
143  c->cd(1);cl_rpMul->Draw("colz");
144  c->cd(4);ev_Stat1D->Draw(); ev_Stat1D->SetAxisRange(0,6);
145  float yy=ev_Stat1D->GetMaximum();
146  ev_Stat1D->SetMinimum(yy*.75);
147  c->cd(2);ev_errRad->Fit("gaus","R","",-200,200);//Draw();
148  c->cd(3);ev_dRad_R->Draw("colz");
149 
150  c->cd(5);ev_RerrPhi->Fit("gaus","R","",-60,60);//->Draw();
151  c->cd(6);ev_RdPhi_R->Draw("colz");
152 
153  break;
154  }//--------------------------------------
155 
156  case 102: { // tmp1
157  can=new TCanvas("aa","aa",500,280); TPad *c=makeTitle(can,core,page);
158  c->Divide(2,1);
159  c->cd(1);cl_RmxAmp->Fit("landau","R","",seedThres,99999);
160  c->cd(2);cl_PmxAmp->Fit("landau","R","",seedThres,99999);
161 
162  break;
163  }//--------------------------------------
164 
165  case 103: { // tmp1
166  can=new TCanvas("aa","aa",1100,400); TPad *c=makeTitle(can,core,page);
167  c->Divide(3,1);gStyle->SetOptStat(1111);
168  c->cd(1);ev_Stat1D->Draw(); ev_Stat1D->SetAxisRange(0,6);
169  float yy=ev_Stat1D->GetMaximum();
170  ev_Stat1D->SetMinimum(yy*.75);
171  c->cd(2);ev_errRad->Fit("gaus","R","",-200,200);//Draw();
172  c->cd(3);ev_RerrPhi->Fit("gaus","R","",-60,60);//->Draw();
173 
174  break;
175  }//--------------------------------------
176 
177  case 104: { // tmp1
178  can=new TCanvas("aa","aa",900,750); TPad *c=makeTitle(can,core,page);
179  c->Divide(3,2);gStyle->SetOptStat(1111);
180  c->cd(1);cl_RmxAmp->Fit("landau","R","",seedThres,99999);
181  c->cd(2);cl_Rpf->Draw();
182  c->cd(3);ev_errRad->Fit("gaus","R","",-200,200);
183 
184  c->cd(4);cl_PmxAmp->Fit("landau","R","",seedThres,99999);
185  c->cd(5);cl_Ppf->Draw();
186  c->cd(6);ev_RerrPhi->Fit("gaus","R","",-80,80);
187 
188  break;
189  }//--------------------------------------
190 
191  case 105: { // tmp1
192  can=new TCanvas("aa","aa",1100,800); TPad *c=makeTitle(can,core,page);
193  c->Divide(3,2);gStyle->SetOptStat(111111);
194  c->cd(4);ev_RokXY->Draw("colz"); // ev_RokXY->Rebin2D(2,2);
195 
196  c->cd(1);ev_Stat1D->Draw(); ev_Stat1D->SetAxisRange(0,6);
197  float yy=ev_Stat1D->GetMaximum();
198  ev_Stat1D->SetMinimum(yy*.75);
199 
200  int nReb=4;
201  c->cd(2);ev_RerrPhi->Fit("gaus","R","",-100,100);//->Draw();
202  // ev_RdPhi_R->RebinY(2);
203  c->cd(3);spreadFit(ev_RdPhi_R->RebinX(nReb,"RdPreb"),370);
204 
205  c->cd(5);ev_errRad->Fit("gaus","R","",-300,300);//Draw();
206  c->cd(6);spreadFit(ev_dRad_R->RebinX(nReb,"dRreb"),370);
207 
208  break;
209  }//--------------------------------------
210 
211 
212  default:
213  printf("page=%d NOT defined\n",page);
214 
215  }
216 
217  char text[100];
218  sprintf(text,"%s_page%03d",core,page);
219  TString tit=text;
220  can->SetTitle(tit);
221  can->SetName(tit);
222  // c->Clear();
223 
224  if(pl&1) can->Print(tit+".gif");
225  if(pl&2) can->Print(tit+".ps");
226 
227 }
228 
229 
230 //------------------------
231 TPad *makeTitle(TCanvas *c,char *core, int page) {
232 
233  c->Range(0,0,1,1);
234  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
235  pad0->Draw();
236  pad0->cd();
237 
238  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
239  pt->Draw();
240  TDatime dt;
241  TString txt2=core;
242  txt2+=", page=";
243  txt2+=page;
244  txt2+=", ";
245  txt2+=dt.AsString();
246  pt->AddText(txt2);
247  txt2="--";
248  pt->AddText(txt2);
249 
250  c->cd();
251  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
252  pad->Draw();
253  return pad;
254 }
255 
256 //============================
257 void doStat(char *name0, char *name3){
258  printf("->%s<\n",name0);
259  h0=(TH1*)fd->Get(name0); assert(h0);
260  int nEve=h0->GetEntries()/ h0->GetNbinsX();
261  printf("nEve=%d\n",nEve);
262 
263  h3=(TH1F*)fd->Get(name3); assert(h3);
264  int nb=h3->GetNbinsX();
265  int i,n=0,n1=0;
266  for(i=1; i<=nb;i++) {
267  float y=h3->GetBinContent(i);
268  if(y<=0) continue;
269  n++;
270  float r=y/nEve;
271  float er=sqrt(y)/nEve;
272  if(r>0.001){ printf("* "); n1++;}
273  else continue;
274  //intf(" ");
275 
276  printf(" HankCh=%d failProb=%.3f +/- %.3f\n", i-1,r,er);
277  }
278  printf("bigErr n1=%d n=%d\n",n1,n);
279 }
280 
281 //===================================
282 //==========================
283 //==========================
284 spreadFit( TH2* h2, double Ymx=370) {
285 
286  ln0=new TLine(0,0,450,0); ln0->SetLineColor(kBlack);ln0->SetLineWidth(2.);
287  ln0->SetLineStyle(2);
288  TString tt=h2->GetName();
289  h2->GetListOfFunctions()->Clear(); // drop strip contur
290  TString tt=h2->GetName();
291  h2->FitSlicesY();
292  TH1D*hd= (TH1D*)gROOT->FindObject(tt+"_1");
293  h2->SetAxisRange(-Ymx,Ymx,"y");
294 
295  hd->SetMarkerStyle(20);
296  h2->Draw("colz");
297  hd->Draw("same");
298 
299  //........ draw +/- 1 sig error band for projection
300  Stat_t er1[1000];
301  memset(er1,0,sizeof(er1));
302 
303  TH1D *he= (TH1D*)gROOT->FindObject(tt+"_2");
304  he->Fit("pol1","","same");
305 
306  TH1D *yu=(TH1D*) hd->Clone(); yu->SetLineColor(kMagenta);
307  yu->Add(he); yu->SetError(er1);yu->SetLineWidth(2.);
308  yu->Draw("same");
309 
310  TH1D *yd=(TH1D*) hd->Clone();
311  yd->Add(he,-1); yd->SetError(er1); yd->SetLineColor(kMagenta);
312  yd->Draw("same");yd->SetLineWidth(2.);
313  ln0->Draw();
314 
315 }
316 
317 
318 
319 plAll(char *core="d1") {
320  int i;
321  for(i=1; i<=3; i++) plFgtSS(i,core,2);
322  for(i=6; i<=10; i++) plFgtSS(i,core,2);
323  for(i=101; i<=105; i++) plFgtSS(i,core,2);
324 }
325 
326 /*
327  .L plSS.C
328  plAll("minb_d1r");
329  plAll("minb_d6r");
330  plAll("mu2_d1r");
331  plAll("mu2_d6r");
332 cat minb_d1r*ps |ps2pdf - >minb_d1r.pdf
333 cat minb_d6r*ps |ps2pdf - >minb_d6r.pdf
334 cat mu2_d1r*ps |ps2pdf - >mu2_d1r.pdf
335 cat mu2_d6r*ps |ps2pdf - >mu2_d6r.pdf
336 
337 
338 */