TH1* makeRatio(TH1*h1, TH1* h2, const char* title) { TH1* hdiff = (TH1F*)h1->Clone(title); hdiff->SetTitle(""); hdiff->SetDirectory(0); hdiff->GetYaxis()->SetTitle("Ratio"); hdiff->GetXaxis()->SetTitle("Reconstructed Energy (GeV)"); hdiff->Divide(h2); return hdiff; } void appearance_nu_mode_0() { //Draw a simple graph // To see the output of this macro, click begin_html here. end_html //Author: Rene Brun TCanvas *c1 = new TCanvas("c1","",200,10,700,500); //nu_e appearance TH1F *h1 = new TH1F("h1", "", 26,0,1.30); h1->Fill(0.125,1.60922); h1->Fill(0.175,3.05942); h1->Fill(0.225,5.75957); h1->Fill(0.275,11.8062); h1->Fill(0.325,24.758); h1->Fill(0.375,47.8973); h1->Fill(0.425,81.7934); h1->Fill(0.475,122.868); h1->Fill(0.525,163.382); h1->Fill(0.575,193.101); h1->Fill(0.625,203.343); h1->Fill(0.675,191.818); h1->Fill(0.725,164.035); h1->Fill(0.775,129.483); h1->Fill(0.825,96.2166); h1->Fill(0.875,68.3369); h1->Fill(0.925,46.8252); h1->Fill(0.975,31.2428); h1->Fill(1.025,20.6445); h1->Fill(1.075,13.8264); h1->Fill(1.125,9.4905); h1->Fill(1.175,6.51014); h1->Fill(1.225,4.1921); h1->SetLineColor(2); h1->SetLineWidth(2); h1->SetTitle("Appearance #nu mode (#delta_{CP} =0)"); h1->GetXaxis()->SetTitle("Reconstructed Energy E^{rec}_{#nu} (GeV)"); h1->GetYaxis()->SetTitle("Number of events/50MeV"); h1->GetYaxis()->SetRangeUser(0,250); h1->GetXaxis()->SetRangeUser(0,1.30); h1->Draw(""); //nu_e bar appearance TH1F *h2 = new TH1F("h2", "", 26,0,1.30); h2->Fill(0.125,0.082745); h2->Fill(0.175,0.114677); h2->Fill(0.225,0.132785); h2->Fill(0.275,0.146006); h2->Fill(0.325,0.185848); h2->Fill(0.375,0.28219); h2->Fill(0.425,0.437074); h2->Fill(0.475,0.624376); h2->Fill(0.525,0.808494); h2->Fill(0.575,0.959544); h2->Fill(0.625,1.05822); h2->Fill(0.675,1.09738); h2->Fill(0.725,1.08334); h2->Fill(0.775,1.03284); h2->Fill(0.825,0.964524); h2->Fill(0.875,0.891235); h2->Fill(0.925,0.818524); h2->Fill(0.975,0.747593); h2->Fill(1.025,0.677634); h2->Fill(1.075,0.605478); h2->Fill(1.125,0.523809); h2->Fill(1.175,0.423071); h2->Fill(1.225,0.302594); h2->SetLineColor(3); h2->SetLineWidth(2); h2->Draw("same"); auto hdiff = makeRatio(h1,h2, "Ratio"); hdiff->SetLineColor(4); hdiff->Draw("same"); }