StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
t0_opt.C
1 // $Id: t0_opt.C,v 1.3 2008/05/16 18:36:57 jcs Exp $
2 //
3 // $Log: t0_opt.C,v $
4 // Revision 1.3 2008/05/16 18:36:57 jcs
5 // update FTPC calibration macros
6 //
7 // Revision 1.2 2006/03/15 15:14:06 jcs
8 // add lines for listing CVS update info
9 //
10 
11 float calc_min(float b1,float b2)
12 {
13  return -b1/(2*b2);
14 }
15 
16 // bf = 0 or bf = 1
17 void t0_opt(int bf)
18 {
19  TCanvas *c1 = new TCanvas("c1","ps",200,10,700,500);
20  //c1->Divide(2,2);
21  TStyle *plain = new TStyle("Plain","Plain Style (no colors/fill areas)");
22  plain->SetTitleOffset(1.25);
23  plain->SetCanvasBorderMode(0);
24  plain->SetPadBorderMode(0);
25  plain->SetPadColor(0);
26  plain->SetCanvasColor(0);
27  plain->SetTitleColor(0);
28  plain->SetStatColor(0);
29  plain->SetPalette(1);
30  plain->SetOptStat(0000000);
31  plain->SetOptFit(00000000);
32 
33  //hvrad->DrawCopy();
34  TH2F *hr = new TH2F("hr","",10,-0.1,0.7,10,0.005,0.03);
35  hr->SetOptStat(0);
36  hr->SetTitle("#sigma_{res} vs. t_{0}");
37  hr->GetYaxis()->SetTitleOffset(1.2);
38  hr->GetYaxis()->SetTitle("#sigma_{res}");
39  hr->GetXaxis()->SetTitleOffset(1.2);
40  hr->GetXaxis()->SetTitle("t_{0}");
41  hr->DrawCopy();
42  //
43 
44 
45  // B=0 !!!
46  if ( bf==0)
47  {
48  Double_t t0[6] = { 0.1, 0.2,0.3,0.4,0.5,0.6};
49  Double_t resphi[6] = {0.01383,0.01184,0.009826,0.01083,0.01498,0.01891 };
50  Double_t resrad[6] = {0.01922,0.01802,0.01607,0.01665,0.02196,0.02338};
51  }
52  else
53  {
54  // B=1 !!!!
55  Double_t t0[6] = { 0, 0.1, 0.2,0.3,0.4,0.5};
56  Double_t resphi[6] = {0.0239,0.0223,0.021,0.02033,0.01999,0.02347};
57  Double_t resrad[6] = {0.021,0.0178,0.01645,0.01656,0.01895,0.0211};
58  }
59 
60  //TF1 *g=new TF1("g","[0]*1/x^[1]",0,30);
61  //gerad->Fit("g","R");
62 
63  //TGraph *gerad = new TGraph(6,t0,resrad);
64  TF1 *g=new TF1("g","pol2",-0.1,0.7);
65  g->SetLineColor(2);
66 
67  TGraph *gerad = new TGraph(6,t0,resphi);
68  gerad->SetMarkerStyle(22);
69  gerad->SetMarkerColor(2);
70  gerad->SetMarkerSize(1);
71  gerad->Draw("P");
72  gerad->Fit(g,"RQ");
73 
74  cout<<"Min phi = "<<calc_min(g->GetParameter(1),g->GetParameter(2))<<endl;
75 
76  TGraph *gerad1 = new TGraph(6,t0,resrad);
77  gerad1->SetMarkerStyle(23);
78  gerad1->SetMarkerColor(3);
79  gerad1->SetMarkerSize(1);
80  gerad1->Draw("P");
81 
82  g->SetLineColor(3);
83  gerad1->Fit(g,"RQ");
84 
85  cout<<"Min rad = "<<calc_min(g->GetParameter(1),g->GetParameter(2))<<endl;
86 
87  leg = new TLegend(0.46,0.72,0.72,0.86);
88  leg->SetTextSize(0.05);
89  leg->AddEntry(gerad,"#sigma_{res,#phi}","P");
90  leg->AddEntry(gerad1,"#sigma_{res,r}","P");
91  //leg->AddEntry(gerad2,"scope","P");
92  //leg->AddEntry(gerad1,"52.25/47.75 halffield","P");
93  //leg->AddEntry(gerad2,"53/47 halffield","P");
94  //leg->AddEntry(steppurgegasno,"purge modus fieldoff 53%/47%","l");
95  leg->SetFillColor(0);
96  leg->Draw();
97 
98  c1->Update();
99 
100 }