Double_t Bidim(Double_t *x, Double_t *par){ // Gaussian bidim with 45deg inclination Double_t sqrt2=0.707106; Double_t arg1=0; Double_t arg2=0; Double_t fitval=0; arg1 = x[0]*sqrt2 + x[1]*sqrt2; arg2 = (-x[0]*sqrt2 + x[1]*sqrt2)/2; fitval = TMath::Exp(-0.5*arg1*arg1)*TMath::Exp(-0.5*arg2*arg2); return fitval; } Double_t fitf(Double_t *x, Double_t *par) { Double_t arg = 0; Double_t fitval = par[1]*x[0]+par[0]; return fitval; } void grph() { TH2F *plot1 = new TH2F("plot1","",100,-6,6,100,-6,6);//grid1 for the plots TH2F *plot2 = new TH2F("plot2","",300,-6,6,100,-2,2);//grid2 for the plots TF2 *mybidim = new TF2("bidim",Bidim,-3,3,-3,3,1);//bidim to plot TF1 *myline = new TF1("myline",fitf,-3,3,2);//line going through major axis myline->SetParameters(0,-1); mybidim->SetContour(4); c1 = new TCanvas("c1","",300,10,600,700); c1.Draw(); mybidim->SetLineWidth(1); myline->SetLineWidth(1); myline->SetLineColor(2); plot1.Draw(); mybidim->Draw("colsame"); mybidim->Draw("same"); myline->Draw("same"); /////////////// TLine *line = new TLine(-4.07718,1.38393,-0.981544,0.982143); line->Draw(); line = new TLine(-0.729866,1.20536,1.03188,2.23214); line->Draw(); tex = new TLatex(-5.18456,1.45089,"Point 1"); tex->SetTextSize(0.0327381); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(1.23322,2.25446,"Point 2"); tex->SetTextSize(0.0267857); tex->SetLineWidth(2); tex->Draw(); /////////////// c2 = new TCanvas("c2","",300,10,600,700); c2.Draw(); TLine *l1 = new TLine(6,-6,-6,6); TLine *l2 = new TLine(-6,-6,6,6); plot2.Draw(); mybidim->Draw("Colsame"); mybidim->Draw("same"); myline->Draw("same"); l1->Draw(); l2->Draw(); /////////////// TLine *line = new TLine(-4.07718,1.38393,-0.981544,0.982143); line->Draw(); line = new TLine(-0.729866,1.20536,1.03188,2.23214); line->Draw(); tex = new TLatex(-5.18456,1.45089,"Point 1"); tex->SetTextSize(0.0327381); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(1.23322,2.25446,"Point 2"); tex->SetTextSize(0.0267857); tex->SetLineWidth(2); tex->Draw(); /////////////// }