Scaling in stack plots

Dear Experts,

I am trying to make stack plot, where each of the histograms have to be scaled. Here is my macros

void compare(){

Double_t L = 36.0; //Luminosity=36fb

TCanvas *c = new TCanvas("c","pT",900,700);
//gStyle->SetPalette(kOcean);


//GGJets 80toInf//

TFile *f1 = new TFile("GGJets80toInf_skim.root");
f1->cd();
TTree *tr1 = (TTree*)f1->Get("H4GSel");
TH1D *h1 = new TH1D("h1","h1",100,0,200);
tr1->Project("h1","dp1_mass");
h1->Scale(L*84.4*1000/27363279.712975); //Luminosity*Crosssection/Weight
h1->SetFillStyle(1001);
h1->SetFillColor(kOrange-2);

//GGJets 40to80//
TFile *f2 = new TFile("GGJets40to80_skim.root");
f2->cd();
TTree *tr2 = (TTree*)f2->Get("H4GSel");
TH1D *h2 = new TH1D("h2","h2",100,0,200);
tr2->Project("h2","dp1_mass");
h2->Scale(L*303.2*1000/3601376.531525);
h2->SetFillStyle(1001);
h2->SetFillColor(kGray+1);



THStack *s = new THStack("s","dp1_mass");
s->Add(h1);
s->Add(h2);


s->Draw();

c->SetLogy();
c->SaveAs("testing.png");

}

The problem is that the scaling is doing something weird to my plots. If I including the scaling then my plot looks like

However, if I comment out the scaling part then the stack plot looks fine.
Can anyone please tell me what is the correct way to scale plots before putting them into THStack?

Thanks,
Tanvi

Hi,

what is the actual problem with the histogram you plot?

Cheers,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.