//*CMZ : 1.03/09 05/12/97 14.21.36 by Fons Rademakers
//*-- Author : Rene Brun 27/10/95
//*KEEP,CopyRight,T=C.
/*************************************************************************
* Copyright(c) 1995-1998, The ROOT System, All rights reserved. *
* Authors: Rene Brun, Nenad Buncic, Valery Fine, Fons Rademakers. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation for non-commercial purposes is hereby granted without *
* fee, provided that the above copyright notice appears in all copies *
* and that both the copyright notice and this permission notice appear *
* in the supporting documentation. The authors make no claims about the *
* suitability of this software for any purpose. *
* It is provided "as is" without express or implied warranty. *
*************************************************************************/
//*KEND.
//*KEEP,TROOT.
#include "TROOT.h"
//*KEEP,TF3.
#include "TF3.h"
//*KEEP,TMath.
#include "TMath.h"
//*KEEP,TH3.
#include "TH3.h"
//*KEEP,TVirtualPad.
#include "TVirtualPad.h"
//*KEND.
ClassImp(TF3)
//______________________________________________________________________________
//
// a 3-Dim function with parameters
//
//______________________________________________________________________________
TF3::TF3(): TF2()
{
//*-*-*-*-*-*-*-*-*-*-*F3 default constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-* ======================
}
//______________________________________________________________________________
TF3::TF3(const char *name,const char *formula, Float_t xmin, Float_t ymin, Float_t zmin, Float_t xmax, Float_t ymax, Float_t zmax)
:TF2(name,formula,xmin,ymin,xmax,ymax)
{
//*-*-*-*-*-*-*F3 constructor using a formula definition*-*-*-*-*-*-*-*-*-*-*
//*-* =========================================
//*-*
//*-* See TFormula constructor for explanation of the formula syntax.
//*-*
//*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
fZmin = zmin;
fZmax = zmax;
fNpz = 30;
}
//______________________________________________________________________________
TF3::TF3(const char *name, Double_t (*fcn)(Double_t *, Double_t *), Int_t npar)
:TF2(name,fcn, npar)
{
//*-*-*-*-*-*-*F3 constructor using a pointer to real function*-*-*-*-*-*-*-*
//*-* ===============================================
//*-*
//*-* npar is the number of free parameters used by the function
//*-*
//*-* For example, for a 2-dim function with 3 parameters, the user function
//*-* looks like:
//*-* Double_t fun1(Double_t *x, Double_t *par)
//*-* return par[0] + par[1]*exp(par[2]*x[0]*x[1]);
//*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
fZmin = 0;
fZmax = 1;
fNpz = 30;
}
//______________________________________________________________________________
TF3::~TF3()
{
//*-*-*-*-*-*-*-*-*-*-*F3 default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-* =====================
}
//______________________________________________________________________________
TF3::TF3(const TF3 &f3)
{
((TF3&)f3).Copy(*this);
}
//______________________________________________________________________________
void TF3::Copy(TObject &obj)
{
//*-*-*-*-*-*-*-*-*-*-*Copy this F3 to a new F3*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-* ========================
TF2::Copy(obj);
((TF3&)obj).fZmin = fZmin;
((TF3&)obj).fZmax = fZmax;
((TF3&)obj).fNpz = fNpz;
}
//______________________________________________________________________________
Int_t TF3::DistancetoPrimitive(Int_t px, Int_t py)
{
//*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a function*-*-*-*-*
//*-* ===============================================
//*-* Compute the closest distance of approach from point px,py to this function.
//*-* The distance is computed in pixels units.
//*-*
//*-* Algorithm:
//*-*
//*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
return TF1::DistancetoPrimitive(px, py);
}
//______________________________________________________________________________
void TF3::Draw(Option_t *option)
{
//*-*-*-*-*-*-*-*-*-*-*Draw this function with its current attributes*-*-*-*-*
//*-* ==============================================
TString opt = option;
opt.ToLower();
if (!opt.Contains("s")) gPad->Clear();
AppendPad(option);
}
//______________________________________________________________________________
void TF3::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
//*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
//*-* =========================================
//*-* This member function is called when a F3 is clicked with the locator
//*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
TF1::ExecuteEvent(event, px, py);
}
//______________________________________________________________________________
void TF3::GetRange(Float_t &xmin, Float_t &ymin, Float_t &zmin, Float_t &xmax, Float_t &ymax, Float_t &zmax)
{
//*-*-*-*-*-*-*-*-*-*-*Return range of function*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-* ========================
xmin = fXmin;
xmax = fXmax;
ymin = fYmin;
ymax = fYmax;
zmin = fZmin;
zmax = fZmax;
}
//______________________________________________________________________________
void TF3::Paint(Option_t *)
{
//*-*-*-*-*-*-*-*-*Paint this 2-D function with its current attributes*-*-*-*-*
//*-* ===================================================
}
//______________________________________________________________________________
void TF3::SetNpz(Int_t npz)
{
//*-*-*-*-*-*-*-*Set the number of points used to draw the function*-*-*-*-*-*
//*-* ==================================================
if(npz > 4 && npz < 1000) fNpz = npz;
}
//______________________________________________________________________________
void TF3::SetRange(Float_t xmin, Float_t ymin, Float_t zmin, Float_t xmax, Float_t ymax, Float_t zmax)
{
//*-*-*-*-*-*Initialize the upper and lower bounds to draw the function*-*-*-*
//*-* ==========================================================
fXmin = xmin;
fXmax = xmax;
fYmin = ymin;
fYmax = ymax;
fZmin = zmin;
fZmax = zmax;
}
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.