Logo ROOT   6.18/05
Reference Guide
TF2.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 23/08/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TROOT.h"
13#include "TF2.h"
14#include "TMath.h"
15#include "TRandom.h"
16#include "TH2.h"
17#include "TVirtualPad.h"
18#include "TStyle.h"
19#include "Riostream.h"
20#include "TColor.h"
21#include "TVirtualFitter.h"
22#include "TClass.h"
24
26
27/** \class TF2
28 \ingroup Hist
29A 2-Dim function with parameters.
30
31### Expression using variables x and y
32
33Begin_Macro (source)
34{
35 TF2 *f2 = new TF2("f2","sin(x)*sin(y)/(x*y)",0,5,0,5);
36 f2->Draw();
37}
38End_Macro
39
40### Expression using a user defined function
41
42~~~~{.cpp}
43Double_t func(Double_t *val, Double_t *par)
44{
45 Float_t x = val[0];
46 Float_t y = val[1];
47 Double_t f = x*x-y*y;
48 return f;
49}
50
51void fplot()
52{
53 TF2 *f = new TF2("f",func,-1,1,-1,1);
54 f->Draw("surf1");
55}
56~~~~
57
58See TF1 class for the list of functions formats
59*/
60
61////////////////////////////////////////////////////////////////////////////////
62/// TF2 default constructor
63
64TF2::TF2(): TF1(),fYmin(0),fYmax(0),fNpy(100)
65{
66}
67
68
69////////////////////////////////////////////////////////////////////////////////
70/// F2 constructor using a formula definition
71///
72/// See TFormula constructor for explanation of the formula syntax.
73///
74/// If formula has the form "fffffff;xxxx;yyyy", it is assumed that
75/// the formula string is "fffffff" and "xxxx" and "yyyy" are the
76/// titles for the X and Y axis respectively.
77
78TF2::TF2(const char *name,const char *formula, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Option_t * opt)
79 :TF1(name,formula,xmax,xmin,opt)
80{
81 if (ymin < ymax) {
82 fYmin = ymin;
83 fYmax = ymax;
84 } else {
85 fYmin = ymax;
86 fYmax = ymin;
87 }
88 fNpx = 30;
89 fNpy = 30;
90 fContour.Set(0);
91 // accept 1-d formula
92 if (GetNdim() < 2) fNdim = 2;
93 // dimension is obtained by TFormula
94 // accept cases where formula dim is less than 2
95 if (GetNdim() > 2 && xmin < xmax && ymin < ymax) {
96 Error("TF2","function: %s/%s has dimension %d instead of 2",name,formula,GetNdim());
97 MakeZombie();
98 }
99}
100
101
102////////////////////////////////////////////////////////////////////////////////
103/// F2 constructor using a pointer to a compiled function
104///
105/// npar is the number of free parameters used by the function
106///
107/// This constructor creates a function of type C when invoked
108/// with the normal C++ compiler.
109///
110/// WARNING! A function created with this constructor cannot be Cloned.
111
113 : TF1(name, fcn, xmin, xmax, npar,ndim)
114{
115 fYmin = ymin;
116 fYmax = ymax;
117 fNpx = 30;
118 fNpy = 30;
119 fContour.Set(0);
120
121}
122
123////////////////////////////////////////////////////////////////////////////////
124/// F2 constructor using a pointer to a compiled function
125///
126/// npar is the number of free parameters used by the function
127///
128/// This constructor creates a function of type C when invoked
129/// with the normal C++ compiler.
130///
131/// WARNING! A function created with this constructor cannot be Cloned.
132
133TF2::TF2(const char *name, Double_t (*fcn)(const Double_t *, const Double_t *), Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, Int_t ndim)
134 : TF1(name, fcn, xmin, xmax, npar,ndim)
135{
136 fYmin = ymin;
137 fYmax = ymax;
138 fNpx = 30;
139 fNpy = 30;
140 fContour.Set(0);
141
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// F2 constructor using a ParamFunctor,
146/// a functor class implementing operator() (double *, double *)
147///
148/// npar is the number of free parameters used by the function
149///
150/// WARNING! A function created with this constructor cannot be Cloned.
151
153 : TF1(name, f, xmin, xmax, npar,ndim)
154{
155 fYmin = ymin;
156 fYmax = ymax;
157 fNpx = 30;
158 fNpy = 30;
159 fContour.Set(0);
160
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Operator =
165
167{
168 if (this != &rhs) {
169 rhs.Copy(*this);
170 }
171 return *this;
172}
173
174////////////////////////////////////////////////////////////////////////////////
175/// F2 default destructor
176
178{
179}
180
181////////////////////////////////////////////////////////////////////////////////
182/// Copy constructor.
183
184TF2::TF2(const TF2 &f2) : TF1()
185{
186 ((TF2&)f2).Copy(*this);
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Copy this F2 to a new F2
191
192void TF2::Copy(TObject &obj) const
193{
194 TF1::Copy(obj);
195 ((TF2&)obj).fYmin = fYmin;
196 ((TF2&)obj).fYmax = fYmax;
197 ((TF2&)obj).fNpy = fNpy;
198 fContour.Copy(((TF2&)obj).fContour);
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Compute distance from point px,py to a function
203///
204/// \param[in] px x position
205/// \param[in] py y position
206///
207/// Compute the closest distance of approach from point px,py to this function.
208/// The distance is computed in pixels units.
209
211{
212 if (!fHistogram) return 9999;
213 Int_t distance = fHistogram->DistancetoPrimitive(px,py);
214 if (distance <= 1) return distance;
215
216 Double_t x = gPad->PadtoX(gPad->AbsPixeltoX(px));
217 Double_t y = gPad->PadtoY(gPad->AbsPixeltoY(py));
218 const char *drawOption = GetDrawOption();
219 Double_t uxmin,uxmax;
220 Double_t uymin,uymax;
221 if (gPad->GetView() || strncmp(drawOption,"cont",4) == 0
222 || strncmp(drawOption,"CONT",4) == 0) {
223 uxmin=gPad->GetUxmin();
224 uxmax=gPad->GetUxmax();
225 x = fXmin +(fXmax-fXmin)*(x-uxmin)/(uxmax-uxmin);
226 uymin=gPad->GetUymin();
227 uymax=gPad->GetUymax();
228 y = fYmin +(fYmax-fYmin)*(y-uymin)/(uymax-uymin);
229 }
230 if (x < fXmin || x > fXmax) return distance;
231 if (y < fYmin || y > fYmax) return distance;
232 return 0;
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// Draw this function with its current attributes
237///
238/// NB. You must use DrawCopy if you want to draw several times the same
239/// function in the current canvas.
240
241void TF2::Draw(Option_t *option)
242{
243 TString opt = option;
244 opt.ToLower();
245 if (gPad && !opt.Contains("same")) gPad->Clear();
246
247 AppendPad(option);
248}
249
250////////////////////////////////////////////////////////////////////////////////
251/// Draw a copy of this function with its current attributes-*
252///
253/// This function MUST be used instead of Draw when you want to draw
254/// the same function with different parameters settings in the same canvas.
255///
256/// Possible option values are:
257///
258/// option | description
259/// ---------|------------
260/// "SAME" | superimpose on top of existing picture
261/// "L" | connect all computed points with a straight line
262/// "C" | connect all computed points with a smooth curve.
263///
264/// Note that the default value is "F". Therefore to draw on top
265/// of an existing picture, specify option "SL"
266
267
269{
270 TF2 *newf2 = new TF2();
271 Copy(*newf2);
272 newf2->AppendPad(option);
273 newf2->SetBit(kCanDelete);
274 return newf2;
275}
276
277// remove this function
278//______________________________________________________________________________
279// void TF2::DrawF2(const char *formula, Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Option_t *option)
280// {
281// //----Draw formula between xmin,ymin and xmax,ymax---
282// // ============================================
283// //
284
285// //if (Compile((char*)formula)) return;
286
287// SetRange(xmin, ymin, xmax, ymax);
288
289// Draw(option);
290
291// }
292
293////////////////////////////////////////////////////////////////////////////////
294/// Execute action corresponding to one event
295///
296/// This member function is called when a F2 is clicked with the locator
297
299{
300 TF1::ExecuteEvent(event, px, py);
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Return contour values into array levels
305///
306/// The number of contour levels can be returned by getContourLevel
307
309{
310 Int_t nlevels = fContour.fN;
311 if (levels) {
312 for (Int_t level=0; level<nlevels; level++) levels[level] = GetContourLevel(level);
313 }
314 return nlevels;
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Return the number of contour levels
319
321{
322 if (level <0 || level >= fContour.fN) return 0;
323 if (fContour.fArray[0] != -9999) return fContour.fArray[level];
324 if (fHistogram == 0) return 0;
325 return fHistogram->GetContourLevel(level);
326}
327
328////////////////////////////////////////////////////////////////////////////////
329/// Return minimum/maximum value of the function
330///
331/// To find the minimum on a range, first set this range via the SetRange function.
332/// If a vector x of coordinate is passed it will be used as starting point for the minimum.
333/// In addition on exit x will contain the coordinate values at the minimuma
334///
335/// If x is NULL or x is infinity or NaN, first, a grid search is performed to find the initial estimate of the
336/// minimum location. The range of the function is divided into fNpx and fNpy
337/// sub-ranges. If the function is "good" (or "bad"), these values can be changed
338/// by SetNpx and SetNpy functions
339///
340/// Then, a minimization is used with starting values found by the grid search
341/// The minimizer algorithm used (by default Minuit) can be changed by callinga
342/// ROOT::Math::Minimizer::SetDefaultMinimizerType("..")
343/// Other option for the minimizer can be set using the static method of the MinimizerOptions class
344
346{
347 //First do a grid search with step size fNpx and fNpy
348
349 Double_t xx[2];
350 Double_t rsign = (findmax) ? -1. : 1.;
351 TF2 & function = const_cast<TF2&>(*this); // needed since EvalPar is not const
352 Double_t xxmin = 0, yymin = 0, zzmin = 0;
353 if (x == NULL || ( (x!= NULL) && ( !TMath::Finite(x[0]) || !TMath::Finite(x[1]) ) ) ){
354 Double_t dx = (fXmax - fXmin)/fNpx;
355 Double_t dy = (fYmax - fYmin)/fNpy;
356 xxmin = fXmin;
357 yymin = fYmin;
358 zzmin = rsign * TMath::Infinity();
359 for (Int_t i=0; i<fNpx; i++){
360 xx[0]=fXmin + (i+0.5)*dx;
361 for (Int_t j=0; j<fNpy; j++){
362 xx[1]=fYmin+(j+0.5)*dy;
363 Double_t zz = function(xx);
364 if (rsign*zz < rsign*zzmin) {xxmin = xx[0], yymin = xx[1]; zzmin = zz;}
365 }
366 }
367
368 xxmin = TMath::Min(fXmax, xxmin);
369 yymin = TMath::Min(fYmax, yymin);
370 }
371 else {
372 xxmin = x[0];
373 yymin = x[1];
374 zzmin = function(xx);
375 }
376 xx[0] = xxmin;
377 xx[1] = yymin;
378
379 double fmin = GetMinMaxNDim(xx,findmax);
380 if (rsign*fmin < rsign*zzmin) {
381 if (x) {x[0] = xx[0]; x[1] = xx[1]; }
382 return fmin;
383 }
384 // here if minimization failed
385 if (x) { x[0] = xxmin; x[1] = yymin; }
386 return zzmin;
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Compute the X and Y values corresponding to the minimum value of the function
391///
392/// Return the minimum value of the function
393/// To find the minimum on a range, first set this range via the SetRange function
394///
395/// Method:
396/// First, a grid search is performed to find the initial estimate of the
397/// minimum location. The range of the function is divided into fNpx and fNpy
398/// sub-ranges. If the function is "good" (or "bad"), these values can be changed
399/// by SetNpx and SetNpy functions
400/// Then, a minimization is used with starting values found by the grid search
401/// The minimizer algorithm used (by default Minuit) can be changed by callinga
402/// ROOT::Math::Minimizer::SetDefaultMinimizerType("..")
403/// Other option for the minimizer can be set using the static method of the MinimizerOptions class
404///
405/// Note that this method will always do first a grid search in contrast to GetMinimum
406
408{
409 double xx[2] = { 0,0 };
410 xx[0] = TMath::QuietNaN(); // to force to do grid search in TF2::FindMinMax
411 double fmin = FindMinMax(xx, false);
412 x = xx[0]; y = xx[1];
413 return fmin;
414}
415
416////////////////////////////////////////////////////////////////////////////////
417/// Compute the X and Y values corresponding to the maximum value of the function
418///
419/// Return the maximum value of the function
420/// See TF2::GetMinimumXY
421
423{
424 double xx[2] = { 0,0 };
425 xx[0] = TMath::QuietNaN(); // to force to do grid search in TF2::FindMinMax
426 double fmax = FindMinMax(xx, true);
427 x = xx[0]; y = xx[1];
428 return fmax;
429}
430
431
432////////////////////////////////////////////////////////////////////////////////
433/// Return minimum/maximum value of the function
434///
435/// To find the minimum on a range, first set this range via the SetRange function
436/// If a vector x of coordinate is passed it will be used as starting point for the minimum.
437/// In addition on exit x will contain the coordinate values at the minimuma
438/// If x is NULL or x is infinity or NaN, first, a grid search is performed to find the initial estimate of the
439/// minimum location. The range of the function is divided into fNpx and fNpy
440/// sub-ranges. If the function is "good" (or "bad"), these values can be changed
441/// by SetNpx and SetNpy functions
442/// Then, a minimization is used with starting values found by the grid search
443/// The minimizer algorithm used (by default Minuit) can be changed by callinga
444/// ROOT::Math::Minimizer::SetDefaultMinimizerType("..")
445/// Other option for the minimizer can be set using the static method of the MinimizerOptions class
446
448{
449 return FindMinMax(x, false);
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Return maximum value of the function
454/// See TF2::GetMinimum
455
457{
458 return FindMinMax(x, true);
459}
460
461
462////////////////////////////////////////////////////////////////////////////////
463/// Redefines TObject::GetObjectInfo.
464///
465/// Displays the function value
466/// corresponding to cursor position px,py
467
468char *TF2::GetObjectInfo(Int_t px, Int_t py) const
469{
470 const char *snull = "";
471 if (!gPad) return (char*)snull;
472 static char info[64];
473 Double_t x = gPad->PadtoX(gPad->AbsPixeltoX(px));
474 Double_t y = gPad->PadtoY(gPad->AbsPixeltoY(py));
475 const char *drawOption = GetDrawOption();
476 Double_t uxmin,uxmax;
477 Double_t uymin,uymax;
478 if (gPad->GetView() || strncmp(drawOption,"cont",4) == 0
479 || strncmp(drawOption,"CONT",4) == 0) {
480 uxmin=gPad->GetUxmin();
481 uxmax=gPad->GetUxmax();
482 x = fXmin +(fXmax-fXmin)*(x-uxmin)/(uxmax-uxmin);
483 uymin=gPad->GetUymin();
484 uymax=gPad->GetUymax();
485 y = fYmin +(fYmax-fYmin)*(y-uymin)/(uymax-uymin);
486 }
487 snprintf(info,64,"(x=%g, y=%g, f=%.18g)",x,y,((TF2*)this)->Eval(x,y));
488 return info;
489}
490
491////////////////////////////////////////////////////////////////////////////////
492/// Return a random number following this function shape
493
495{
496 Error("GetRandom","cannot be called for TF2/3, use GetRandom2/3 instead");
497 return 0; // not yet implemented
498}
499
500////////////////////////////////////////////////////////////////////////////////
501/// Return a random number following this function shape
502
503
505{
506 Error("GetRandom","cannot be called for TF2/3, use GetRandom2/3 instead");
507 return 0; // not yet implemented
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Return 2 random numbers following this function shape
512///
513/// The distribution contained in this TF2 function is integrated
514/// over the cell contents.
515/// It is normalized to 1.
516/// Getting the two random numbers implies:
517/// - Generating a random number between 0 and 1 (say r1)
518/// - Look in which cell in the normalized integral r1 corresponds to
519/// - make a linear interpolation in the returned cell
520///
521///
522/// IMPORTANT NOTE
523///
524/// The integral of the function is computed at fNpx * fNpy points.
525/// If the function has sharp peaks, you should increase the number of
526/// points (SetNpx, SetNpy) such that the peak is correctly tabulated
527/// at several points.
528
529void TF2::GetRandom2(Double_t &xrandom, Double_t &yrandom)
530{
531 // Check if integral array must be build
532 Int_t i,j,cell;
533 Double_t dx = (fXmax-fXmin)/fNpx;
534 Double_t dy = (fYmax-fYmin)/fNpy;
535 Int_t ncells = fNpx*fNpy;
536 if (fIntegral.empty()) {
537 fIntegral.resize(ncells+1);
538 fIntegral[0] = 0;
539 Double_t integ;
540 Int_t intNegative = 0;
541 cell = 0;
542 for (j=0;j<fNpy;j++) {
543 for (i=0;i<fNpx;i++) {
544 integ = Integral(fXmin+i*dx,fXmin+i*dx+dx,fYmin+j*dy,fYmin+j*dy+dy);
545 if (integ < 0) {intNegative++; integ = -integ;}
546 fIntegral[cell+1] = fIntegral[cell] + integ;
547 cell++;
548 }
549 }
550 if (intNegative > 0) {
551 Warning("GetRandom2","function:%s has %d negative values: abs assumed",GetName(),intNegative);
552 }
553 if (fIntegral[ncells] == 0) {
554 Error("GetRandom2","Integral of function is zero");
555 return;
556 }
557 for (i=1;i<=ncells;i++) { // normalize integral to 1
558 fIntegral[i] /= fIntegral[ncells];
559 }
560 }
561
562// return random numbers
563 Double_t r,ddx,ddy,dxint;
564 r = gRandom->Rndm();
565 cell = TMath::BinarySearch(ncells,fIntegral.data(),r);
566 dxint = fIntegral[cell+1] - fIntegral[cell];
567 if (dxint > 0) ddx = dx*(r - fIntegral[cell])/dxint;
568 else ddx = 0;
569 ddy = dy*gRandom->Rndm();
570 j = cell/fNpx;
571 i = cell%fNpx;
572 xrandom = fXmin +dx*i +ddx;
573 yrandom = fYmin +dy*j +ddy;
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Return range of a 2-D function
578
580{
581 xmin = fXmin;
582 xmax = fXmax;
583 ymin = fYmin;
584 ymax = fYmax;
585}
586
587////////////////////////////////////////////////////////////////////////////////
588/// Return range of function
589
591{
592 xmin = fXmin;
593 xmax = fXmax;
594 ymin = fYmin;
595 ymax = fYmax;
596 zmin = 0;
597 zmax = 0;
598}
599
600
601////////////////////////////////////////////////////////////////////////////////
602/// Get value corresponding to X in array of fSave values
603
605{
606 //if (fNsave <= 0) return 0;
607 if (fSave.empty()) return 0;
608 Int_t fNsave = fSave.size();
609 Int_t np = fNsave - 6;
610 Double_t xmin = Double_t(fSave[np+0]);
611 Double_t xmax = Double_t(fSave[np+1]);
612 Double_t ymin = Double_t(fSave[np+2]);
613 Double_t ymax = Double_t(fSave[np+3]);
614 Int_t npx = Int_t(fSave[np+4]);
615 Int_t npy = Int_t(fSave[np+5]);
616 Double_t x = Double_t(xx[0]);
617 Double_t dx = (xmax-xmin)/npx;
618 if (x < xmin || x > xmax) return 0;
619 if (dx <= 0) return 0;
620 Double_t y = Double_t(xx[1]);
621 Double_t dy = (ymax-ymin)/npy;
622 if (y < ymin || y > ymax) return 0;
623 if (dy <= 0) return 0;
624
625 //we make a bilinear interpolation using the 4 points surrounding x,y
626 Int_t ibin = Int_t((x-xmin)/dx);
627 Int_t jbin = Int_t((y-ymin)/dy);
628 Double_t xlow = xmin + ibin*dx;
629 Double_t ylow = ymin + jbin*dy;
630 Double_t t = (x-xlow)/dx;
631 Double_t u = (y-ylow)/dy;
632 Int_t k1 = jbin*(npx+1) + ibin;
633 Int_t k2 = jbin*(npx+1) + ibin +1;
634 Int_t k3 = (jbin+1)*(npx+1) + ibin +1;
635 Int_t k4 = (jbin+1)*(npx+1) + ibin;
636 Double_t z = (1-t)*(1-u)*fSave[k1] +t*(1-u)*fSave[k2] +t*u*fSave[k3] + (1-t)*u*fSave[k4];
637 return z;
638}
639
640////////////////////////////////////////////////////////////////////////////////
641/// Return Integral of a 2d function in range [ax,bx],[ay,by]
642/// with desired relative accuracy (default value of eps is 1.e-9)
643
645{
646 Double_t a[2], b[2];
647 a[0] = ax;
648 b[0] = bx;
649 a[1] = ay;
650 b[1] = by;
651 Double_t relerr = 0;
652 Int_t n = 2;
654 Int_t nfnevl,ifail;
655 Double_t result = IntegralMultiple(n,a,b,maxpts,epsrel,epsrel,relerr,nfnevl,ifail);
656 if (ifail > 0) {
657 Warning("Integral","failed code=%d, maxpts=%d, epsrel=%g, nfnevl=%d, relerr=%g ",ifail,maxpts,epsrel,nfnevl,relerr);
658 }
659 return result;
660}
661
662////////////////////////////////////////////////////////////////////////////////
663/// Return kTRUE is the point is inside the function range
664
666{
667 if (x[0] < fXmin || x[0] > fXmax) return kFALSE;
668 if (x[1] < fYmin || x[1] > fYmax) return kFALSE;
669 return kTRUE;
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Create a histogram from function.
674///
675/// always created it, even if it is already existing
676
678{
679 Int_t i,j,bin;
680 Double_t dx, dy;
681 Double_t xv[2];
682
683
684 Double_t *parameters = GetParameters();
685 TH2F* h = new TH2F("Func",(char*)GetTitle(),fNpx,fXmin,fXmax,fNpy,fYmin,fYmax);
686 h->SetDirectory(0);
687
688 InitArgs(xv,parameters);
689 dx = (fXmax - fXmin)/Double_t(fNpx);
690 dy = (fYmax - fYmin)/Double_t(fNpy);
691 for (i=1;i<=fNpx;i++) {
692 xv[0] = fXmin + (Double_t(i) - 0.5)*dx;
693 for (j=1;j<=fNpy;j++) {
694 xv[1] = fYmin + (Double_t(j) - 0.5)*dy;
695 bin = j*(fNpx + 2) + i;
696 h->SetBinContent(bin,EvalPar(xv,parameters));
697 }
698 }
699 h->Fill(fXmin-1,fYmin-1,0); //This call to force fNentries non zero
700
701 Double_t *levels = fContour.GetArray();
702 if (levels && levels[0] == -9999) levels = 0;
703 h->SetMinimum(fMinimum);
704 h->SetMaximum(fMaximum);
705 h->SetContour(fContour.fN, levels);
706 h->SetLineColor(GetLineColor());
707 h->SetLineStyle(GetLineStyle());
708 h->SetLineWidth(GetLineWidth());
709 h->SetFillColor(GetFillColor());
710 h->SetFillStyle(GetFillStyle());
711 h->SetMarkerColor(GetMarkerColor());
712 h->SetMarkerStyle(GetMarkerStyle());
713 h->SetMarkerSize(GetMarkerSize());
714 h->SetStats(0);
715
716 return h;
717}
718
719////////////////////////////////////////////////////////////////////////////////
720/// Paint this 2-D function with its current attributes
721
722void TF2::Paint(Option_t *option)
723{
724 Int_t i,j,bin;
725 Double_t dx, dy;
726 Double_t xv[2];
727 Double_t *parameters = GetParameters();
728 TString opt = option;
729 opt.ToLower();
730
731//- Create a temporary histogram and fill each channel with the function value
732 if (!fHistogram) {
733 fHistogram = new TH2F("Func",(char*)GetTitle(),fNpx,fXmin,fXmax,fNpy,fYmin,fYmax);
734 if (!fHistogram) return;
736 }
737 InitArgs(xv,parameters);
738 dx = (fXmax - fXmin)/Double_t(fNpx);
739 dy = (fYmax - fYmin)/Double_t(fNpy);
740 for (i=1;i<=fNpx;i++) {
741 xv[0] = fXmin + (Double_t(i) - 0.5)*dx;
742 for (j=1;j<=fNpy;j++) {
743 xv[1] = fYmin + (Double_t(j) - 0.5)*dy;
744 bin = j*(fNpx + 2) + i;
745 fHistogram->SetBinContent(bin,EvalPar(xv,parameters));
746 }
747 }
748 ((TH2F*)fHistogram)->Fill(fXmin-1,fYmin-1,0); //This call to force fNentries non zero
749
750//- Copy Function attributes to histogram attributes
751 Double_t *levels = fContour.GetArray();
752 if (levels && levels[0] == -9999) levels = 0;
765
766//- Draw the histogram
767 if (!gPad) return;
768 if (opt.Length() == 0) fHistogram->Paint("cont3");
769 else if (opt == "same") fHistogram->Paint("cont2same");
770 else fHistogram->Paint(option);
771}
772
773////////////////////////////////////////////////////////////////////////////////
774/// Save values of function in array fSave
775
777{
778 if (!fSave.empty()) fSave.clear();
779 //if (fSave != 0) {delete [] fSave; fSave = 0;}
780 Int_t nsave = (fNpx+1)*(fNpy+1);
781 Int_t fNsave = nsave+6;
782 if (fNsave <= 6) {fNsave=0; return;}
783 //fSave = new Double_t[fNsave];
784 fSave.resize(fNsave);
785 Int_t i,j,k=0;
786 Double_t dx = (xmax-xmin)/fNpx;
787 Double_t dy = (ymax-ymin)/fNpy;
788 if (dx <= 0) {
789 dx = (fXmax-fXmin)/fNpx;
790 xmin = fXmin +0.5*dx;
791 xmax = fXmax -0.5*dx;
792 }
793 if (dy <= 0) {
794 dy = (fYmax-fYmin)/fNpy;
795 ymin = fYmin +0.5*dy;
796 ymax = fYmax -0.5*dy;
797 }
798 Double_t xv[2];
799 Double_t *parameters = GetParameters();
800 InitArgs(xv,parameters);
801 for (j=0;j<=fNpy;j++) {
802 xv[1] = ymin + dy*j;
803 for (i=0;i<=fNpx;i++) {
804 xv[0] = xmin + dx*i;
805 fSave[k] = EvalPar(xv,parameters);
806 k++;
807 }
808 }
809 fSave[nsave+0] = xmin;
810 fSave[nsave+1] = xmax;
811 fSave[nsave+2] = ymin;
812 fSave[nsave+3] = ymax;
813 fSave[nsave+4] = fNpx;
814 fSave[nsave+5] = fNpy;
815}
816
817////////////////////////////////////////////////////////////////////////////////
818/// Save primitive as a C++ statement(s) on output stream out
819
820void TF2::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
821{
822 char quote = '"';
823 out<<" "<<std::endl;
824 if (gROOT->ClassSaved(TF2::Class())) {
825 out<<" ";
826 } else {
827 out<<" TF2 *";
828 }
829 if (!fMethodCall) {
830 out<<GetName()<<" = new TF2("<<quote<<GetName()<<quote<<","<<quote<<GetTitle()<<quote<<","<<fXmin<<","<<fXmax<<","<<fYmin<<","<<fYmax<<");"<<std::endl;
831 } else {
832 out<<GetName()<<" = new TF2("<<quote<<GetName()<<quote<<","<<GetTitle()<<","<<fXmin<<","<<fXmax<<","<<fYmin<<","<<fYmax<<","<<GetNpar()<<");"<<std::endl;
833 }
834
835 if (GetFillColor() != 0) {
836 if (GetFillColor() > 228) {
838 out<<" "<<GetName()<<"->SetFillColor(ci);" << std::endl;
839 } else
840 out<<" "<<GetName()<<"->SetFillColor("<<GetFillColor()<<");"<<std::endl;
841 }
842 if (GetFillStyle() != 1001) {
843 out<<" "<<GetName()<<"->SetFillStyle("<<GetFillStyle()<<");"<<std::endl;
844 }
845 if (GetMarkerColor() != 1) {
846 if (GetMarkerColor() > 228) {
848 out<<" "<<GetName()<<"->SetMarkerColor(ci);" << std::endl;
849 } else
850 out<<" "<<GetName()<<"->SetMarkerColor("<<GetMarkerColor()<<");"<<std::endl;
851 }
852 if (GetMarkerStyle() != 1) {
853 out<<" "<<GetName()<<"->SetMarkerStyle("<<GetMarkerStyle()<<");"<<std::endl;
854 }
855 if (GetMarkerSize() != 1) {
856 out<<" "<<GetName()<<"->SetMarkerSize("<<GetMarkerSize()<<");"<<std::endl;
857 }
858 if (GetLineColor() != 1) {
859 if (GetLineColor() > 228) {
861 out<<" "<<GetName()<<"->SetLineColor(ci);" << std::endl;
862 } else
863 out<<" "<<GetName()<<"->SetLineColor("<<GetLineColor()<<");"<<std::endl;
864 }
865 if (GetLineWidth() != 4) {
866 out<<" "<<GetName()<<"->SetLineWidth("<<GetLineWidth()<<");"<<std::endl;
867 }
868 if (GetLineStyle() != 1) {
869 out<<" "<<GetName()<<"->SetLineStyle("<<GetLineStyle()<<");"<<std::endl;
870 }
871 if (GetNpx() != 100) {
872 out<<" "<<GetName()<<"->SetNpx("<<GetNpx()<<");"<<std::endl;
873 }
874 if (GetChisquare() != 0) {
875 out<<" "<<GetName()<<"->SetChisquare("<<GetChisquare()<<");"<<std::endl;
876 }
877 Double_t parmin, parmax;
878 for (Int_t i=0;i<GetNpar();i++) {
879 out<<" "<<GetName()<<"->SetParameter("<<i<<","<<GetParameter(i)<<");"<<std::endl;
880 out<<" "<<GetName()<<"->SetParError("<<i<<","<<GetParError(i)<<");"<<std::endl;
881 GetParLimits(i,parmin,parmax);
882 out<<" "<<GetName()<<"->SetParLimits("<<i<<","<<parmin<<","<<parmax<<");"<<std::endl;
883 }
884 out<<" "<<GetName()<<"->Draw("
885 <<quote<<option<<quote<<");"<<std::endl;
886}
887
888
889
890////////////////////////////////////////////////////////////////////////////////
891/// Set the number and values of contour levels
892///
893/// By default the number of contour levels is set to 20.
894///
895/// if argument levels = 0 or missing, equidistant contours are computed
896
897void TF2::SetContour(Int_t nlevels, const Double_t *levels)
898{
899 Int_t level;
900 if (nlevels <=0 ) {
901 fContour.Set(0);
902 return;
903 }
904 fContour.Set(nlevels);
905
906 //- Contour levels are specified
907 if (levels) {
908 for (level=0; level<nlevels; level++) fContour.fArray[level] = levels[level];
909 } else {
910 fContour.fArray[0] = -9999; // means not defined at this point
911 }
912}
913
914
915////////////////////////////////////////////////////////////////////////////////
916/// Set value for one contour level
917
919{
920 if (level <0 || level >= fContour.fN) return;
921 fContour.fArray[level] = value;
922}
923
924////////////////////////////////////////////////////////////////////////////////
925/// Set the number of points used to draw the function
926///
927/// The default number of points along x is 30 for 2-d/3-d functions.
928/// You can increase this value to get a better resolution when drawing
929/// pictures with sharp peaks or to get a better result when using TF2::GetRandom2
930/// the minimum number of points is 4, the maximum is 10000 for 2-d/3-d functions
931
933{
934 if (npy < 4) {
935 Warning("SetNpy","Number of points must be >=4 && <= 10000, fNpy set to 4");
936 fNpy = 4;
937 } else if(npy > 10000) {
938 Warning("SetNpy","Number of points must be >=4 && <= 10000, fNpy set to 10000");
939 fNpy = 10000;
940 } else {
941 fNpy = npy;
942 }
943 Update();
944}
945
946////////////////////////////////////////////////////////////////////////////////
947/// Initialize the upper and lower bounds to draw the function-
948
950{
951 fXmin = xmin;
952 fXmax = xmax;
953 fYmin = ymin;
954 fYmax = ymax;
955 Update();
956}
957
958////////////////////////////////////////////////////////////////////////////////
959/// Stream an object of class TF2.
960
961void TF2::Streamer(TBuffer &R__b)
962{
963 if (R__b.IsReading()) {
964 UInt_t R__s, R__c;
965 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
966 if (R__v > 3) {
967 R__b.ReadClassBuffer(TF2::Class(), this, R__v, R__s, R__c);
968 return;
969 }
970 //====process old versions before automatic schema evolution
971 Int_t nlevels;
972 TF1::Streamer(R__b);
973 if (R__v < 3) {
975 R__b >> ymin; fYmin = ymin;
976 R__b >> ymax; fYmax = ymax;
977 } else {
978 R__b >> fYmin;
979 R__b >> fYmax;
980 }
981 R__b >> fNpy;
982 R__b >> nlevels;
983 if (R__v < 3) {
984 Float_t *contour = 0;
985 Int_t n = R__b.ReadArray(contour);
986 fContour.Set(n);
987 for (Int_t i=0;i<n;i++) fContour.fArray[i] = contour[i];
988 delete [] contour;
989 } else {
990 fContour.Streamer(R__b);
991 }
992 R__b.CheckByteCount(R__s, R__c, TF2::IsA());
993 //====end of old versions
994
995 } else {
996 Int_t saved = 0;
997 if (fType != EFType::kFormula && fSave.empty()) { saved = 1; Save(fXmin,fXmax,fYmin,fYmax,0,0);}
998
999 R__b.WriteClassBuffer(TF2::Class(),this);
1000
1001 if (saved) {fSave.clear(); }
1002 }
1003}
1004
1005////////////////////////////////////////////////////////////////////////////////
1006/// Return x^nx * y^ny moment of a 2d function in range [ax,bx],[ay,by]
1007/// \author Gene Van Buren <gene@bnl.gov>
1008
1010{
1011 Double_t norm = Integral(ax,bx,ay,by,epsilon);
1012 if (norm == 0) {
1013 Error("Moment2", "Integral zero over range");
1014 return 0;
1015 }
1016
1017 TF2 fnc("TF2_ExpValHelper",Form("%s*pow(x,%f)*pow(y,%f)",GetName(),nx,ny));
1018 return fnc.Integral(ax,bx,ay,by,epsilon)/norm;
1019}
1020
1021////////////////////////////////////////////////////////////////////////////////
1022/// Return x^nx * y^ny central moment of a 2d function in range [ax,bx],[ay,by]
1023/// \author Gene Van Buren <gene@bnl.gov>
1024
1026{
1027 Double_t norm = Integral(ax,bx,ay,by,epsilon);
1028 if (norm == 0) {
1029 Error("CentralMoment2", "Integral zero over range");
1030 return 0;
1031 }
1032
1033 Double_t xbar = 0;
1034 Double_t ybar = 0;
1035 if (nx!=0) {
1036 TF2 fncx("TF2_ExpValHelperx",Form("%s*x",GetName()));
1037 xbar = fncx.Integral(ax,bx,ay,by,epsilon)/norm;
1038 }
1039 if (ny!=0) {
1040 TF2 fncx("TF2_ExpValHelpery",Form("%s*y",GetName()));
1041 ybar = fncx.Integral(ax,bx,ay,by,epsilon)/norm;
1042 }
1043 TF2 fnc("TF2_ExpValHelper",Form("%s*pow(x-%f,%f)*pow(y-%f,%f)",GetName(),xbar,nx,ybar,ny));
1044 return fnc.Integral(ax,bx,ay,by,epsilon)/norm;
1045}
1046
void Class()
Definition: Class.C:29
ROOT::R::TRInterface & r
Definition: Object.C:4
#define b(i)
Definition: RSha256.hxx:100
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
short Version_t
Definition: RtypesCore.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
char name[80]
Definition: TGX11.cxx:109
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
float ymax
Definition: THbookFile.cxx:93
#define gROOT
Definition: TROOT.h:414
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
char * Form(const char *fmt,...)
#define gPad
Definition: TVirtualPad.h:286
#define snprintf
Definition: civetweb.c:1540
Param Functor class for Multidimensional functions.
Definition: ParamFunctor.h:274
Double_t * fArray
Definition: TArrayD.h:30
void Copy(TArrayD &array) const
Definition: TArrayD.h:42
void Set(Int_t n)
Set size of this array to n doubles.
Definition: TArrayD.cxx:106
const Double_t * GetArray() const
Definition: TArrayD.h:43
Int_t fN
Definition: TArray.h:38
virtual Color_t GetFillColor() const
Return the fill area color.
Definition: TAttFill.h:30
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition: TAttFill.h:31
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:35
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual Style_t GetLineStyle() const
Return the line style.
Definition: TAttLine.h:34
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition: TAttMarker.h:32
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:38
virtual Color_t GetMarkerColor() const
Return the marker color.
Definition: TAttMarker.h:31
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition: TAttMarker.h:33
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:41
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t ReadArray(Bool_t *&b)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
static void SaveColor(std::ostream &out, Int_t ci)
Save a color with index > 228 as a C++ statement(s) on output stream out.
Definition: TColor.cxx:2108
1-Dim function class
Definition: TF1.h:211
Int_t fNdim
Definition: TF1.h:244
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
Definition: TF1.cxx:1920
TMethodCall * fMethodCall
Pointer to histogram used for visualisation.
Definition: TF1.h:262
virtual Double_t GetParError(Int_t ipar) const
Return value of parameter number ipar.
Definition: TF1.cxx:1910
Double_t GetChisquare() const
Definition: TF1.h:438
Double_t fXmin
Definition: TF1.h:241
virtual void Copy(TObject &f1) const
Copy this F1 to a new F1.
Definition: TF1.cxx:995
virtual void Update()
Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated h...
Definition: TF1.cxx:3615
virtual Int_t GetNpar() const
Definition: TF1.h:475
TH1 * fHistogram
Parent object hooking this function (if one)
Definition: TF1.h:261
Double_t fMaximum
Definition: TF1.h:251
virtual Double_t * GetParameters() const
Definition: TF1.h:514
Double_t fMinimum
Definition: TF1.h:250
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
Definition: TF1.cxx:1458
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
Definition: TF1.cxx:2454
virtual Double_t IntegralMultiple(Int_t n, const Double_t *a, const Double_t *b, Int_t maxpts, Double_t epsrel, Double_t epsabs, Double_t &relerr, Int_t &nfnevl, Int_t &ifail)
This function computes, to an attempted specified accuracy, the value of the integral.
Definition: TF1.cxx:2821
EFType fType
Definition: TF1.h:246
Int_t fNpx
Definition: TF1.h:245
std::vector< Double_t > fSave
Definition: TF1.h:255
virtual Double_t GetMinMaxNDim(Double_t *x, Bool_t findmax, Double_t epsilon=0, Int_t maxiter=0) const
Find the minimum of a function of whatever dimension.
Definition: TF1.cxx:1703
std::vector< Double_t > fIntegral
Definition: TF1.h:256
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Definition: TF1.cxx:1429
virtual Int_t GetNpx() const
Definition: TF1.h:484
Double_t fXmax
Definition: TF1.h:242
virtual Int_t GetNdim() const
Definition: TF1.h:479
virtual Double_t GetParameter(Int_t ipar) const
Definition: TF1.h:506
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TF1.cxx:1526
A 2-Dim function with parameters.
Definition: TF2.h:29
virtual Double_t GetMaximumXY(Double_t &x, Double_t &y) const
Compute the X and Y values corresponding to the maximum value of the function.
Definition: TF2.cxx:422
virtual Double_t FindMinMax(Double_t *x, bool findmax) const
Return minimum/maximum value of the function.
Definition: TF2.cxx:345
virtual Double_t GetMinimum(Double_t *x) const
Return minimum/maximum value of the function.
Definition: TF2.cxx:447
virtual void Paint(Option_t *option="")
Paint this 2-D function with its current attributes.
Definition: TF2.cxx:722
virtual Bool_t IsInside(const Double_t *x) const
Return kTRUE is the point is inside the function range.
Definition: TF2.cxx:665
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
Save values of function in array fSave.
Definition: TF2.cxx:776
virtual void SetNpy(Int_t npy=100)
Set the number of points used to draw the function.
Definition: TF2.cxx:932
virtual Double_t Moment2(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t epsilon=0.000001)
Return x^nx * y^ny moment of a 2d function in range [ax,bx],[ay,by].
Definition: TF2.cxx:1009
virtual Double_t GetMinimumXY(Double_t &x, Double_t &y) const
Compute the X and Y values corresponding to the minimum value of the function.
Definition: TF2.cxx:407
Int_t fNpy
Definition: TF2.h:34
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels.
Definition: TF2.cxx:308
TArrayD fContour
Definition: TF2.h:35
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TF2.cxx:820
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TF2.cxx:298
Double_t fYmax
Definition: TF2.h:33
virtual Double_t GetSave(const Double_t *x)
Get value corresponding to X in array of fSave values.
Definition: TF2.cxx:604
TF2 & operator=(const TF2 &rhs)
Operator =.
Definition: TF2.cxx:166
virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsrel=1.e-6)
Return Integral of a 2d function in range [ax,bx],[ay,by] with desired relative accuracy (default val...
Definition: TF2.cxx:644
Double_t GetRandom()
Return a random number following this function shape.
Definition: TF2.cxx:494
virtual TF1 * DrawCopy(Option_t *option="") const
Draw a copy of this function with its current attributes-*.
Definition: TF2.cxx:268
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Redefines TObject::GetObjectInfo.
Definition: TF2.cxx:468
Double_t fYmin
Definition: TF2.h:32
virtual Double_t GetContourLevel(Int_t level) const
Return the number of contour levels.
Definition: TF2.cxx:320
virtual ~TF2()
F2 default destructor.
Definition: TF2.cxx:177
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a function.
Definition: TF2.cxx:210
virtual void Copy(TObject &f2) const
Copy this F2 to a new F2.
Definition: TF2.cxx:192
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF2.h:150
virtual void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Return range of a 2-D function.
Definition: TF2.cxx:579
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=0)
Set the number and values of contour levels.
Definition: TF2.cxx:897
virtual Double_t CentralMoment2(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t epsilon=0.000001)
Return x^nx * y^ny central moment of a 2d function in range [ax,bx],[ay,by].
Definition: TF2.cxx:1025
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF2.cxx:241
virtual void SetContourLevel(Int_t level, Double_t value)
Set value for one contour level.
Definition: TF2.cxx:918
TF2()
TF2 default constructor.
Definition: TF2.cxx:64
virtual Double_t GetMaximum(Double_t *x) const
Return maximum value of the function See TF2::GetMinimum.
Definition: TF2.cxx:456
virtual void GetRandom2(Double_t &xrandom, Double_t &yrandom)
Return 2 random numbers following this function shape.
Definition: TF2.cxx:529
virtual TH1 * CreateHistogram()
Create a histogram from function.
Definition: TF2.cxx:677
The TH1 histogram class.
Definition: TH1.h:56
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8351
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:394
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition: TH1.cxx:7905
virtual void SetMinimum(Double_t minimum=-1111)
Definition: TH1.h:395
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Definition: TH1.cxx:8635
virtual Double_t GetContourLevel(Int_t level) const
Return value of contour number level.
Definition: TH1.cxx:7852
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms.
Definition: TH1.cxx:5809
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
Definition: TH1.cxx:2719
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8404
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:248
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:341
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:105
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
void MakeZombie()
Definition: TObject.h:49
@ kCanDelete
if object in a list can be deleted
Definition: TObject.h:58
virtual Double_t Rndm()
Machine independent random number generator.
Definition: TRandom.cxx:541
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754
Definition: TMath.h:889
Int_t Finite(Double_t x)
Check if it is finite with a mask in order to be consistent in presence of fast math.
Definition: TMath.h:759
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Definition: TMathBase.h:278
Double_t Infinity()
Returns an infinity as defined by the IEEE standard.
Definition: TMath.h:902
auto * a
Definition: textangle.C:12
REAL epsilon
Definition: triangle.c:617