1 void divideGraphWithFunction(TGraphErrors *graph,TF1 *func)
3 for(
int i=0;i<graph->GetN();i++){
6 graph->GetPoint(i,x,y);
7 double ey=graph->GetErrorY(i);
8 graph->SetPoint(i,x,y/func->Eval(x));
9 graph->SetPointError(i,0.,ey/func->Eval(x));
12 void divideGraphs(TGraphErrors *g1,TGraphErrors *g2)
14 for(
int i=0;i<g1->GetN();i++){
29 double eyn=(ey*ey/(y*y) + ey2*ey2/(y2*y2));
32 g1->SetPoint(i,xn,yn);
33 g1->SetPointError(i,exn,eyn);
37 void doYieldError(
char *nom,
char *left,
char *right,
char *mid)
39 TF1 *err_mb_hi=
new TF1(
"err_mb_hi",
"0.035",1.,5.);
40 TF1 *err_mb_lo=
new TF1(
"err_mb_hi",
"-0.035",1.,5.);
41 TF1 *err_ht_hi=
new TF1(
"err_mb_hi",
"0.05",4.,15.);
42 TF1 *err_ht_lo=
new TF1(
"err_mb_hi",
"-0.05",4.,15.);
50 TFile *f_nom=
new TFile(nom,
"OPEN");
51 TCanvas *c_nom=f_nom->Get(
"compare");
57 p_c=(TPad*)gPad->FindObject(
"padt");
60 TMultiGraph *m_nom=gPad->FindObject(
"m_pions")->Clone();
61 TGraphErrors *mb_nom=m_nom->GetListOfGraphs()->At(i_mb)->Clone();
62 mb_nom->SetName(
"mb_nom");
63 TGraphErrors *ht1_nom=m_nom->GetListOfGraphs()->At(i_ht1)->Clone();
64 ht1_nom->SetName(
"ht1_nom");
65 TGraphErrors *ht2_nom=m_nom->GetListOfGraphs()->At(i_ht2)->Clone();
66 ht2_nom->SetName(
"ht2_nom");
71 TFile *f_left=
new TFile(left,
"OPEN");
72 TCanvas *c_left=f_left->Get(
"compare");
75 p_c=(TPad*)gPad->FindObject(
"padt");
78 TMultiGraph *m_left=gPad->FindObject(
"m_pions")->Clone();
79 TGraphErrors *mb_left=m_left->GetListOfGraphs()->At(i_mb)->Clone();
80 mb_left->SetName(
"mb_left");
81 TGraphErrors *ht1_left=m_left->GetListOfGraphs()->At(i_ht1)->Clone();
82 ht1_left->SetName(
"ht1_left");
83 TGraphErrors *ht2_left=m_left->GetListOfGraphs()->At(i_ht2)->Clone();
84 ht2_left->SetName(
"ht2_left");
89 TFile *f_right=
new TFile(right,
"OPEN");
90 TCanvas *c_right=f_right->Get(
"compare");
93 p_c=(TPad*)gPad->FindObject(
"padt");
96 TMultiGraph *m_right=gPad->FindObject(
"m_pions")->Clone();
97 TGraphErrors *mb_right=m_right->GetListOfGraphs()->At(i_mb)->Clone();
98 mb_right->SetName(
"mb_right");
99 TGraphErrors *ht1_right=m_right->GetListOfGraphs()->At(i_ht1)->Clone();
100 ht1_right->SetName(
"ht1_right");
101 TGraphErrors *ht2_right=m_right->GetListOfGraphs()->At(i_ht2)->Clone();
102 ht2_right->SetName(
"ht2_right");
107 TFile *f_mid=
new TFile(mid,
"OPEN");
108 TCanvas *c_mid=f_mid->Get(
"compare");
111 p_c=(TPad*)gPad->FindObject(
"padt");
114 TMultiGraph *m_mid=gPad->FindObject(
"m_pions")->Clone();
115 TGraphErrors *mb_mid=m_mid->GetListOfGraphs()->At(i_mb)->Clone();
116 mb_mid->SetName(
"mb_mid");
117 TGraphErrors *ht1_mid=m_mid->GetListOfGraphs()->At(i_ht1)->Clone();
118 ht1_mid->SetName(
"ht1_mid");
119 TGraphErrors *ht2_mid=m_mid->GetListOfGraphs()->At(i_ht2)->Clone();
120 ht2_mid->SetName(
"ht2_mid");
126 divideGraphs(mb_left,mb_nom);
127 divideGraphs(ht1_left,ht1_nom);
128 divideGraphs(ht2_left,ht2_nom);
130 divideGraphs(mb_right,mb_nom);
131 divideGraphs(ht1_right,ht1_nom);
132 divideGraphs(ht2_right,ht2_nom);
134 divideGraphs(mb_mid,mb_nom);
135 divideGraphs(ht1_mid,ht1_nom);
136 divideGraphs(ht2_mid,ht2_nom);
138 divideGraphs(mb_nom,mb_nom);
139 divideGraphs(ht1_nom,ht1_nom);
140 divideGraphs(ht2_nom,ht2_nom);
143 TCanvas *c=
new TCanvas(
"c",
"c",400,300);
144 TMultiGraph *m=
new TMultiGraph();
163 TLegend *leg=
new TLegend(0.5,0.5,0.7,0.7);
165 leg->AddEntry(mb_left,
"{-3#sigma,2#sigma}",
"p");
166 leg->AddEntry(mb_right,
"{-2#sigma,3#sigma}",
"p");
167 leg->AddEntry(mb_mid,
"{-2#sigma,2#sigma}",
"p");
170 err_mb_hi->Draw(
"same");
171 err_mb_lo->Draw(
"same");
172 err_ht_hi->Draw(
"same");
173 err_ht_lo->Draw(
"same");
178 c->SaveAs(
"error_yield_pp.eps");
179 c->SaveAs(
"error_yield_pp.root");
182 c->SaveAs(
"error_yield_dau.eps");
183 c->SaveAs(
"error_yield_dau.root");