FairRoot/PandaRoot
Functions
analyse_phi.C File Reference

Go to the source code of this file.

Functions

void confgraph (TGraph *g, TString tit, int col=1, int marker=20)
 
TH1F * createHistoGraph (TGraph *g, TString tit="", double xmin=0, double xmax=0, double ymaxf=1.05)
 
void analyse_phi (double t=0.5, double sigs=100, int steps=25, double emin=2.25, double emax=2.35, double m=2.3, double G=0.015)
 

Function Documentation

void analyse_phi ( double  t = 0.5,
double  sigs = 100,
int  steps = 25,
double  emin = 2.25,
double  emax = 2.35,
double  m = 2.3,
double  G = 0.015 
)

Definition at line 50 of file analyse_phi.C.

References c1, confgraph(), createHistoGraph(), dx, dy, effs, f1, i, m, printf(), sqrt(), t, x, and y.

51 {
52  //gStyle->SetStatX(0.5);
53  //gStyle->SetStatY(0.40);
54  gStyle->SetStatW(0.20);
55  gStyle->SetStatH(0.12);
56 
57  // C. Evangelista et al., Phys. Rev. D57, 5370 (1998).
58  double x[25] = {2.219, 2.221, 2.221, 2.222, 2.224, 2.226, 2.226, 2.228, 2.229, 2.231, 2.231, 2.233, 2.235, 2.236, 2.242, 2.247, 2.254, 2.255, 2.272, 2.289, 2.307, 2.333, 2.360, 2.404, 2.430};
59  double dx[25] = {0.0};
60 
61  double y[25] = {4.15, 4.16, 3.87, 3.94, 4.40, 3.90, 3.68, 3.00, 3.20, 3.73, 2.97, 4.20, 3.52, 2.48, 3.38, 2.68, 2.63, 3.01, 2.25, 2.15, 1.97, 2.04, 2.04, 1.61, 1.93 };
62  double dy[25] = {0.34, 0.36, 0.54, 0.35, 0.36, 0.34, 0.34, 0.30, 0.32, 0.35, 0.33, 0.35, 0.34, 0.30, 0.45, 0.39, 0.35, 0.16, 0.17, 0.21, 0.24, 0.14, 0.12, 0.18, 0.11 };
63 
64 
65  TGraphErrors *gphi = new TGraphErrors(25,x,y,dx,dy);
66 
67  confgraph(gphi,"#phi#phi cross section [JetSet];E_{cm} [GeV];#sigma [#mub]");
68  TH1F *hphi = createHistoGraph(gphi,"#phi#phi cross section [JetSet];E_{cm} [GeV];#sigma [#mub]",2.21,2.435);
69 
70  //TF1 *f1=new TF1("f1","expo",2.21,2.435);
71  TF1 *f1=new TF1("f1","0.5*[0]*(1.0-TMath::Erf((x-[1])/[2]))+[3]",2.21,2.435);
72  f1->SetParameters(3,2.23,0.01,1);
73 
74  // inelasic cross section in mb
75  TF1 *finel=new TF1("finel","[0]+[1]/x^[2]-[3]/x^[4]");
76  finel->SetParameters(32,82,0.67,45,0.85);
77  finel->SetRange(1.,100.);
78 
79  TCanvas *c1=new TCanvas("c1","c1",20,20,1500,500);
80  c1->Divide(3,1,0.0001,0.0001);
81 
82  c1->cd(1);
83  hphi->Draw();
84  gphi->Fit("f1","R");
85  gphi->Draw("Psame");
86 
87  TLine l;
88  l.SetLineColor(4);
89  l.SetLineStyle(9);
90  l.SetLineWidth(2);
91  l.DrawLine(emin,0,emin,hphi->GetMaximum()*0.5);
92  l.DrawLine(emax,0,emax,hphi->GetMaximum()*0.5);
93 
94 
95  double effs = 20322./100000.; // signal efficiency: cut = abs(summ4-2.15)<0.15&&abs(f4cxd0m-1.02)<0.012&&abs(f4cxd1m-1.02)<0.012&chi24c<50
96  double effg = 35./840.5e6; // generic background efficiency
97  //double sigs = 100.; // signal cross section [nb]
98  double fBR = 0.489*0.489; // BR(phi->K+ K-)^2
99 
100  //double effs = 22463./100000.; // signal efficiency: cut = abs(summ4-2.15)<0.15&&abs(f4cxd0m-1.02)<0.012&&abs(f4cxd1m-1.02)<0.012&chi24c<50
101  //double effg = 77./840.5e6; // generic background efficiency
102 
103  double sigphi = f1->Eval(2.3)*1000; // phi phi cross section [nb]
104  double sigg = 60e6; // generic cross section [nb]
105 
106  //double t = 0.5; // [d]
107  double Lint = 788; // [1./(nb*d)]
108 
109  double S = sigs*effs*fBR*t*Lint; // expected number of signals
110  double Bphi = sigphi*effs*fBR*t*Lint; // expected number of non-res phi phi
111  double Bg = sigg*effg*t*Lint; // expected number of
112 
113  cout <<"S="<<S<<" B_phi(sig ="<<sigphi<<" nb)="<<Bphi<<" B_g="<<Bg<<endl;
114 
115 
116  c1->cd(2);
117 
118  // signal cross section (BW)
119  TF1 *fbw = new TF1("fbw","[0]*[3]*TMath::BreitWigner(x,[1],[2])");
120  fbw->SetParameters(1,m,G,1);
121  fbw->SetParNames("#sigma_{S}","m","#Gamma","f_{scale}");
122 
123  // background function
124  TF1 *fbg=new TF1("fbg","pol2",2.21,2.435);
125 
126  // combined fit function
127  TF1 *ffit = new TF1("ffit","[0]*TMath::BreitWigner(x,[1],[2]) + pol2(3)");
128  ffit->SetParNames("A","m","#Gamma","a_{0}","a_{1}","a_{2}","a_{3}");
129 
130  double stsize = (emax-emin)/(steps-1);
131 
132  TGraphErrors *gscan = new TGraphErrors(steps);
133  TGraphErrors *gscansig = new TGraphErrors(steps);
134  TGraphErrors *gscanbg = new TGraphErrors(steps);
135  confgraph(gscan,Form("#phi#phi scan (t=%.2fd);E_{cm} [GeV];counts",t));
136  confgraph(gscanbg,Form("#phi#phi scan (t=%.2fd);E_{cm} [GeV];counts",t),16);
137  confgraph(gscansig,Form("#phi#phi scan (t=%.2fd);E_{cm} [GeV];counts",t));
138 
139  double st_t = t/steps;
140 
141 
142 
143  for (int i=0;i<steps;++i)
144  {
145  double ecm = emin + i*stsize;
146 
147  double st_sigs = fbw->Eval(ecm)/fbw->Eval(m)*sigs;
148  double st_sigphi = f1->Eval(ecm)*1000; // mub -> nb
149  double st_sigg = finel->Eval(ecm)*1e6; // mub -> nb
150 
151  double yieldS = gRandom->Poisson(st_sigs * effs * fBR * st_t * Lint);
152  double yieldBphi = gRandom->Poisson(st_sigphi * effs * fBR * st_t * Lint);
153  double yieldBg = gRandom->Poisson(st_sigg * effg * st_t * Lint);
154 
155  printf("(%2d) Ecm = %5.3f GeV : sig_S = %.2f nb (S = %6.0f) sig_phi = %.2f nb (B = %6.0f) sig_gen = %.2f mub (Bg = %5.0f)\n", i, ecm, st_sigs, yieldS, st_sigphi, yieldBphi, st_sigg/1000, yieldBg);
156 
157  double yield = (yieldS + yieldBg + yieldBphi);
158 
159  gscan->SetPoint(i,ecm, yield);
160  gscan->SetPointError(i, 0, sqrt(yield));
161 
162  gscanbg->SetPoint(i,ecm, gRandom->Poisson(yieldBg));
163  gscanbg->SetPointError(i, 0, sqrt(yieldBg));
164  }
165 
166  ffit->SetParameters(sigs,m,G,1,1,1);
167  ffit->FixParameter(1,m);
168  ffit->FixParameter(2,G);
169 
170  gscan->Fit("ffit");
171  ffit->ReleaseParameter(1);
172  ffit->ReleaseParameter(2);
173  gscan->Fit("ffit","m");
174 
175  fbg->SetParameters(ffit->GetParameter(3),ffit->GetParameter(4),ffit->GetParameter(5),ffit->GetParameter(6));
176 
177  TH1F *hscan = createHistoGraph(gscan,Form("#phi#phi scan (t = %.2fd, #sigma = %.0fnb);E_{cm} [GeV];counts",t,sigs),0,0,1.3);
178  hscan->Draw();
179  gscan->Draw("Psame");
180  gscanbg->Draw("Psame");
181 
182  for (int i=0;i<steps;++i)
183  {
184  double x,y,dx,dy;
185  gscan->GetPoint(i,x,y);
186  gscansig->SetPoint(i,x,y-fbg->Eval(x));
187  gscansig->SetPointError(i,gscan->GetErrorX(i),gscan->GetErrorY(i));
188 
189  //cout <<x<<" "<<fbg->Eval(x)<<endl;
190  }
191 
192  c1->cd(3);
193  TH1F *hscansig = createHistoGraph(gscansig,Form("#phi#phi scan (t = %.2fd, #sigma = %.0fnb);E_{cm} [GeV];counts",t,sigs),0,0,1.3);
194  hscansig->SetMinimum(-100);
195  hscansig->Draw();
196  gscansig->Draw("Psame");
197  fbw->FixParameter(3,1);
198  gscansig->Fit("fbw");
199  fbw->SetParameter(0,1);
200  fbw->FixParameter(3, 1./fbw->GetMaximum(emin,emax)*(effs*fBR*st_t*Lint) );
201  fbw->SetParameter(0,TMath::MaxElement(gscansig->GetN(),gscansig->GetY())/(effs*fBR*st_t*Lint));
202  gscansig->Fit("fbw");
203 
204 
205  c1->Update();
206  TPaveStats *st = (TPaveStats *)gscan->GetListOfFunctions()->FindObject("stats");
207  if (st)
208  {
209  cout <<"good"<<endl;
210  st->SetX1NDC(0.5); //new x start position
211  st->SetX2NDC(0.5); //new x end position
212  c1->Modified();
213  c1->Update();
214  }
215  else cout <<"***"<<endl;
216 
217 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
double dy
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
TF1 * f1
Definition: reco_analys2.C:50
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
TH1F * createHistoGraph(TGraph *g, TString tit="", double xmin=0, double xmax=0)
Definition: analyse_etac1.C:60
void confgraph(TGraph *g, TString tit, int col=1, int marker=20)
Definition: analyse_etac1.C:47
c1
Definition: plot_dirc.C:35
double dx
std::map< int, double > effs
Definition: simubg.C:29
Double_t x
TTree * t
Definition: bump_analys.C:13
Double_t y
void confgraph ( TGraph *  g,
TString  tit,
int  col = 1,
int  marker = 20 
)

Definition at line 3 of file analyse_phi.C.

References col.

4 {
5  g->GetHistogram()->SetTitle(tit);
6  g->GetHistogram()->SetMinimum(0);
7  g->SetLineColor(col);
8  g->SetMarkerColor(col);
9  g->SetMarkerStyle(marker);
10  g->SetMarkerSize(1);
11  g->SetLineWidth(2);
12 }
int col
Definition: anaLmdDigi.C:67
TFile * g
TH1F* createHistoGraph ( TGraph *  g,
TString  tit = "",
double  xmin = 0,
double  xmax = 0,
double  ymaxf = 1.05 
)

Definition at line 16 of file analyse_phi.C.

References cnt, h, xmax, and xmin.

17 {
18  static int cnt=0;
19  if (tit=="") tit=g->GetTitle();
20 
21  double ymax = TMath::MaxElement(g->GetN(), g->GetY());
22  double dymax = g->GetErrorY(TMath::LocMax(g->GetN(), g->GetEY()));
23 
24  if (xmin==xmax)
25  {
26  xmin = TMath::MinElement(g->GetN(), g->GetX());
27  xmax = TMath::MaxElement(g->GetN(), g->GetX());
28  }
29  TH1F *h=new TH1F(Form("h%03d",cnt++),tit,g->GetN(),xmin-0.5*(xmax-xmin)/g->GetN(), xmax+0.5*(xmax-xmin)/g->GetN());
30 
31  h->GetXaxis()->SetLabelSize(0.05);
32  h->GetXaxis()->SetTitleSize(0.05);
33  h->GetYaxis()->SetLabelSize(0.05);
34  h->GetYaxis()->SetTitleSize(0.05);
35  h->GetYaxis()->SetTitleOffset(1.4);
36 
37  h->GetXaxis()->SetNdivisions(505);
38 
39  h->SetMaximum((ymax+dymax)*ymaxf);
40  h->SetMinimum(0);
41 
42  h->SetStats(0);
43 
44  return h;
45 }
Double_t xmax
TFile * g
Int_t cnt
Definition: hist-t7.C:106
Double_t xmin