StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
systematics_dau.h
1 //d+Au yield:
2 double bemc_escale_dau_pion(double *x,double * /*par*/){
3  double p[]={2.14037e-01,6.55108e-03};
4  return 1.25*(p[0]+p[1]*x[0]);
5 }
6 double bemc_spread_dau_pion(double * /*x*/,double * /*par*/){
7  return (double)0.035;
8 }
9 double bsmd_escale_dau_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_dau_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_dau_pion(double * /*x*/,double * /*par*/){
18  return (double)0.026;
19 }
20 double yield_extract_dau_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 beambg_dau_pion(double *x,double * /*par*/){
25  if(x[0]<5.) return (double)0.0;
26  /*if(x[0]>=5.)*/ return (double)0.007*(x[0]-5.);
27 }
28 double error_norm_dau_pion(double * /*x*/,double * /*par*/){
29  return (double)0.01;
30 }
31 double prescale_dau_pion(double *x,double * /*par*/){
32  if(x[0]<4.) return (double)0.;
33  /*if(x[0]>=4.)*/ return (double)0.05;
34 }
35 double total_sys_dau_pion(double *x,double *par){
36  double ret=0.;
37  ret=bemc_escale_dau_pion(x,par)*bemc_escale_dau_pion(x,par);
38  ret+=bemc_spread_dau_pion(x,par)*bemc_spread_dau_pion(x,par);
39  ret+=bsmd_escale_dau_pion(x,par)*bsmd_escale_dau_pion(x,par);
40  ret+=bsmd_spread_dau_pion(x,par)*bsmd_spread_dau_pion(x,par);
41  ret+=material_dau_pion(x,par)*material_dau_pion(x,par);
42  ret+=yield_extract_dau_pion(x,par)*yield_extract_dau_pion(x,par);
43  ret+=beambg_dau_pion(x,par)*beambg_dau_pion(x,par);
44  ret+=error_norm_dau_pion(x,par)*error_norm_dau_pion(x,par);
45  ret+=prescale_dau_pion(x,par)*prescale_dau_pion(x,par);
46  return par[0]*sqrt(ret);
47 }
48 void set_sys_dau_pion(TGraphErrors *g){
49  TF1 *sys=new TF1("sys",&total_sys_dau_pion,1.,15.,1);
50  sys->SetParameter(0,1.);
51  for(int i=0;i<g->GetN();i++){
52  double x=0.;
53  double y=0.;
54  g->GetPoint(i,x,y);
55  double rel_err=sys->Eval(x);
56  g->SetPointError(i,0.,rel_err*y);
57  }
58 }
59 void plotErrors_dau_pion(){
60 
61  TF1 *error_up=new TF1("error_up",&total_sys_dau_pion,1.,15.,1);
62  error_up->SetParameter(0,1.);
63  TF1 *error_down=new TF1("error_down",&total_sys_dau_pion,1.,15.,1);
64  error_down->SetParameter(0,-1.);
65 
66  error_up->SetFillColor(5);
67  error_down->SetFillColor(5);
68 
69 
70  TCanvas *test=new TCanvas();
71  error_up->Draw();
72  error_up->SetMinimum(-1.*error_up->GetMaximum());
73  error_down->Draw("same");
74  test->SaveAs("systotal_dau_pions.eps");
75  test->SaveAs("systotal_dau_pions.root");
76 }
77 
78 //d+Au double ratio:
79 double bemc_escale_dau_ratio(double * /*x*/,double * /*par*/){
80  return 0.03;
81 }
82 double bemc_spread_dau_ratio(double * /*x*/,double * /*par*/){
83  return 0.01;
84 }
85 double bsmd_escale_dau_ratio(double * /*x*/,double * /*par*/){
86  //return 0.06;
87  return 0.12;
88 }
89 double bsmd_spread_dau_ratio(double * /*x*/,double * /*par*/){
90  return 0.01;
91 }
92 double yield_extract_dau_ratio(double *x,double *par){
93  return yield_extract_dau_pion(x,par);
94 }
95 double eta_over_pi_dau(double * /*x*/,double * /*par*/){
96  return 0.02;
97 }
98 double fit_pion_dau(double * /*x*/,double * /*par*/){
99  return 0.015;
100 }
101 //double beambg_dau_pion(double *x,double *par){
102 // if(x[0]<5.) return (double)0.0;
103 // if(x[0]>=5.) return 0.01+0.004*(x[0]-5.);
104 //}
105 double total_sys_dau_ratio(double *x,double *par){
106  double ret=0.;
107  ret=bemc_escale_dau_ratio(x,par)*bemc_escale_dau_ratio(x,par);
108  ret+=bemc_spread_dau_ratio(x,par)*bemc_spread_dau_ratio(x,par);
109  ret+=bsmd_escale_dau_ratio(x,par)*bsmd_escale_dau_ratio(x,par);
110  ret+=bsmd_spread_dau_ratio(x,par)*bsmd_spread_dau_ratio(x,par);
111  ret+=yield_extract_dau_ratio(x,par)*yield_extract_dau_ratio(x,par);
112  ret+=eta_over_pi_dau(x,par)*eta_over_pi_dau(x,par);
113  ret+=fit_pion_dau(x,par)*fit_pion_dau(x,par);
114  ret+=beambg_dau_pion(x,par)*beambg_dau_pion(x,par);
115  return par[0]*sqrt(ret);
116 }
117 void set_sys_dau_ratio(TGraphErrors *g){
118  TF1 *sys=new TF1("sys",&total_sys_dau_ratio,1.,15.,1);
119  sys->SetParameter(0,1.);
120  for(int i=0;i<g->GetN();i++){
121  double x=0.;
122  double y=0.;
123  g->GetPoint(i,x,y);
124  double rel_err=sys->Eval(x);
125  g->SetPointError(i,0.2,rel_err*y);
126  }
127 }
128