//void b2style_pad() const int belle2_font = 133; const double belle2_tsize = 26; void set_style() { gROOT->SetStyle("Modern"); TStyle *belle2Style = new TStyle("BelleII","Belle II style"); // set the paper & margin sizes belle2Style->SetPaperSize(20,26); // set canvas, pads, etc. //belle2Style->SetCanvasDefW(600); //belle2Style->SetCanvasDefH(600); //belle2Style->SetCanvasDefW(600); //belle2Style->SetCanvasDefH(600); //belle2Style->SetFillColor(1); //belle2Style->SetFillStyle(1001); belle2Style->SetFrameFillColor(0); belle2Style->SetFrameBorderMode(0); belle2Style->SetPadBorderMode(0); belle2Style->SetPadColor(0); belle2Style->SetCanvasBorderMode(0); belle2Style->SetCanvasColor(0); belle2Style->SetStatColor(0); belle2Style->SetLegendBorderSize(0); // set margin sizes belle2Style->SetPadTopMargin(0.05); belle2Style->SetPadRightMargin(0.05); belle2Style->SetPadBottomMargin(0.16); belle2Style->SetPadLeftMargin(0.16); // use large fonts belle2Style->SetTextFont(belle2_font); belle2Style->SetTextSize(belle2_tsize); belle2Style->SetLabelFont(belle2_font,"x"); belle2Style->SetTitleFont(belle2_font,"x"); belle2Style->SetLabelFont(belle2_font,"y"); belle2Style->SetTitleFont(belle2_font,"y"); belle2Style->SetLabelFont(belle2_font,"z"); belle2Style->SetTitleFont(belle2_font,"z"); belle2Style->SetLabelSize(belle2_tsize,"x"); belle2Style->SetLabelSize(belle2_tsize,"y"); belle2Style->SetLabelSize(belle2_tsize,"z"); belle2Style->SetTitleSize(belle2_tsize,"x"); belle2Style->SetTitleSize(belle2_tsize,"y"); belle2Style->SetTitleSize(belle2_tsize,"z"); belle2Style->SetTitleOffset(1.5,"x"); belle2Style->SetTitleOffset(1.5,"y"); belle2Style->SetTitleOffset(1.5,"z"); belle2Style->SetLabelOffset(0.01,"x"); belle2Style->SetLabelOffset(0.01,"y"); belle2Style->SetLabelOffset(0.01,"z"); belle2Style->SetLegendFont(belle2_font); // use bold lines and markers belle2Style->SetMarkerStyle(20); belle2Style->SetMarkerSize(1.0); belle2Style->SetHistLineWidth(2); belle2Style->SetFrameLineWidth(2); belle2Style->SetLineWidth(2); belle2Style->SetFuncWidth(2); belle2Style->SetLineStyleString(2,"[12 12]");// postscript dashes // get rid of X error bars //belle2Style->SetErrorX(0.001); // get rid of error bar caps belle2Style->SetEndErrorSize(0.); // do not display any of the standard histogram decorations belle2Style->SetOptTitle(0); belle2Style->SetOptStat(0); belle2Style->SetOptFit(0); // put tick marks on top and RHS of plots belle2Style->SetPadTickX(1); belle2Style->SetPadTickY(1); // histogram divisions: only 5 in x to avoid label overlaps belle2Style->SetNdivisions(505,"x"); belle2Style->SetNdivisions(510,"y"); // function belle2Style->SetFuncColor(kBlue); belle2Style->SetFuncStyle(0); // legend belle2Style->SetLegendBorderSize(0); belle2Style->SetLegendFillColor(0); belle2Style->SetHistMinimumZero(); std::cout << "-------------------------" << std::endl; std::cout << "Set Belle II Style" << std::endl; std::cout << "-------------------------" << std::endl; gROOT->SetStyle("BelleII"); gROOT->ForceStyle(); TGaxis::SetMaxDigits(4); } TGraph *make_swapped_graph(TH1 *h1) { // copy all points from histogram TGraph *gr = new TGraph(h1); Int_t nbins = gr->GetN(); Double_t x,y; // swap x/y coordinates for (int n=0;nGetPoint(n,x,y); gr->SetPoint(n,y,x); } return gr; } TGraph *make_swapped_graph1(TH1 *h2) { // copy all points from histogram TGraph *gr3 = new TGraph(h2); Int_t nbins1 = gr3->GetN(); Double_t x1,y1; // swap x/y coordinates for (int n=0;nGetPoint(n,x1,y1); //gr3->SetPoint(n,y1,x1); } return gr3; } void b2_style_pad() { TCanvas *c1 = new TCanvas("c1", "c1",900,900); //gStyle->SetOptStat(0); // Create the three pads TPad *center_pad = new TPad("center_pad", "center_pad",0.0,0.0,0.6,0.6); center_pad->Draw(); TPad *right_pad = new TPad("right_pad", "right_pad",0.55,0.0,1.0,0.6); right_pad->Draw(); TPad *top_pad = new TPad("top_pad", "top_pad",0.0,0.55,0.6,1.0); top_pad->Draw(); // Create, fill and project a 2D histogram. TH2F *h1 = new TH2F("ks_fde","",100, -50,400,100,-50,400); TH2F *h2 = new TH2F("ks_fde_sig","",100, -50,400,100,-50,400); //TH1F *h3 = new TH1F("ksa_fde_sig","",100, -50,400); //TH1F *h4 = new TH1F("ksb_fde_sig","",100, -50,400); TLine *l1 = new TLine(20,0,20,1720); TLine *l2 = new TLine(20,0,20,1055); TFile *f = new TFile("for_fds_plots.root"); TTree *tree = (TTree*)f->Get("DstD0PiKSKS"); Double_t KS1_flightDistance, KS1_flightDistanceErr,KS2_flightDistance, KS2_flightDistanceErr, Dst_isSignalAcceptMissingGamma, KS1_mcFlightDistance, KS2_mcFlightDistance; tree->SetBranchAddress("KS1_flightDistance",&KS1_flightDistance); tree->SetBranchAddress("KS2_flightDistance",&KS2_flightDistance); tree->SetBranchAddress("KS1_flightDistanceErr",&KS1_flightDistanceErr); tree->SetBranchAddress("KS2_flightDistanceErr",&KS2_flightDistanceErr); tree->SetBranchAddress("Dst_isSignalAcceptMissingGamma",&Dst_isSignalAcceptMissingGamma); Int_t nentries = (Int_t)tree->GetEntries(); for (Int_t i=0; iGetEntry(i); h1->Fill(KS1_flightDistance/(KS1_flightDistanceErr),KS2_flightDistance/(KS2_flightDistanceErr)); //h1->SetMarkerColor("kBlue"); //h1->SetMarkerStyle("24"); h1->GetXaxis()->SetTitle("flight distance significance (lower momentum K^{0}_{S})"); h1->GetXaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetTitle("flight distance significance (higher momentum K^{0}_{S})"); h1->GetYaxis()->SetTitleSize(0.04); h1->GetYaxis()->SetTitleOffset(1); if(Dst_isSignalAcceptMissingGamma==1){ h2->Fill(KS1_flightDistance/(KS1_flightDistanceErr),KS2_flightDistance/(KS2_flightDistanceErr)); //h2->SetMarkerColor("kRed"); //h2->SetMarkerStyle("7"); } } TH1D * projh2X = h1->ProjectionX(); TH1D * projh2Y = h1->ProjectionY(); TH1D * projh2X_sig = h2->ProjectionX(); TH1D * projh2Y_sig = h2->ProjectionY(); // Drawing center_pad->cd(); gStyle->SetPalette(1); h1->Draw(); h2->Draw("same"); h2->SetMarkerColor(kRed); /*top_pad->cd(); projh2X->SetLineColor(kBlue); projh2X->SetLineWidth(2); projh2X->Draw(""); projh2X_sig->Scale(50); projh2X_sig->SetLineColor(kRed); projh2X_sig->SetLineWidth(2); projh2X_sig->Draw("same"); l1->Draw("same"); l1->SetLineWidth(2); l1->SetLineStyle(2);*/ top_pad->cd(); projh2X->SetLineColor(kBlue); projh2X->SetFillStyle(0); projh2X->SetLineStyle(1); projh2X->SetLineWidth(2); // projh2Y->Draw("hbar"); projh2X_sig->Scale(50); //sprojh2Y_sig->Draw(""); // projh2Y_sig->Draw("hbar same"); projh2X_sig->SetLineColor(kRed); projh2X_sig->SetLineStyle(1); projh2X_sig->SetLineWidth(2); l1->Draw("same"); l1->SetLineWidth(2); l1->SetLineStyle(2); TGraph *gr4 = make_swapped_graph1(projh2X); TGraph *gr5 = make_swapped_graph1(projh2X_sig); // draw only for axis gr4->Draw("AL"); gr5->Draw("L"); top_pad->Update(); gr5->GetHistogram()->SetMinimum(-50); gr5->GetHistogram()->SetMaximum(400); right_pad->cd(); projh2Y->SetLineColor(kBlue); projh2Y->SetFillStyle(0); projh2Y->SetLineStyle(1); projh2Y->SetLineWidth(2); // projh2Y->Draw("hbar"); projh2Y_sig->Scale(50); //sprojh2Y_sig->Draw(""); // projh2Y_sig->Draw("hbar same"); projh2Y_sig->SetLineColor(kRed); projh2Y_sig->SetLineStyle(1); projh2Y_sig->SetLineWidth(2); //l2->Draw("same"); //l2->SetLineWidth(2); //l2->SetLineStyle(2); TGraph *gr1 = make_swapped_graph(projh2Y); TGraph *gr2 = make_swapped_graph(projh2Y_sig); // draw only for axis gr1->Draw("AL"); gr2->Draw("L"); right_pad->Update(); gr1->GetHistogram()->SetMinimum(-50); gr1->GetHistogram()->SetMaximum(400); set_style(); c1->cd(); TLatex *logo = new TLatex(); //logo->SetNDC(); //logo->SetTextSize(belle2_tsize); logo->DrawLatex(0.66,0.90, "#bf{#it{Belle II}} simulation"); logo->DrawLatex(0.64,0.84, " #it{#scale[0.6]{#int} L dt} = 70 fb^{#minus1}"); logo->DrawLatex(0.65,0.78,"#it{D}^{0}#rightarrow#it{K}^{0}_{S}#it{K}^{0}_{S}"); TLegend *legend = new TLegend(.75,.80,.95,.95); legend->AddEntry( projh2X_sig,"Signal X50"); //legend->AddEntry(h2,"Signal"); legend->AddEntry( projh2X,"Total"); legend->AddEntry(l1," > 20","l"); legend->Draw(); }