//************************************************* // // Iouri Vassiliev (I.Vassiliev@gsi.de) - macro for visualization of KFParticle Package results // Anna Senger (A.Senger@gsi.de) - adapted version for dimuon omega // //************************************************* void DrawSBg_omega(Int_t beam=8, TString input="inv_mass_omega_background_v19a_8gev.root") { TStyle *plain = new TStyle("Plain","Plain Style(no colors/fill areas)"); plain->SetCanvasBorderMode(0); plain->SetPadBorderMode(0); plain->SetPadColor(0); plain->SetCanvasColor(0); plain->SetTitleColor(0); // plain->SetTitleFont(22); // plain->SetLabelFont(22); plain->SetStatColor(0); plain->SetOptStat(0); // plain->SetOptFit(11); plain->SetOptFit(0); plain->SetStatW(0.19); // plain->SetStatH(0.7); plain->SetStatH(0.5); plain->SetOptTitle(0); plain->SetPadLeftMargin(0.13); plain->SetPadRightMargin(0.03); plain->SetPadTopMargin(0.075); plain->SetPadBottomMargin(0.18); plain->cd(); Double_t multy[30]; multy[2] = 0.01; // 2AGeV multy[4] = 5; // 4AGeV multy[8] = 19; Double_t BR = 9e-5; TFile *f1 = new TFile(input.Data(),"read"); TH1D *hPart; TF1 *fPart; string hName = "invM_omega_bg"; hPart = (TH1D*) f1->Get(hName.data()); TH1D *hEmpty = new TH1D("empty", "empty", 100, 0.001, 0.002); hEmpty-> SetLineColor(0); hEmpty-> SetMarkerColor(0); string pName = "omega"; string AxisName = "m_{inv} #mu^{+} #mu^{-} (GeV/c^{2})"; TString LegendEntry[6]; LegendEntry[0] = "#omega(782)"; struct Bins { float binStart, binEnd; }; Bins bbb = {0.60, 0.90}; struct InitPar { float m,s; }; InitPar initPar = {0.782, 0.02}; string sPartFit = hName +"_GaussFit"; fPart = new TF1(sPartFit.data(),"gaus(0)+pol2(3)",bbb.binStart,bbb.binEnd); fPart -> SetParNames("Const","Mass","Sigma","a0","a1","a2"); fPart -> SetNpx(10000); fPart -> SetLineColor(2); fPart -> SetParameter(1,(bbb.binStart + bbb.binEnd)/2); fPart -> SetParameter(2,(bbb.binEnd - bbb.binStart)/4); fPart -> SetParLimits(2,0,1); fPart -> FixParameter(1, initPar.m); fPart -> FixParameter(2, initPar.s); hPart -> Fit(sPartFit.data(),"QRN","",bbb.binStart,bbb.binEnd); fPart -> ReleaseParameter(1); fPart -> ReleaseParameter(2); hPart -> Fit(sPartFit.data(),"QRN","",bbb.binStart,bbb.binEnd); int nParam = 6; for(int j=3; j FixParameter(j,fPart->GetParameter(j)); hPart -> Fit(sPartFit.data(),"","",bbb.binStart,bbb.binEnd); TF1 *fSInt; TF1 *fBInt; float sigB; float start = fPart->GetParameter(1) - 2*fPart->GetParameter(2); float end = fPart->GetParameter(1) + 2*fPart->GetParameter(2); sPartFit += "int"; fSInt = new TF1(sPartFit.data(),"gaus",bbb.binStart,bbb.binEnd); for(int iPar=0; iPar<3; iPar++) fSInt -> SetParameter(iPar, fPart -> GetParameter(iPar)); sPartFit += "BG"; fBInt = new TF1(sPartFit.data(),"pol2",bbb.binStart,bbb.binEnd); for(int iPar=3; iPar<6; iPar++) fBInt -> SetParameter(iPar-3, fPart -> GetParameter(iPar)); float S = fSInt -> Integral(start,end); float B = fBInt -> Integral(start,end); sigB = S/B; char tmpString[6]; sprintf(tmpString,"%1.1f",(fPart -> GetParameter(2)*1000)); LegendEntry[1] = "#sigma = "; LegendEntry[1] += tmpString; LegendEntry[1] += " MeV/c^{2}"; LegendEntry[2] = "S/B = "; if((S/B)<10) sprintf(tmpString,"%4.2f",(S/B)); else if((S/B)<100) sprintf(tmpString,"%4.1f",(S/B)); else sprintf(tmpString,"%4.0f",(S/B)); LegendEntry[2] += tmpString; Double_t min_histo = (hPart->GetXaxis())->GetXmin(); Double_t max_histo = (hPart->GetXaxis())->GetXmax(); Double_t bin_histo = (max_histo-min_histo)/hPart->GetNbinsX(); S = S/bin_histo; B = B/bin_histo; Double_t eff = S/(multy[beam]*BR)*100.; LegendEntry[3] = "#varepsilon = "; sprintf(tmpString,"%4.2f ",eff); LegendEntry[3] += tmpString; LegendEntry[3] += "%"; S*=5e6; B*=5e6; LegendEntry[4] = "#frac{S}{#sqrt{S+B}}_{5M events} = "; sprintf(tmpString,"%4.2f",S/sqrt(S+B)); LegendEntry[4] += tmpString; LegendEntry[5] = " "; TCanvas *c1; c1 = new TCanvas("c1","Particles",0,0,1600,1200); c1 -> UseCurrentStyle(); TLegend *legend=legend = new TLegend(0.70, 0.55, .99, .99); legend->SetFillColor(0); legend->SetTextSize(0.05); legend->SetMargin(0.1); Bins binDraw = {0.3,1.2}; TGaxis::SetMaxDigits(3); hPart -> GetXaxis()-> SetTitle(AxisName.data()); hPart -> GetXaxis()-> SetTitleSize(0.07); hPart -> GetXaxis()-> SetTitleFont(22); hPart -> GetXaxis()-> SetLabelSize(0.07); hPart -> GetXaxis()-> SetTitleOffset(1); hPart -> GetXaxis()-> SetLabelFont(22); hPart -> GetXaxis()-> SetNdivisions(5,5,0); hPart -> GetXaxis()-> SetRangeUser(binDraw.binStart, binDraw.binEnd); hPart -> GetYaxis()-> SetTitle("counts/events"); hPart -> GetYaxis()-> SetTitleSize(0.06); hPart -> GetYaxis()-> SetTitleFont(22); hPart -> GetYaxis()-> SetLabelSize(0.07); hPart -> GetYaxis()-> SetLabelFont(22); hPart -> GetYaxis()-> SetTitleOffset(0.85); hPart -> GetYaxis()-> SetNdivisions(3,5,0); hPart -> SetLineWidth(2); hPart -> SetLineColor(kBlack); hPart -> SetMarkerStyle(20); hPart -> SetMarkerColor(kBlack); hPart -> SetMarkerSize(0.7); hPart -> Draw("pe"); /* h_omega->Draw("same"); fSInt->Draw("same"); */ legend->AddEntry(hPart, LegendEntry[0].Data(),"l"); legend->AddEntry(hEmpty,LegendEntry[1].Data(),"l"); legend->AddEntry(hEmpty,LegendEntry[2].Data(),"l"); legend->AddEntry(hEmpty,LegendEntry[3].Data(),"l"); legend->AddEntry(hEmpty,LegendEntry[4].Data(),"l"); legend->AddEntry(hEmpty,LegendEntry[5].Data(),"l"); /* TString sss="S/B "; char sss1[6]; sprintf(sss1,"%6.3f",sigB); sss += sss1; TLatex sb; TLatex pn; pn.SetTextSize(0.08); pn.SetTextColor(kBlack); */ legend->Draw(); }