void plot_eventrate_app(){ TFile *pfile = new TFile("eventrate_app.root","READ"); const int NRULES = 2;//for appearance of nue and nuebar TH1D *hrate_all_rule[NRULES]; TH1D *hrate_sig_rule[NRULES]; TH1D *hrate_bkg_rule[NRULES]; const int NCHANNEL = 16;//defined in your T2HK.glb file const char *channelname[NCHANNEL] = {"#nu_{#mu}#rightarrow #nu_{e} CCQE", "#bar{#nu}_{#mu}#rightarrow #bar{#nu}_{e} CCQE", "#nu_{#mu}#rightarrow #nu_{#mu} CC", "#bar{#nu}_{#mu}#rightarrow #bar{#nu}_{#mu} CC", "beam #nu_{e}#rightarrow #nu_{e} CC", "beam #bar{#nu}_{e}#rightarrow #bar{#nu}_{e} CC", "NC background", "#nu_{#mu}#rightarrow #nu_{e} CCQE", "#bar{#nu}_{#mu}#rightarrow #bar{#nu}_{e} CCQE", "#nu_{#mu}#rightarrow #nu_{#mu} CC", "#bar{#nu}_{#mu}#rightarrow #bar{#nu}_{#mu} CC", "beam #nu_{e}#rightarrow #nu_{e} CC", "beam #bar{#nu}_{e}#rightarrow #bar{#nu}_{e} CC", "NC background" }; const char *colorcode[] = { "#000000", "#0072B2", "#D55E00", "#CC79A7", "#E69F00", "#009E73", "#56B4E9", "#F0E442", "#696969" }; Int_t ci; TLegend* leg0 = new TLegend(.62, .65, 0.85, .92); leg0->SetFillStyle(0); leg0->SetBorderSize(0); leg0->SetTextSize(30); leg0->SetTextFont(43); //plot in rule-based, simply signal and background separation for (Int_t irule=0; iruleSetOptStat(0); hrate_all_rule[irule] = (TH1D*)pfile->Get(Form("hrate_all_rule%d",irule)); hrate_sig_rule[irule] = (TH1D*)pfile->Get(Form("hrate_sig_rule%d",irule)); hrate_bkg_rule[irule] = (TH1D*)pfile->Get(Form("hrate_bkg_rule%d",irule)); //histogram style hrate_all_rule[irule]->SetLineWidth(3); hrate_sig_rule[irule]->SetLineWidth(3); hrate_bkg_rule[irule]->SetLineWidth(3); //for all --> use black ci = TColor::GetColor(colorcode[0]); hrate_all_rule[irule]->SetLineColor(ci); //for signal --> use blue ci = TColor::GetColor(colorcode[1]); hrate_sig_rule[irule]->SetLineColor(ci); // ci = TColor::GetColor(colorcode[2]); hrate_bkg_rule[irule]->SetLineColor(ci); hrate_all_rule[irule]->GetXaxis()->SetTitle("Neutrino reconstructed energy [GeV]"); hrate_all_rule[irule]->GetYaxis()->SetTitle("Number of events"); titleStyle(hrate_all_rule[irule]); hrate_all_rule[irule]->Draw(); hrate_all_rule[irule]->GetYaxis()->SetRangeUser(0,hrate_all_rule[irule]->GetMaximum()*1.2); hrate_sig_rule[irule]->Draw("same"); hrate_bkg_rule[irule]->Draw("same"); if(irule==0){ leg0->AddEntry(hrate_all_rule[irule],"All events","l"); leg0->AddEntry(hrate_sig_rule[irule],"Signal","l"); leg0->AddEntry(hrate_bkg_rule[irule],"Background","l"); } leg0->Draw(); c1->Print(Form("plots/eventrate_app_rule%d.eps",irule)); delete c1; }//end irule delete leg0; //breakdown into channel //this information when you run eventrateapp /*rule 0, signal chan0, coff 0.61603: rule 0, b background chan1, coff 0.458148: rule 0, b background chan2, coff 0.000760739: rule 0, b background chan3, coff 0: rule 0, b background chan4, coff 0.235642: rule 0, b background chan5, coff 0.121187: rule 0, b background chan6, coff 0.00403415: For Rule 0, Number of channel in Signal 1, in Background 6 */ TLegend* leg0 = new TLegend(.6, .55, 0.85, .9); leg0->SetFillStyle(0); leg0->SetBorderSize(0); leg0->SetTextSize(24); leg0->SetTextFont(43); leg0->AddEntry(hrate_all_rule[0],"All events","l"); leg0->AddEntry(hrate_sig_rule[0],Form("%s",channelname[0]),"l"); const int Rule0_NBKG = 6; Int_t IndexRule0_BKG[Rule0_NBKG]={1,2,3,4,5,6}; TH1D *hrule0_bkg[Rule0_NBKG]; TCanvas *c1 = new TCanvas("c1","c1",800,680); gStyle->SetOptStat(0); hrate_all_rule[0]->Draw(); hrate_sig_rule[0]->Draw("same"); for (Int_t ichan=0; ichanGet(Form("hrate_bkg_rule%d_chan%d_post",0,IndexRule0_BKG[ichan])); ci = TColor::GetColor(colorcode[ichan+2]); hrule0_bkg[ichan]->SetLineWidth(3); hrule0_bkg[ichan]->SetLineColor(ci); hrule0_bkg[ichan]->Draw("same"); leg0->AddEntry(hrule0_bkg[ichan],Form("%s",channelname[IndexRule0_BKG[ichan]]),"l"); } leg0->Draw(); c1->Print("plots/eventrate_app_rule0_chanbreakdown.eps"); delete c1; delete leg0; /* rule 1, signal chan8, coff 0.685769: rule 1, b background chan7, coff 0.43587: rule 1, b background chan9, coff 0.000228222: rule 1, b background chan10, coff 0.000152148: rule 1, b background chan11, coff 0.129843: rule 1, b background chan12, coff 0.296235: rule 1, b background chan13, coff 0.00461046: For Rule 1, Number of channel in Signal 1, in Background 6 */ TLegend* leg0 = new TLegend(.6, .55, 0.85, .9); leg0->SetFillStyle(0); leg0->SetBorderSize(0); leg0->SetTextSize(24); leg0->SetTextFont(43); leg0->AddEntry(hrate_all_rule[0],"All events","l"); leg0->AddEntry(hrate_sig_rule[0],Form("%s",channelname[8]),"l"); const int Rule1_NBKG = 6; Int_t IndexRule1_BKG[Rule1_NBKG]={7,9,10,11,12,13}; TH1D *hrule1_bkg[Rule1_NBKG]; TCanvas *c1 = new TCanvas("c1","c1",800,680); gStyle->SetOptStat(0); hrate_all_rule[1]->Draw(); hrate_sig_rule[1]->Draw("same"); for (Int_t ichan=0; ichanGet(Form("hrate_bkg_rule%d_chan%d_post",1,IndexRule1_BKG[ichan])); ci = TColor::GetColor(colorcode[ichan+2]); hrule1_bkg[ichan]->SetLineWidth(3); hrule1_bkg[ichan]->SetLineColor(ci); hrule1_bkg[ichan]->Draw("same"); leg0->AddEntry(hrule1_bkg[ichan],Form("%s",channelname[IndexRule1_BKG[ichan]]),"l"); } leg0->Draw(); c1->Print("plots/eventrate_app_rule1_chanbreakdown.eps"); delete c1; delete leg0; } void titleStyle(TH1D* h1){ h1->GetXaxis()->CenterTitle(); h1->GetYaxis()->CenterTitle(); h1->GetXaxis()->SetLabelSize(h1->GetXaxis()->GetTitleSize()*1.3); h1->GetYaxis()->SetLabelSize(h1->GetYaxis()->GetTitleSize()*1.3); h1->GetXaxis()->SetTitleSize(h1->GetXaxis()->GetLabelSize()*1.2); h1->GetYaxis()->SetTitleSize(h1->GetYaxis()->GetLabelSize()*1.2); h1->GetYaxis()->SetTitleOffset(0.9); h1->GetXaxis()->SetTitleOffset(0.8); }