Restricting Range of TF2

Hi,
I am trying to plot a contour, but am not sure how to restrict the z axis.

#include “TF1.h”
#include “TMath.h”
#include “TCanvas.h”
#include "Math.h"
gSystem->Load(“libMathMore”);
using namespace ROOT::Math;
using namespace std;

TF2 *f2;
Double_t myfunction(Double_t *, Double_t *);

void main()
{
//Draw 2-Dim function

TCanvas *c1 = new TCanvas(“c1”,“Differential Cross-Section of Compton Electrons”,200,10,700,900);
c1->SetFillColor(42);
gStyle->SetFrameFillColor(42);
title = new TPaveText(.2,0.96,.8,.995);
title->SetFillColor(33);
title->AddText(“Cross-Section”);
title->Draw();

pad1 = new TPad(“pad1”,“Compton Cross-Section”,0.03,0.50,0.98,0.95,21);
pad1->Draw();
//
// We generate a 2-D function
f2 = new TF2(“f2”,myfunction,59, 61, 0, 16, 2);

f2->SetParameters(3.88pow(10, -53), 3.914pow(10, -3), 3.83*pow(10, -6));
f2->SetContour(48);
f2->SetFillColor(45);

// Draw this function in pad1 with Gouraud shading option
pad1->cd();
pad1->SetPhi(-80);
pad1->SetLogz();
f2->Draw(“surf4”);

//add axis titles. The titles are set on the intermediate
//histogram used for visualisation. We must force this histogram
//to be created, then force the redrawing of the two pads
f2->GetHistogram()->GetXaxis()->SetTitle(“x title”);
f2->GetHistogram()->GetYaxis()->SetTitle(“y title”);
f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
f2->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
pad1->Modified();
}

Double_t myfunction(Double_t x, Double_t par)
{
const Double_t pi = TMath::Pi();
//cout << par[1] << endl;
Double_t y = x[0];
Double_t z = x[1];
Double_t f = 0;
Double_t a = par[0]/pow(y, 2);
Double_t b = (par[1]z)/(y(y-z));
Double_t c = (par[2]pow(z, 2))/(pow(y, 2)(y-z)(y-z));
Double_t f = (2
y
y)/(510.9989+(2
y));
Double_t d = pow(z, 2)/(y*(y-z));
if (y < (f-.1) && y > 0) f = a(2-b+c+d);
return y;
}

If y’all have any ideas they would be greatly appreciated!

Thank you in advance,
Natasha

Oh, and I also tried SetRange and it did not work:

#include “TF1.h”
#include “TMath.h”
#include “TCanvas.h”
#include "Math.h"
gSystem->Load(“libMathMore”);
using namespace ROOT::Math;
using namespace std;

TF2 *f2;
Double_t myfunction(Double_t *, Double_t *);

void main()
{
//Draw 2-Dim function

TCanvas *c1 = new TCanvas(“c1”,“Differential Cross-Section of Compton Electrons”,200,10,700,900);
c1->SetFillColor(42);
gStyle->SetFrameFillColor(42);
title = new TPaveText(.2,0.96,.8,.995);
title->SetFillColor(33);
title->AddText(“Cross-Section”);
title->Draw();

pad1 = new TPad(“pad1”,“Compton Cross-Section”,0.03,0.50,0.98,0.95,21);
pad1->Draw();
//
// We generate a 2-D function
f2 = new TF2(“f2”,myfunction,59, 61, 0, 16, 2);

f2->SetParameters(4.88pow(10, -28), 3.914pow(10, -3), 3.83*pow(10, -6));
f2->SetContour(48);
f2->SetRange(59, 0, 0, 61, 16, pow(10, -25));
f2->Update();
f2->SetFillColor(45);

// Draw this function in pad1 with Gouraud shading option
pad1->cd();
pad1->SetPhi(-80);
pad1->SetLogz();
f2->Draw(“surf4”);

//add axis titles. The titles are set on the intermediate
//histogram used for visualisation. We must force this histogram
//to be created, then force the redrawing of the two pads
f2->GetHistogram()->GetXaxis()->SetTitle(“x title”);
f2->GetHistogram()->GetYaxis()->SetTitle(“y title”);
f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
f2->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
pad1->Modified();
}

Double_t myfunction(Double_t x, Double_t par)
{
const Double_t pi = TMath::Pi();
//cout << par[1] << endl;
Double_t y = x[0];
Double_t z = x[1];
Double_t f = 0;
Double_t a = par[0]/pow(y, 2);
Double_t b = (par[1]z)/(y(y-z));
Double_t c = (par[2]pow(z, 2))/(pow(y, 2)(y-z)(y-z));
Double_t f = (2
y
y)/(510.9989+(2
y));
Double_t d = pow(z, 2)/(y*(y-z));
if (y < (f-.1) && y > 0) f = a(2-b+c+d);
return y;
}