// Draw a Bidimensional Histogram in many ways // together with its profiles and projections void macro7(){ gROOT->SetStyle("Plain"); gStyle->SetPalette(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); TH2F bidi_h("bidi_h","2D Histo;Guassian Vals;Exp. Vals", 30,-5,5, // X axis 30,0,10); // Y axis TRandom3 rndgen; for (int i=0;i<500000;i++){ bidi_h.Fill(rndgen.Gaus(0,2),10-rndgen.Exp(4));} TCanvas* c=new TCanvas("Canvas","Canvas",625,625); c->Divide(2,2); c->cd(1); bidi_h.DrawClone("Cont1"); c->cd(2); bidi_h.DrawClone("Colz"); c->cd(3); bidi_h.DrawClone("lego2"); c->cd(4); bidi_h.DrawClone("surf3"); //Profiles and Projections TCanvas* c2=new TCanvas("Canvas2","Canvas2",625,625); c2->Divide(2,2); c2->cd(1); bidi_h.ProjectionX()->DrawClone(); c2->cd(2); bidi_h.ProjectionY()->DrawClone(); c2->cd(3); bidi_h.ProfileX()->DrawClone(); c2->cd(4); bidi_h.ProfileY()->DrawClone(); }