void config_histo(TH1 *h, TString tx="t [d]", TString ty="N_{#sigma}",double offy=0.9) { h->SetMinimum(0); h->GetXaxis()->SetTitleOffset(1.2); h->GetXaxis()->SetTitleColor(1); h->GetXaxis()->SetLabelSize(0.055); h->GetXaxis()->SetTitleSize(0.055); //h->GetXaxis()->SetNdivisions(505); h->GetYaxis()->SetTitleOffset(offy); h->GetYaxis()->SetTitleFont(42); h->GetYaxis()->SetLabelSize(0.055); h->GetYaxis()->SetTitleSize(0.055); h->SetXTitle(tx); h->SetYTitle(ty); h->SetStats(0); } // *** setup style void setStyle() { gStyle->SetPadTopMargin(0.1); gStyle->SetPadBottomMargin(0.13); gStyle->SetPadLeftMargin(0.12); gStyle->SetPadRightMargin(0.04); gStyle->SetTitleH(0.07); gStyle->SetTitleX(0.08); /* gStyle->SetLabelSize(0.076,"X"); gStyle->SetLabelSize(0.07,"Y"); gStyle->SetStatY(0.87); gStyle->SetStatX(0.986); gStyle->SetStatW(0.4); gStyle->SetStatH(0.12); gStyle->SetOptStat("e"); // only entries gStyle->SetTitleH(0.1); gStyle->SetTitleX(0.08); gStyle->SetTitleOffset(1.1,"x"); gStyle->SetTitleXSize(0.076); gStyle->SetNdivisions(505);*/ } void signi_plot(double L=1e31, double xsec_s=10e-9, double eff_s=0.25, double f_BR=0.05, double xsec_b=0.1, double eff_b=1e-5, double tmax = 365, int nsig=5) { setStyle(); // sig_s·eff_s·f_BR // Significance (t) = sqrt(L·t) · -------------------------------------- // sqrt(sig_s·eff_s·f_BR + sig_b·eff_b) TF1 *f1=new TF1("f1","sqrt([0]*x*[6])*[1]*1e-24*[2]*[3]/sqrt([1]*1e-24*[2]*[3]+[4]*1e-24*[5])"); TF1 *f2=new TF1("f2","sqrt([0]*x*[6])*[1]*1e-24*[2]*[3]/sqrt([1]*1e-24*[2]*[3]+[4]*1e-24*[5])"); TF1 *f3=new TF1("f3","sqrt([0]*x*[6])*[1]*1e-24*[2]*[3]/sqrt([1]*1e-24*[2]*[3]+[4]*1e-24*[5])"); //TF1 *f4=new TF1("f4","[0]*(x*1e-33*[1]*[2]+[3]*1e-24*[4])/([5]*x^2*1e-66*[1]^2*[2]^2)/86400"); // t(sig_s) double timescale = 86400; TString xtitle="t [d]"; if (tmax<=2) { timescale = 3600; xtitle="t [h]"; tmax*=24; } else if (tmax>2 && tmax<=365) { timescale = 604800; xtitle="t [week]"; tmax/=7; } else if (tmax>365 && tmax<730) { timescale = 2635200; xtitle="t [month]"; tmax/=30.5; } else { timescale = 31.55779e6; xtitle="t [a]"; tmax/=365.2522; } f1->SetParameters(L, xsec_s*2., eff_s, f_BR, xsec_b, eff_b ,timescale); f2->SetParameters(L, xsec_s , eff_s, f_BR, xsec_b, eff_b,timescale); f3->SetParameters(L, xsec_s/2., eff_s, f_BR, xsec_b, eff_b ,timescale); f1->SetRange(0,tmax); f2->SetRange(0,tmax); f3->SetRange(0,tmax); f1->SetNpx(500); f2->SetNpx(500); f3->SetNpx(500); f2->SetLineColor(1); f1->SetLineStyle(6); f3->SetLineStyle(10); TCanvas *c1=gROOT->FindObject("c1"); if (!c1) c1= new TCanvas("c1","c1",10,10,700,520); c1->cd(); f1->Draw(); f1->GetHistogram()->SetTitle("Significance vs. beam time"); config_histo(f1->GetHistogram(),xtitle); f2->Draw("same"); f3->Draw("same"); gPad->SetGridx(); gPad->SetGridy(); TLine l; l.SetLineColor(4);l.SetLineWidth(2);l.SetLineStyle(2); l.DrawLine(0,nsig,tmax,nsig); TLegend *leg=new TLegend(0.12,0.7,0.35,0.9); leg->AddEntry(f1,TString::Format("#sigma_{s} = %3.2f nb",xsec_s*2*1e9),"l"); leg->AddEntry(f2,TString::Format("#sigma_{s} = %3.2f nb",xsec_s*1e9),"l"); leg->AddEntry(f3,TString::Format("#sigma_{s} = %3.2f nb",xsec_s/2*1e9),"l"); leg->Draw(); }