void anil() { TCanvas *c1 = new TCanvas("c1","c1",600,800); c1->Divide(1,2); TRandom3 r; TRandom3 r2; double err=2; double x,y; double xmin = 0; double xmax = 100; double ymin = 0; double ymax = 1; TF1 *f1 = new TF1("f1","1/x",xmin+0.1,xmax); f1->SetNpx(10000); TH2F *h2 = new TH2F("h2","test",100,xmin,xmax,100,ymin,ymax); int i,j; for (i=0;i<10000;i++) { y = f1->GetRandom(); x = r.Uniform(xmin,xmax); r2.Gaus(0,err); h2->Fill(x+r2.Gaus(0,err),0.1/y); h2->Fill(x+r2.Gaus(0,err),0.2/y); h2->Fill(x+r2.Gaus(0,err),0.3/y); } c1->cd(1); h2->Draw(); c1->cd(2); //transform dedx vs e into e*dedx vs e TH2F *h2e = new TH2F("h2e","h2e",100,xmin,xmax,100,xmin*ymin,0.2*xmax*ymax); for (j=1;j<=100;j++) { y = h2->GetYaxis()->GetBinCenter(j); for (i=1;i<=100;i++) { x = h2->GetXaxis()->GetBinCenter(i); h2e->Fill(x,y*x,h2->GetBinContent(i,j)); } } h2e->Draw(); }