TH2F* histo = new TH2F("histo", "2D Histogram", 20, -10, 10, 20, -10, 10); histo->Fill(0, 0); histo->Draw("colz");
TH2F* histo = new TH2F("histo", "2D Histogram", 20, -10, 10, 20, -10, 10); for(int i = 0; i < 1000; i++) { double x = gRandom->Gaus(0, 1); double y = gRandom->Gaus(0, 1); histo->Fill(x, y); } histo->Draw("hist");In this example, we create a 2D histogram with the name "histo" and the title "2D Histogram". We fill the histogram with 1000 random values, generated using the Gaussian distribution from the ROOT package. Finally, we draw the histogram using the "hist" option, which displays it as a 2D histogram with borders drawn around each bin. Overall, TH2F Draw provides an easy-to-use interface for creating and manipulating 2D histograms in C++. The package library is ROOT, which is a data analysis framework used primarily in high energy physics.