StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
systematics_pp.h
1 //p+p pion cross section:
2 double bemc_escale_pp_pion(double *x,double * /*par*/){
3  double p[]={2.14037e-01,6.55108e-03};
4  return p[0]+p[1]*x[0];
5 }
6 double bemc_spread_pp_pion(double * /*x*/,double * /*par*/){
7  return (double)0.024;
8 }
9 double bsmd_escale_pp_pion(double *x,double * /*par*/){
10  double p[]={4.47017e-02,9.96379e-01,-7.68552e-01};
11  return p[0]+p[1]*exp(p[2]*x[0]);
12 }
13 double bsmd_spread_pp_pion(double *x,double * /*par*/){
14  double p[]={1.26779e-02,-1.55283e-01,-1.68008e-01};
15  return p[0]+p[1]*exp(p[2]*x[0]);
16 }
17 double material_pp_pion(double * /*x*/,double * /*par*/){
18  return (double)0.018;
19 }
20 double yield_extract_pp_pion(double *x,double * /*par*/){
21  if(x[0]<4.) return (double)0.05;
22  /*if(x[0]>=4.) */return (double)0.071;
23 }
24 double error_xsec_pp_pion(double * /*x*/,double * /*par*/){
25  return (double)sqrt(0.069*0.069+0.092*0.092);
26 }
27 double prescale_pp_pion(double *x,double * /*par*/){
28  if(x[0]<4.) return (double)0.;
29  /*if(x[0]>=4.) */return (double)0.05;
30 }
31 double total_sys_pp_pion(double *x,double *par){
32  double ret=0.;
33  ret=bemc_escale_pp_pion(x,par)*bemc_escale_pp_pion(x,par);
34  ret+=bemc_spread_pp_pion(x,par)*bemc_spread_pp_pion(x,par);
35  ret+=bsmd_escale_pp_pion(x,par)*bsmd_escale_pp_pion(x,par);
36  ret+=bsmd_spread_pp_pion(x,par)*bsmd_spread_pp_pion(x,par);
37  ret+=material_pp_pion(x,par)*material_pp_pion(x,par);
38  ret+=yield_extract_pp_pion(x,par)*yield_extract_pp_pion(x,par);
39  ret+=error_xsec_pp_pion(x,par)*error_xsec_pp_pion(x,par);
40  ret+=prescale_pp_pion(x,par)*prescale_pp_pion(x,par);
41  return par[0]*sqrt(ret);
42 }
43 void set_sys_pp_pion(TGraphErrors *g){
44  TF1 *sys=new TF1("sys",&total_sys_pp_pion,1.,15.,1);
45  sys->SetParameter(0,1.);
46  for(int i=0;i<g->GetN();i++){
47  double x=0.;
48  double y=0.;
49  g->GetPoint(i,x,y);
50  double rel_err=sys->Eval(x);
51  g->SetPointError(i,0.,rel_err*y);
52  }
53 }
54 void plotErrors_pp_pion(){
55 
56  TF1 *error_up=new TF1("error_up",&total_sys_pp_pion,1.,15.,1);
57  error_up->SetParameter(0,1.);
58  TF1 *error_down=new TF1("error_down",&total_sys_pp_pion,1.,15.,1);
59  error_down->SetParameter(0,-1.);
60 
61  error_up->SetFillColor(5);
62  error_down->SetFillColor(5);
63 
64 
65  TCanvas *test=new TCanvas();
66  error_up->Draw();
67  error_up->SetMinimum(-1.*error_up->GetMaximum());
68  error_down->Draw("same");
69  test->SaveAs("systotal_pp_pions.eps");
70  test->SaveAs("systotal_pp_pions.root");
71 }
72 
73 //p+p double ratio:
74 double bemc_escale_pp_ratio(double * /*x*/,double * /*par*/){
75  return 0.03;
76 }
77 double bemc_spread_pp_ratio(double * /*x*/,double * /*par*/){
78  return 0.01;
79 }
80 double bsmd_escale_pp_ratio(double * /*x*/,double * /*par*/){
81  //return 0.06;
82  return 0.12;
83 }
84 double bsmd_spread_pp_ratio(double * /*x*/,double * /*par*/){
85  return 0.01;
86 }
87 double yield_extract_pp_ratio(double *x,double *par){
88  return yield_extract_pp_pion(x,par);
89 }
90 double eta_over_pi_pp(double * /*x*/,double * /*par*/){
91  return 0.02;
92 }
93 double fit_pion_pp(double * /*x*/,double * /*par*/){
94  return 0.015;
95 }
96 double total_sys_pp_ratio(double *x,double *par){
97  double ret=0.;
98  ret=bemc_escale_pp_ratio(x,par)*bemc_escale_pp_ratio(x,par);
99  ret+=bemc_spread_pp_ratio(x,par)*bemc_spread_pp_ratio(x,par);
100  ret+=bsmd_escale_pp_ratio(x,par)*bsmd_escale_pp_ratio(x,par);
101  ret+=bsmd_spread_pp_ratio(x,par)*bsmd_spread_pp_ratio(x,par);
102  ret+=yield_extract_pp_ratio(x,par)*yield_extract_pp_ratio(x,par);
103  ret+=eta_over_pi_pp(x,par)*eta_over_pi_pp(x,par);
104  ret+=fit_pion_pp(x,par)*fit_pion_pp(x,par);
105  return par[0]*sqrt(ret);
106 }
107 void set_sys_pp_ratio(TGraphErrors *g){
108  TF1 *sys=new TF1("sys",&total_sys_pp_ratio,1.,15.,1);
109  sys->SetParameter(0,1.);
110  for(int i=0;i<g->GetN();i++){
111  double x=0.;
112  double y=0.;
113  g->GetPoint(i,x,y);
114  double rel_err=sys->Eval(x);
115  g->SetPointError(i,0.2,rel_err*y);
116 //cout << "x=" << x << ", y=" << y << ", ey=" << (rel_err*y) << endl;
117  }
118 }
119