TH1D* hist = new TH1D("hist", "Distribution", 100, 0, 1); hist->FillRandom("gaus", 10000); hist->SetLineWidth(2); hist->Draw();
TH1D* hist = new TH1D("hist", "Distribution", 100, 0, 1); hist->FillRandom("gaus", 10000); hist->SetLineWidth(0); hist->SetLineColor(kRed); TH1D* hist2 = hist->DrawCopy(); hist2->SetLineWidth(2); hist2->Draw("same");In this example, we create a histogram with 100 bins and fill it with 10,000 random numbers from a Gaussian distribution. We then set the line width of the first histogram to 0 and the line color to red. We make a copy of the histogram and set the line width of the copy to 2. We then draw both histograms on the same canvas. Package library for TH1D is ROOT.