Hi, I am trying to overlay two THStack possessing 2 TH1F each. It works just fine except for a minor detail. For the THStack that gets drawn on top, the TH1F at the bottom has become opaque (but not in the sense of an opaque filling, I’ll attach an example ), so that you can’t see the shape of the other THStack behind it.
Here is the operational code:
...
colorNP3p = TColor::GetColor("#e60000");
colorNP1p = TColor::GetColor("#ee7700");
colorP3p = TColor::GetColor("#009900");
colorP1p = TColor::GetColor("#0033cc");
histo_nopileup1p->SetLineColor(colorNP1p);
histo_nopileup1p->SetFillStyle(3354);
histo_nopileup1p->SetFillColor(colorNP1p);
histo_nopileup1p->SetLineWidth(4);
histo_nopileup3p->SetLineColor(colorNP3p);
histo_nopileup3p->SetFillStyle(3154);
histo_nopileup3p->SetFillColor(colorNP3p);
histo_nopileup3p->SetLineWidth(4);
histo_pileup1p->SetLineColor(colorP1p);
histo_pileup1p->SetFillStyle(3345);
histo_pileup1p->SetFillColor(colorP1p);
histo_pileup1p->SetLineWidth(2);
histo_pileup3p->SetLineColor(colorP3p);
histo_pileup3p->SetFillStyle(3145);
histo_pileup3p->SetFillColor(colorP3p);
histo_pileup3p->SetLineWidth(2);
THStack* hstack_nopileup = new THStack("hstacksignal", "");
THStack* hstack_pileup = new THStack("hstackpileup", "");
hstack_nopileup->Add(histo_nopileup3p);
hstack_nopileup->Add(histo_nopileup1p);
hstack_pileup->Add(histo_pileup3p);
hstack_pileup->Add(histo_pileup1p);
hstack_nopileup->Draw();
c1->Update();
hstack_nopileup->GetXaxis()->SetTitle(label[var_idx]);
hstack_nopileup->GetXaxis()->SetTitleFont(62);
hstack_nopileup->GetYaxis()->SetTitle("normalized");
hstack_nopileup->GetYaxis()->SetTitleFont(62);
hstack_pileup->Draw();
c1->Update();
hstack_pileup->GetXaxis()->SetTitle(label[var_idx]);
hstack_pileup->GetXaxis()->SetTitleFont(62);
hstack_pileup->GetYaxis()->SetTitle("normalized");
hstack_pileup->GetYaxis()->SetTitleFont(62);
// Drawing the histograms
float nopileup_max = hstack_nopileup->GetMaximum();
float pileup_max = hstack_pileup->GetMaximum();
float yaxismax = max(pileup_max, nopileup_max);
hstack_nopileup->SetMaximum(yaxismax);
hstack_pileup->SetMaximum(yaxismax);
hstack_pileup->GetXaxis()->SetNdivisions(506);
hstack_nopileup->GetXaxis()->SetNdivisions(506);
hstack_nopileup->Draw();
hstack_pileup->Draw("SAME");
...
Have a look at the attached plot to see exactly what I mean. I would like to see the red distribution behind the green one.