Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
twopi_primakoff.C
Go to the documentation of this file.
1 void twopi_primakoff(TString filename, Int_t maxev=100000)
2 {
3 // File: twopi_primakoff.C
4  // Output histograms and fits generated from amp fitting of parameters.
5 //
6 
7  gStyle->SetPalette(1,0);
8  gStyle->SetOptStat(111111);
9  gStyle->SetOptFit(111111);
10  gStyle->SetPadRightMargin(0.15);
11  gStyle->SetPadLeftMargin(0.15);
12  gStyle->SetPadBottomMargin(0.15);
13 
14  char string[256];
15  vector <TString> sdme;
16 
17  /*const Int_t nparms=8;
18  Double_t parms[nparms];
19  Double_t parms_err[nparms];*/
20  vector <double> parms;
21  vector <double> parms_err;
22 
23  bool setscale(true);
24 
25  // TString filename = "twopi_primakoff_gen";
26  // Double_t scale_factor=0.5; // divide ymax/scale_factor
27  // TString filename = "twopi_primakoff_DSelect";
28  // TString filename = "twopi_primakoff_DSelect_thrown_mod";
29  // TString filename = "twopi_primakoff_DSelect_thrown_mod2";
30  Double_t scale_factor=400000/(float)maxev; // divide ymax/scale_factor
31  cout << "Use scale_factor=" << scale_factor << " maxev=" << maxev << endl;
32 
33  TString infile = filename+".fit2"; // file with parameters
34  TFile *f = new TFile(filename+".root","read");
35 
36  cout << "Opening parameters file: " << infile.Data() << endl;
37  cout << "Opening root file: " << (filename+".root").Data() << endl;
38 
39 
40  TH1F *M2pigen = (TH1F*)f->Get("M2pigen");
41  TH1F *M2piacc = (TH1F*)f->Get("M2piacc");
42  TH1F *M2pidat = (TH1F*)f->Get("M2pidat");
43  TH1F *M2pibkgnd = (TH1F*)f->Get("M2pibkgnd");
44  TH1F *M2pidatsub = (TH1F*)M2pidat->Clone("M2pidatsub");
45  M2pidatsub->Add(M2pibkgnd,-1);
46 
47  TH1F *cosThetagen = (TH1F*)f->Get("cosThetagen");
48  TH1F *cosThetaacc = (TH1F*)f->Get("cosThetaacc");
49  TH1F *cosThetadat = (TH1F*)f->Get("cosThetadat");
50  TH1F *cosThetabkgnd = (TH1F*)f->Get("cosThetabkgnd");
51  TH1F *cosThetadatsub = (TH1F*)cosThetadat->Clone("cosThetadatsub");
52  cosThetadatsub->Add(cosThetabkgnd,-1);
53 
54  TH1F *psigen = (TH1F*)f->Get("psigen");
55  TH1F *psiacc = (TH1F*)f->Get("psiacc");
56  TH1F *psidat = (TH1F*)f->Get("psidat");
57  TH1F *psibkgnd = (TH1F*)f->Get("psibkgnd");
58  TH1F *psidatsub = (TH1F*)psidat->Clone("psidatsub");
59  psidatsub->Add(psibkgnd,-1);
60 
61  TH1F *Phigen = (TH1F*)f->Get("Phigen");
62  TH1F *Phiacc = (TH1F*)f->Get("Phiacc");
63  TH1F *Phidat = (TH1F*)f->Get("Phidat");
64  TH1F *Phibkgnd = (TH1F*)f->Get("Phibkgnd");
65  TH1F *Phidatsub = (TH1F*)Phidat->Clone("Phidatsub");
66  Phidatsub->Add(Phibkgnd,-1);
67 
68  TH1F *phigen = (TH1F*)f->Get("phigen");
69  TH1F *phiacc = (TH1F*)f->Get("phiacc");
70  TH1F *phidat = (TH1F*)f->Get("phidat");
71  TH1F *phibkgnd = (TH1F*)f->Get("phibkgnd");
72  TH1F *phidatsub = (TH1F*)phidat->Clone("phidatsub");
73  phidatsub->Add(phibkgnd,-1);
74 
75  TH1F *tgen = (TH1F*)f->Get("tgen");
76  TH1F *tacc = (TH1F*)f->Get("tacc");
77  TH1F *tdat = (TH1F*)f->Get("tdat");
78  TH1F *tbkgnd = (TH1F*)f->Get("tbkgnd");
79  TH1F *tdatsub = (TH1F*)tdat->Clone("tdatsub");
80  tdatsub->Add(tbkgnd,-1);
81 
82 
83  TCanvas *c0 = new TCanvas("c0", "c0",200,10,1000,700);
84 
85  c0->Divide(3,2);
86  c0->cd(1);
87  // gPad->SetLogy();
88  Double_t xmin = 0.2;
89  Double_t xmax = 0.8;
90  Double_t ymin = 0/scale_factor;
91  Double_t ymax = 4000/scale_factor;
92 
93  M2pigen->SetTitle(filename);
94  M2pigen->GetXaxis()->SetRangeUser(xmin,xmax);
95  M2pigen->GetYaxis()->SetRangeUser(ymin,ymax);
96  M2pigen->GetXaxis()->SetTitleSize(0.05);
97  M2pigen->GetYaxis()->SetTitleSize(0.05);
98  M2pigen->GetXaxis()->SetTitle("M(#pi^{+}#pi^{-})");
99  M2pigen->SetMarkerColor(4);
100  // M2piacc->Draw("samep");
101  M2pidat->SetMarkerColor(2);
102  M2pidat->SetLineColor(2);
103  M2pidat->SetMarkerStyle(20);
104  M2pidat->SetMarkerSize(0.1);
105  M2pibkgnd->SetMarkerStyle(20);
106  M2pibkgnd->SetMarkerSize(0.1);
107  M2pibkgnd->SetMarkerColor(1);
108  M2pibkgnd->SetLineColor(1);
109  M2pigen->Draw("p");
110  M2pidat->Draw("samep");
111  M2pibkgnd->Draw("samep");
112 
113  TLegend *leg = new TLegend(0.6,0.3,0.8,0.5);
114  leg->AddEntry(M2pigen,"Gen","lp");
115  leg->AddEntry(M2pibkgnd,"Bkgnd","lp");
116  leg->AddEntry(M2pidat,"Data","lp");
117  leg->Draw();
118 
119  c0->cd(2);
120  // gPad->SetLogy();
121  ymin = 0;
122  ymax = 10000/scale_factor;
123 
124  cosThetagen->SetTitle(filename);
125  // cosThetagen->GetXaxis()->SetRangeUser(xmin,xmax);
126  if (setscale) cosThetagen->GetYaxis()->SetRangeUser(ymin,ymax);
127  cosThetagen->GetXaxis()->SetTitleSize(0.05);
128  cosThetagen->GetYaxis()->SetTitleSize(0.05);
129  cosThetagen->GetXaxis()->SetTitle("cos(#theta)");
130  cosThetagen->SetLineColor(4);
131  cosThetagen->Draw("p");
132  // cosThetaacc->Draw("samep");
133  cosThetadat->SetMarkerColor(2);
134  cosThetadat->SetLineColor(2);
135  cosThetadat->SetMarkerStyle(20);
136  cosThetadat->SetMarkerSize(0.1);
137  cosThetabkgnd->SetMarkerStyle(20);
138  cosThetabkgnd->SetMarkerSize(0.1);
139  cosThetabkgnd->SetMarkerColor(1);
140  cosThetabkgnd->SetLineColor(1);
141  cosThetadat->Draw("samep");
142  cosThetabkgnd->Draw("samep");
143 
144  c0->cd(3);
145  // gPad->SetLogy();
146  ymin = 0;
147  ymax = 10000/scale_factor;
148 
149  TF1 *cos2phi = new TF1("cos2phi","[0]*(1+[1]*cos(2*x))",-3.14159,3.14159);
150  TF1 *cosphi = new TF1("cosphi","[0]+[1]*cos(x)",-3.14159,3.14159);
151 
152  psigen->SetTitle(filename);
153  // psigen->GetXaxis()->SetRangeUser(xmin,xmax);
154  if (setscale) psigen->GetYaxis()->SetRangeUser(ymin,ymax);
155  psigen->GetXaxis()->SetTitleSize(0.05);
156  psigen->GetYaxis()->SetTitleSize(0.05);
157  psigen->GetXaxis()->SetTitle("#psi");
158  psigen->SetMarkerColor(4);
159  psigen->Fit(cos2phi);
160  psigen->Draw("p");
161  // psiacc->Draw("samep");
162  psidat->SetMarkerColor(2);
163  psidat->SetLineColor(2);
164  psidat->SetMarkerStyle(20);
165  psidat->SetMarkerSize(0.1);
166  psibkgnd->SetMarkerStyle(20);
167  psibkgnd->SetMarkerSize(0.1);
168  psibkgnd->SetMarkerColor(1);
169  psibkgnd->SetLineColor(1);
170  psidat->Draw("samep");
171  psibkgnd->Draw("samep");
172 
173  c0->cd(4);
174  // gPad->SetLogy();
175  ymin = 0;
176  ymax = 8000/scale_factor;
177 
178  Phigen->SetTitle(filename);
179  // Phigen->GetXaxis()->SetRangeUser(xmin,xmax);
180  if (setscale) Phigen->GetYaxis()->SetRangeUser(ymin,ymax);
181  Phigen->GetXaxis()->SetTitleSize(0.05);
182  Phigen->GetYaxis()->SetTitleSize(0.05);
183  Phigen->GetXaxis()->SetTitle("#Phi");
184  Phigen->SetMarkerColor(4);
185  Phigen->Fit(cos2phi);
186  Phigen->Draw("p");
187  // Phiacc->Draw("samep");
188  Phidat->SetMarkerColor(2);
189  Phidat->SetLineColor(2);
190  Phidat->SetMarkerStyle(20);
191  Phidat->SetMarkerSize(0.1);
192  Phibkgnd->SetMarkerStyle(20);
193  Phibkgnd->SetMarkerSize(0.1);
194  Phibkgnd->SetMarkerColor(1);
195  Phibkgnd->SetLineColor(1);
196  Phidat->Draw("samep");
197  Phibkgnd->Draw("samep");
198 
199  c0->cd(5);
200  // gPad->SetLogy();
201  ymin = 0;
202  ymax = 8000/scale_factor;
203 
204  phigen->SetTitle(filename);
205  // phigen->GetXaxis()->SetRangeUser(xmin,xmax);
206  if (setscale) phigen->GetYaxis()->SetRangeUser(ymin,ymax);
207  phigen->GetXaxis()->SetTitleSize(0.05);
208  phigen->GetYaxis()->SetTitleSize(0.05);
209  phigen->GetXaxis()->SetTitle("#phi");
210  phigen->SetMarkerColor(4);
211  phigen->Fit(cosphi);
212  phigen->Draw("p");
213  // phiacc->Draw("samep");
214  phidat->SetMarkerColor(2);
215  phidat->SetLineColor(2);
216  phidat->SetMarkerStyle(20);
217  phidat->SetMarkerSize(0.1);
218  phibkgnd->SetMarkerStyle(20);
219  phibkgnd->SetMarkerSize(0.1);
220  phibkgnd->SetMarkerColor(1);
221  phibkgnd->SetLineColor(1);
222  phidat->Draw("samep");
223  phibkgnd->Draw("samep");
224 
225  c0->cd(6);
226  gPad->SetLogy(); // use gPad->SetLogy();
227  xmin = 0;
228  xmax = 0.012;
229  ymin = 100/scale_factor;
230  ymax = 400000/scale_factor;
231 
232  tdat->SetTitle(filename);
233  tdat->GetXaxis()->SetTitleSize(0.05);
234  tdat->GetYaxis()->SetTitleSize(0.05);
235  tdat->GetXaxis()->SetTitle("-t");
236  // tacc->Draw("samep");
237  tdat->GetXaxis()->SetRangeUser(xmin,xmax);
238  tdat->GetYaxis()->SetRangeUser(ymin,ymax);
239  tdat->SetMarkerColor(2);
240  tdat->SetLineColor(2);
241  tdat->SetMarkerStyle(20);
242  tdat->SetMarkerSize(0.1);
243  tdat->Fit("expo","","",0.002,0.01);
244  tdat->Draw("p");
245  tgen->SetMarkerColor(4);
246  tbkgnd->SetMarkerStyle(20);
247  tbkgnd->SetMarkerSize(0.1);
248  tbkgnd->SetMarkerColor(1);
249  tbkgnd->SetLineColor(1);
250  tgen->Draw("samep");
251  tbkgnd->Draw("samep");
252 
253 
254  TCanvas *c2 = new TCanvas("c2", "c2",200,10,1000,700);
255 
256  c2->Divide(3,2);
257  c2->cd(1);
258  // gPad->SetLogy();
259  ymin = 0;
260  ymax = 1.2;
261 
262  TH1F *M2piAcceptance = (TH1F*)M2piacc->Clone("M2piAcceptance");
263  M2piAcceptance->SetTitle("Acceptance");
264  // M2piAcceptance->GetXaxis()->SetRangeUser(xmin,xmax);
265  if (setscale) M2piAcceptance->GetYaxis()->SetRangeUser(ymin,ymax);
266  M2piAcceptance->Divide(M2pigen);
267  M2piAcceptance->GetXaxis()->SetTitleSize(0.05);
268  M2piAcceptance->GetYaxis()->SetTitleSize(0.05);
269  M2piAcceptance->GetXaxis()->SetTitle("M(#pi^{+}#pi^{-})");
270  M2piAcceptance->SetMarkerColor(4);
271  M2piAcceptance->Draw("p");
272 
273  c2->cd(2);
274  // gPad->SetLogy();
275  ymin = 0;
276  // ymax = 1.2;
277 
278  TH1F *cosThetaAcceptance = (TH1F*)cosThetaacc->Clone("cosThetaAcceptance");
279  cosThetaAcceptance->SetTitle("Acceptance");
280  // cosThetaAcceptance->GetXaxis()->SetRangeUser(xmin,xmax);
281  if (setscale) cosThetaAcceptance->GetYaxis()->SetRangeUser(ymin,ymax);
282  cosThetaAcceptance->Divide(cosThetagen);
283  cosThetaAcceptance->GetXaxis()->SetTitleSize(0.05);
284  cosThetaAcceptance->GetYaxis()->SetTitleSize(0.05);
285  cosThetaAcceptance->GetXaxis()->SetTitle("cos(#theta)");
286  cosThetaAcceptance->SetMarkerColor(4);
287  cosThetaAcceptance->Draw("p");
288 
289  c2->cd(3);
290  // gPad->SetLogy();
291  ymin = 0;
292  // ymax = 1.2;
293 
294  TH1F *psiAcceptance = (TH1F*)psiacc->Clone("psiAcceptance");
295  psiAcceptance->SetTitle("Acceptance");
296  // psiAcceptance->GetXaxis()->SetRangeUser(xmin,xmax);
297  if (setscale) psiAcceptance->GetYaxis()->SetRangeUser(ymin,ymax);
298  psiAcceptance->Divide(psigen);
299  psiAcceptance->GetXaxis()->SetTitleSize(0.05);
300  psiAcceptance->GetYaxis()->SetTitleSize(0.05);
301  psiAcceptance->GetXaxis()->SetTitle("#psi");
302  psiAcceptance->SetMarkerColor(4);
303  psiAcceptance->Draw("p");
304 
305  c2->cd(4);
306  // gPad->SetLogy();
307  ymin = 0;
308  // ymax = 1.2;
309 
310  TH1F *PhiAcceptance = (TH1F*)Phiacc->Clone("PhiAcceptance");
311  PhiAcceptance->SetTitle("Acceptance");
312  // PhiAcceptance->GetXaxis()->SetRangeUser(xmin,xmax);
313  if (setscale) PhiAcceptance->GetYaxis()->SetRangeUser(ymin,ymax);
314  PhiAcceptance->Divide(Phigen);
315  PhiAcceptance->GetXaxis()->SetTitleSize(0.05);
316  PhiAcceptance->GetYaxis()->SetTitleSize(0.05);
317  PhiAcceptance->GetXaxis()->SetTitle("#Phi");
318  PhiAcceptance->SetMarkerColor(4);
319  PhiAcceptance->Draw("p");
320 
321  c2->cd(5);
322  // gPad->SetLogy();
323  ymin = 0;
324  // ymax = 1.2;
325 
326  TH1F *phiAcceptance = (TH1F*)phiacc->Clone("phiAcceptance");
327  phiAcceptance->SetTitle("Acceptance");
328  // phiAcceptance->GetXaxis()->SetRangeUser(xmin,xmax);
329  if (setscale) phiAcceptance->GetYaxis()->SetRangeUser(ymin,ymax);
330  phiAcceptance->Divide(phigen);
331  phiAcceptance->GetXaxis()->SetTitleSize(0.05);
332  phiAcceptance->GetYaxis()->SetTitleSize(0.05);
333  phiAcceptance->GetXaxis()->SetTitle("#phi");
334  phiAcceptance->SetMarkerColor(4);
335  phiAcceptance->Draw("p");
336 
337  c2->cd(6);
338  // gPad->SetLogy();
339  ymin = 0;
340  // ymax = 1.2;
341  xmin = 0;
342  xmax = 0.012;
343 
344  TH1F *tAcceptance = (TH1F*)tacc->Clone("tAcceptance");
345  tAcceptance->SetTitle("Acceptance");
346  tAcceptance->GetXaxis()->SetRangeUser(xmin,xmax);
347  if (setscale) tAcceptance->GetYaxis()->SetRangeUser(ymin,ymax);
348  tAcceptance->Divide(tgen);
349  tAcceptance->GetXaxis()->SetTitleSize(0.05);
350  tAcceptance->GetYaxis()->SetTitleSize(0.05);
351  tAcceptance->GetXaxis()->SetTitle("-t");
352  tAcceptance->SetMarkerColor(4);
353  tAcceptance->Draw("p");
354 
355  TCanvas *c1 = new TCanvas("c1", "c1",200,10,1000,700);
356 
357  c1->Divide(3,2);
358  c1->cd(1);
359  // gPad->SetLogy();
360  ymin = 0/scale_factor;
361  ymax = 2000/scale_factor;
362 
363  M2piacc->SetTitle(filename);
364  M2piacc->GetXaxis()->SetRangeUser(xmin,xmax);
365  M2piacc->GetYaxis()->SetRangeUser(ymin,ymax);
366  M2piacc->GetXaxis()->SetTitleSize(0.05);
367  M2piacc->GetYaxis()->SetTitleSize(0.05);
368  M2piacc->GetXaxis()->SetTitle("M(#pi^{+}#pi^{-})");
369  M2piacc->SetMarkerColor(1);
370  M2piacc->SetLineColor(1);
371  // M2piacc->Draw("samep");
372  M2pidat->SetMarkerColor(2);
373  M2pidat->SetLineColor(2);
374  M2pidat->SetMarkerStyle(20);
375  M2pidat->SetMarkerSize(0.1);
376  M2pibkgnd->SetMarkerColor(4);
377  M2pibkgnd->SetLineColor(4);
378  M2pibkgnd->SetMarkerStyle(20);
379  M2pibkgnd->SetMarkerSize(0.1);
380  M2piacc->Draw("p");
381  M2pidat->Draw("samep");
382  M2pibkgnd->Draw("samep");
383 
384  TLegend *leg1 = new TLegend(0.6,0.3,0.8,0.5);
385  // leg1->AddEntry(M2pigen,"Gen","lp");
386  leg1->AddEntry(M2piacc,"Acc","lp");
387  leg1->AddEntry(M2pidat,"Data","lp");
388  leg1->Draw();
389 
390  c1->cd(2);
391  // gPad->SetLogy();
392  ymin = 0;
393  ymax = 4000/scale_factor;
394 
395  cosThetaacc->SetTitle(filename);
396  // cosThetaacc->GetXaxis()->SetRangeUser(xmin,xmax);
397  if (setscale) cosThetaacc->GetYaxis()->SetRangeUser(ymin,ymax);
398  cosThetaacc->GetXaxis()->SetTitleSize(0.05);
399  cosThetaacc->GetYaxis()->SetTitleSize(0.05);
400  cosThetaacc->GetXaxis()->SetTitle("cos(#theta)");
401  cosThetaacc->SetLineColor(1);
402  cosThetaacc->SetMarkerColor(1);
403  cosThetaacc->Draw("p");
404  // cosThetaacc->Draw("samep");
405  cosThetadat->SetMarkerColor(2);
406  cosThetadat->SetLineColor(2);
407  cosThetadat->SetMarkerStyle(20);
408  cosThetadat->SetMarkerSize(0.1);
409  cosThetabkgnd->SetMarkerColor(4);
410  cosThetabkgnd->SetLineColor(4);
411  cosThetabkgnd->SetMarkerStyle(20);
412  cosThetabkgnd->SetMarkerSize(0.1);
413  cosThetadat->Draw("samep");
414  cosThetabkgnd->Draw("samep");
415 
416  c1->cd(3);
417  // gPad->SetLogy();
418  ymin = 0;
419  ymax = 4000/scale_factor;
420 
421  psiacc->SetTitle(filename);
422  // psiacc->GetXaxis()->SetRangeUser(xmin,xmax);
423  if (setscale) psiacc->GetYaxis()->SetRangeUser(ymin,ymax);
424  psiacc->GetXaxis()->SetTitleSize(0.05);
425  psiacc->GetYaxis()->SetTitleSize(0.05);
426  psiacc->GetXaxis()->SetTitle("#psi");
427  psiacc->SetMarkerColor(1);
428  psiacc->SetLineColor(1);
429  psiacc->Fit(cos2phi);
430  psiacc->Draw("p");
431  // psiacc->Draw("samep");
432  psidat->SetMarkerColor(2);
433  psidat->SetLineColor(2);
434  psidat->SetMarkerStyle(20);
435  psidat->SetMarkerSize(0.1);
436  psibkgnd->SetMarkerColor(4);
437  psibkgnd->SetLineColor(4);
438  psibkgnd->SetMarkerStyle(20);
439  psibkgnd->SetMarkerSize(0.1);
440  psidat->Draw("samep");
441  psibkgnd->Draw("samep");
442 
443  c1->cd(4);
444  // gPad->SetLogy();
445  ymin = 0;
446  ymax = 4000/scale_factor;
447 
448  Phiacc->SetTitle(filename);
449  // Phiacc->GetXaxis()->SetRangeUser(xmin,xmax);
450  if (setscale) Phiacc->GetYaxis()->SetRangeUser(ymin,ymax);
451  Phiacc->GetXaxis()->SetTitleSize(0.05);
452  Phiacc->GetYaxis()->SetTitleSize(0.05);
453  Phiacc->GetXaxis()->SetTitle("#Phi");
454  Phiacc->SetMarkerColor(1);
455  Phiacc->SetLineColor(1);
456  Phiacc->Fit(cos2phi);
457  Phiacc->Draw("p");
458  // Phiacc->Draw("samep");
459  Phidat->SetMarkerColor(2);
460  Phidat->SetLineColor(2);
461  Phidat->SetMarkerStyle(20);
462  Phidat->SetMarkerSize(0.1);
463  Phibkgnd->SetMarkerColor(4);
464  Phibkgnd->SetLineColor(4);
465  Phibkgnd->SetMarkerStyle(20);
466  Phibkgnd->SetMarkerSize(0.1);
467  Phidat->Draw("samep");
468  Phibkgnd->Draw("samep");
469 
470 
471  c1->cd(5);
472  // gPad->SetLogy();
473  ymin = 0;
474  ymax = 4000/scale_factor;
475 
476  phiacc->SetTitle(filename);
477  // phiacc->GetXaxis()->SetRangeUser(xmin,xmax);
478  if (setscale) phiacc->GetYaxis()->SetRangeUser(ymin,ymax);
479  phiacc->GetXaxis()->SetTitleSize(0.05);
480  phiacc->GetYaxis()->SetTitleSize(0.05);
481  phiacc->GetXaxis()->SetTitle("#phi");
482  phiacc->SetMarkerColor(1);
483  phiacc->SetLineColor(1);
484  phiacc->Fit(cosphi);
485  phiacc->Draw("p");
486  // phiacc->Draw("samep");
487  phidat->SetMarkerColor(2);
488  phidat->SetLineColor(2);
489  phidat->SetMarkerStyle(20);
490  phidat->SetMarkerSize(0.1);
491  phibkgnd->SetMarkerColor(4);
492  phibkgnd->SetLineColor(4);
493  phibkgnd->SetMarkerStyle(20);
494  phibkgnd->SetMarkerSize(0.1);
495  phidat->Draw("samep");
496  phibkgnd->Draw("samep");
497 
498  c1->cd(6);
499  gPad->SetLogy(); // use gPad->SetLogy();
500  xmin = 0;
501  xmax = 0.012;
502  ymin = 10/scale_factor;
503  ymax = 400000/scale_factor;
504 
505  tdat->SetTitle(filename);
506  tdat->GetXaxis()->SetTitleSize(0.05);
507  tdat->GetYaxis()->SetTitleSize(0.05);
508  tdat->GetXaxis()->SetTitle("-t");
509  // tacc->Draw("samep");
510  tdat->GetXaxis()->SetRangeUser(xmin,xmax);
511  tdat->GetYaxis()->SetRangeUser(ymin,ymax);
512  tdat->SetMarkerColor(2);
513  tdat->SetLineColor(2);
514  tdat->SetMarkerStyle(20);
515  tdat->SetMarkerSize(0.1);
516  tdat->Draw("p");
517  tacc->SetMarkerColor(1);
518  tacc->SetLineColor(1);
519  tbkgnd->SetMarkerColor(4);
520  tbkgnd->SetLineColor(4);
521  tbkgnd->SetMarkerStyle(20);
522  tbkgnd->SetMarkerSize(0.1);
523  tacc->Draw("samep");
524  tbkgnd->Draw("samep");
525 
526  TCanvas *c3 = new TCanvas("c3", "c3",200,10,1000,700);
527 
528  c3->Divide(3,2);
529  c3->cd(1);
530  // gPad->SetLogy();
531  ymin = 100;
532  ymax = 10000/scale_factor;
533 
534  M2piacc->SetTitle(filename);
535  // M2piacc->GetXaxis()->SetRangeUser(xmin,xmax);
536  // M2piacc->GetYaxis()->SetRangeUser(ymin,ymax);
537  M2piacc->GetXaxis()->SetTitleSize(0.05);
538  M2piacc->GetYaxis()->SetTitleSize(0.05);
539  M2piacc->GetXaxis()->SetTitle("M(#pi^{+}#pi^{-})");
540  M2piacc->SetMarkerColor(1);
541  // M2piacc->Draw("samep");
542  M2pidatsub->SetMarkerColor(2);
543  M2pidatsub->SetLineColor(2);
544  M2pidatsub->SetMarkerStyle(20);
545  M2pidatsub->SetMarkerSize(0.1);
546  M2piacc->Draw("p");
547  M2pidatsub->Draw("samep");
548 
549  c3->cd(2);
550  // gPad->SetLogy();
551  ymin = 0;
552  ymax = 4000/scale_factor;
553 
554  cosThetaacc->SetTitle(filename);
555  // cosThetaacc->GetXaxis()->SetRangeUser(xmin,xmax);
556  if (setscale) cosThetaacc->GetYaxis()->SetRangeUser(ymin,ymax);
557  cosThetaacc->GetXaxis()->SetTitleSize(0.05);
558  cosThetaacc->GetYaxis()->SetTitleSize(0.05);
559  cosThetaacc->GetXaxis()->SetTitle("cos(#theta)");
560  cosThetaacc->SetLineColor(1);
561  cosThetaacc->Draw("p");
562  // cosThetaacc->Draw("samep");
563  cosThetadatsub->SetMarkerColor(2);
564  cosThetadatsub->SetLineColor(2);
565  cosThetadatsub->SetMarkerStyle(20);
566  cosThetadatsub->SetMarkerSize(0.1);
567  cosThetadatsub->Draw("samep");
568 
569  c3->cd(3);
570  // gPad->SetLogy();
571  ymin = 0;
572  ymax = 4000/scale_factor;
573 
574  // TF1 *cos2phi = new TF1("cos2phi","[0]*(1+[1]*cos(2*x))",-3.14159,3.14159);
575 
576  Phiacc->SetTitle(filename);
577  // Phiacc->GetXaxis()->SetRangeUser(xmin,xmax);
578  if (setscale) Phiacc->GetYaxis()->SetRangeUser(ymin,ymax);
579  Phiacc->GetXaxis()->SetTitleSize(0.05);
580  Phiacc->GetYaxis()->SetTitleSize(0.05);
581  Phiacc->GetXaxis()->SetTitle("#Phi");
582  Phiacc->SetMarkerColor(1);
583  Phiacc->Fit(cos2phi);
584  Phiacc->Draw("p");
585  // Phiacc->Draw("samep");
586  Phidatsub->SetMarkerColor(2);
587  Phidatsub->SetLineColor(2);
588  Phidatsub->SetMarkerStyle(20);
589  Phidatsub->SetMarkerSize(0.1);
590  Phidatsub->Draw("samep");
591 
592 
593  c3->cd(4);
594 
595 
596  ymin = 0;
597  ymax = 4000/scale_factor;
598 
599  psiacc->SetTitle(filename);
600  // psiacc->GetXaxis()->SetRangeUser(xmin,xmax);
601  if (setscale) psiacc->GetYaxis()->SetRangeUser(ymin,ymax);
602  psiacc->GetXaxis()->SetTitleSize(0.05);
603  psiacc->GetYaxis()->SetTitleSize(0.05);
604  psiacc->GetXaxis()->SetTitle("#psi");
605  psiacc->SetMarkerColor(1);
606  psiacc->Fit(cos2phi);
607  psiacc->Draw("p");
608  // psiacc->Draw("samep");
609  psidatsub->SetMarkerColor(2);
610  psidatsub->SetLineColor(2);
611  psidatsub->SetMarkerStyle(20);
612  psidatsub->SetMarkerSize(0.1);
613  psidatsub->Draw("samep");
614 
615 
616  c3->cd(5);
617  // gPad->SetLogy();
618  ymin = 0;
619  ymax = 4000/scale_factor;
620 
621  phiacc->SetTitle(filename);
622  // phiacc->GetXaxis()->SetRangeUser(xmin,xmax);
623  if (setscale) phiacc->GetYaxis()->SetRangeUser(ymin,ymax);
624  phiacc->GetXaxis()->SetTitleSize(0.05);
625  phiacc->GetYaxis()->SetTitleSize(0.05);
626  phiacc->GetXaxis()->SetTitle("#phi");
627  phiacc->SetMarkerColor(1);
628  phiacc->SetLineColor(1);
629  phiacc->Fit(cosphi);
630  phiacc->Draw("p");
631  // phiacc->Draw("samep");
632  phidatsub->SetMarkerColor(2);
633  phidatsub->SetLineColor(2);
634  phidatsub->SetMarkerStyle(20);
635  phidatsub->SetMarkerSize(0.1);
636  phidatsub->Draw("samep");
637 
638  c3->cd(6);
639 
640  // now read and print fitted values
641 
642  ifstream parameters;
643  parameters.open (infile.Data());
644  if (!parameters) {
645  cout << "ERROR: Failed to open data file= " << infile.Data() << endl;
646  return;
647  }
648 
649  TString line;
650  while (line.ReadLine(parameters)){
651 
652  TObjArray *tokens = line.Tokenize("\t");
653  Int_t ntokens = tokens->GetEntries();
654 
655  cout << " ntokens=" << ntokens << " line=" << line.Data() << endl;
656  Int_t jmax=ntokens/3;
657  for (Int_t j=0; j<jmax; j++){
658  sdme.push_back( (((TObjString*)tokens->At(3*j))->GetString()) );
659  parms.push_back( (((TObjString*)tokens->At(3*j+1))->GetString()).Atof() );
660  parms_err.push_back( (((TObjString*)tokens->At(3*j+2))->GetString()).Atof());
661  }
662 
663  } // end loop over lines
664 
665  sprintf (string,"AmpTool Fit\n");
666  printf("string=%s",string);
667  TLatex *t1 = new TLatex(0.2,0.85,string);
668  t1->SetNDC();
669  t1->SetTextSize(0.04);
670  t1->Draw();
671 
672  for (Int_t j=0; j<sdme.size()-2; j++) { // -2 to eliminate Sigma and P
673  cout << sdme[j] << "=" << parms[j] << " err=" << parms_err[j] << endl;
674 
675  TString sdmename;
676  sdmename = sdme[j];
677  sprintf (string,"%s = \t%.3f #pm %.3f\n",sdmename.Data(),parms[j],parms_err[j]);
678  printf("string=%s",string);
679  TLatex *t1 = new TLatex(0.2,0.75 - 0.05*j,string);
680  t1->SetNDC();
681  t1->SetTextSize(0.04);
682  t1->Draw();
683  }
684 
685 
686  parameters.close();
687 
688 
689  c0->SaveAs(filename+".pdf(");
690  c1->SaveAs(filename+".pdf");
691  c2->SaveAs(filename+".pdf");
692  c3->SaveAs(filename+".pdf)");
693 }
Double_t c0[2][NMODULES]
Definition: tw_corr.C:67
void twopi_primakoff(TString filename, Int_t maxev=100000)
sprintf(text,"Post KinFit Cut")
TString filename
TFile * infile
Definition: tw_corr.C:45
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TF1 * f
Definition: FitGains.C:21
TLegend * leg
Definition: DIRC_digihit.C:58
Double_t c2[2][NMODULES]
Definition: tw_corr.C:69
TLatex * t1
Double_t ymin
Definition: bcal_hist_eff.C:89
Double_t ymax
Definition: bcal_hist_eff.C:91
TCanvas * c3
printf("string=%s", string)