{ TH2F h3 ("h3", "histogram title", 100, -5.0 , 5.0, 200, 0.0, 1.0); // Create a 1D histogram object of floats TF2 func ("gaus2","xgaus(0)*ygaus(3)"); // Create a 2-param gaussian distribution function // Set the parameters of the function we created: func.SetParameters(1. , 0., 1., // Set the parameters of the first gaussian to N=1, mean=0, sigma=1 1. , 0.5, 0.1); // Set the parameters of the second gaussian to N=1, mean=0.5, sigma=0.1 h3.FillRandom("gaus2",1000000); // Calls the FillRandom function of the TH1F class which fills the histogram with 10000 gaus-distributed events gStyle->SetPalette(1); // Sets a better-looking color-palette than the default ROOT one h3.Draw("COLZ"); // Draw the histogram }