/* There are 3 histograms to plot a band and a center distribution. */ multihist() { TCanvas * can = new TCanvas("can", "can", 400, 300); can->cd(); /*create 3 histograms */ //this is the up limit of the band TH1F * h_up = new TH1F("h_up", "h_up", 50, -1, 1); TAxis * ay = h_up->GetYaxis(); ay->SetRangeUser(50, 900); h_up->FillRandom("gaus", 25000); //this is the center distribution TH1F * h_center = new TH1F("h_center", "h_center", 50, -1, 1); h_center->FillRandom("gaus", 20000); //this is the down limit of the band TH1F * h_down = new TH1F("h_down", "h_down", 50, -1, 1); h_down->FillRandom("gaus", 15000); h_up->SetFillColor(17); h_up->SetLineColor(0); h_down->SetFillColor(10); h_down->SetLineColor(0); //draw them on the same canvas //h_up->Draw("]["); //h_down->Draw("same ]["); //h_center->Draw("same"); THStack *hs = new THStack("hs","band"); hs->Add(h_up); hs->Add(h_down); hs->Add(h_center); hs->Draw("nostack"); /* below are codes to add new axis*/ // TGaxis *axis = new TGaxis(ax->GetXmin(), // ay->GetBinLowEdge(ay->GetFirst()), // ax->GetXmax(), // ay->GetBinLowEdge(ay->GetFirst()), // ax->GetXmin(), // ax->GetXmax(), // 510,"+"); // axis->SetName("axis"); // axis->SetTickSize(72); // axis->SetTextFont(72); // axis->Draw(); }