80 TGraph::
TGraph(): TNamed(), TAttLine(), TAttFill(1, 1001), TAttMarker()
83 if (!CtorAllocate())
return;
91 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
102 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
110 for (
Int_t i = 0; i <
n; i++) {
120 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
128 for (
Int_t i = 0; i <
n; i++) {
138 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
155 : TNamed(gr), TAttLine(gr), TAttFill(gr), TAttMarker(gr)
160 else fFunctions =
new TList;
173 memcpy(
fX, gr.
fX, n);
174 memcpy(
fY, gr.
fY, n);
194 if (!fFunctions->IsEmpty()) {
199 while ((obj = fFunctions->First())) {
200 while (fFunctions->Remove(obj)) { }
208 else fFunctions =
new TList;
216 if (
fX)
delete []
fX;
217 if (
fY)
delete []
fY;
228 memcpy(
fX, gr.
fX, n);
229 memcpy(
fY, gr.
fY, n);
242 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
249 fX[i] = vx(i + ivxlow);
250 fY[i] = vy(i + ivylow);
261 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
268 fX[i] = vx(i + ivxlow);
269 fY[i] = vy(i + ivylow);
277 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
280 Error(
"TGraph",
"Pointer to histogram is null");
288 fNpoints = ((
TH1*)h)->GetXaxis()->GetNbins();
293 TAxis *xaxis = ((
TH1*)h)->GetXaxis();
298 h->TAttLine::Copy(*
this);
299 h->TAttFill::Copy(*
this);
300 h->TAttMarker::Copy(*
this);
302 std::string gname =
"Graph_from_" + std::string(h->
GetName());
319 : TNamed(
"Graph",
"Graph"), TAttLine(), TAttFill(1, 1001), TAttMarker()
323 Error(
"TGraph",
"Pointer to function is null");
327 if (option) coption = *option;
328 if (coption ==
'i' || coption ==
'I') fNpoints++;
338 if (coption ==
'i' || coption ==
'I') {
339 fX[i] = xmin + i * dx;
340 if (i == 0)
fY[i] = 0;
341 else fY[i] = integ + ((
TF1*)f)->Integral(
fX[i] - dx,
fX[i]);
343 }
else if (coption ==
'd' || coption ==
'D') {
344 fX[i] = xmin + (i + 0.5) * dx;
345 fY[i] = ((
TF1*)f)->Derivative(
fX[i]);
347 fX[i] = xmin + (i + 0.5) * dx;
348 fY[i] = ((
TF1*)f)->Eval(
fX[i]);
351 if (integ != 0 && coption ==
'I') {
352 for (i = 1; i <
fNpoints; i++)
fY[i] /= integ;
355 f->TAttLine::Copy(*
this);
356 f->TAttFill::Copy(*
this);
357 f->TAttMarker::Copy(*
this);
378 : TNamed(
"Graph", filename), TAttLine(), TAttFill(1, 1001), TAttMarker()
384 std::ifstream infile(fname.
Data());
385 if (!infile.good()) {
387 Error(
"TGraph",
"Cannot open file: %s, TGraph is Zombie", filename);
398 if (strcmp(option,
"") == 0) {
400 while (std::getline(infile, line,
'\n')) {
401 if (2 != sscanf(line.c_str(),
format, &
x, &
y)) {
421 Error(
"TGraph",
"Incorrect input format! Allowed formats are {\"%%lg\",\"%%*lg\" or \"%%*s\"}");
426 Error(
"TGraph",
"Incorrect input format! Only %d tag(s) in format whereas 2 \"%%lg\" tags are expected!", ntokens);
429 Int_t ntokensToBeSaved = 0 ;
431 for (
Int_t idx = 0; idx < ntokens; idx++) {
433 if (isTokenToBeSaved[idx] == 1) {
437 if (ntokens >= 2 && ntokensToBeSaved != 2) {
438 Error(
"TGraph",
"Incorrect input format! There are %d \"%%lg\" tag(s) in format whereas 2 and only 2 are expected!", ntokensToBeSaved);
439 delete [] isTokenToBeSaved ;
445 char * token =
NULL ;
447 Int_t token_idx = 0 ;
449 Int_t value_idx = 0 ;
452 while (std::getline(infile, line,
'\n')) {
454 if (line[line.size() - 1] == char(13)) {
455 line.erase(line.end() - 1, line.end()) ;
457 token = strtok(const_cast<char*>(line.c_str()), option) ;
458 while (token !=
NULL && value_idx < 2) {
459 if (isTokenToBeSaved[token_idx]) {
463 isLineToBeSkipped =
kTRUE ;
466 value[value_idx] = token_str.
Atof() ;
470 token = strtok(
NULL, option) ;
473 if (!isLineToBeSkipped && value_idx == 2) {
480 isLineToBeSkipped =
kFALSE ;
488 delete [] isTokenToBeSaved ;
509 while ((obj = fFunctions->First())) {
510 while (fFunctions->Remove(obj)) { }
529 for (
Int_t i = 0; i < Narrays; ++i)
532 for (
Int_t i = 0; i < Narrays; ++i)
533 newarrays[i] =
new Double_t[arraySize];
565 opt = (opt ==
"") ?
"alp" : opt.
Data();
589 Error(
"Chisquare",
"Function pointer is Null - return -1");
616 return gr->
fX[left] > gr->
fX[right];
624 return gr->
fY[left] > gr->
fY[right];
633 return gr->
fX[left] * gr->
fX[left] + gr->
fY[left] * gr->
fY[left]
634 > gr->
fX[right] * gr->
fX[right] + gr->
fY[right] * gr->
fY[right];
643 xmin = xmax = ymin = ymax = 0;
653 if (
fX[i] < xmin) xmin =
fX[i];
654 if (
fX[i] > xmax) xmax =
fX[i];
655 if (
fY[i] < ymin) ymin =
fY[i];
656 if (
fY[i] > ymax) ymax =
fY[i];
657 if (ymin>0 && (yminl==0 || ymin<yminl)) yminl =
ymin;
658 if (xmin>0 && (xminl==0 || xmin<xminl)) xminl =
xmin;
661 if (
gPad &&
gPad->GetLogy() && yminl>0) ymin = yminl;
662 if (
gPad &&
gPad->GetLogx() && xminl>0) xmin = xminl;
691 if (ibegin < 0 || iend <= ibegin || obegin < 0) {
694 if (!arrays && ibegin == obegin) {
699 memmove(&arrays[0][obegin], &
fX[ibegin], n);
700 memmove(&arrays[1][obegin], &
fY[ibegin], n);
702 memmove(&
fX[obegin], &
fX[ibegin], n);
703 memmove(&
fY[obegin], &
fY[ibegin], n);
720 fFunctions =
new TList;
759 if (!strlen(option)) {
761 if (!
gPad->GetListOfPrimitives()->FindObject(
"TFrame")) opt =
"alp";
768 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
855 if (fNpoints == 0)
return 0;
856 if (fNpoints == 1)
return fY[0];
864 std::vector<Double_t> xsort(fNpoints);
865 std::vector<Double_t> ysort(fNpoints);
866 std::vector<Int_t> indxsort(fNpoints);
869 xsort[i] =
fX[ indxsort[i] ];
870 ysort[i] =
fY[ indxsort[i] ];
895 if (low == -1 ||
fX[i] >
fX[low]) {
898 }
else if (low2 == -1) low2 = i;
899 }
else if (
fX[i] > x) {
900 if (up == -1 ||
fX[i] <
fX[up]) {
903 }
else if (up2 == -1) up2 = i;
918 assert(low != -1 && up != -1);
920 if (
fX[low] ==
fX[up])
return fY[low];
925 return spline->
Eval(x);
965 Double_t **ps =
Allocate(step * (newsize / step + (newsize % step ? 1 : 0)));
990 memset(
fX + begin, 0, (end - begin)*
sizeof(
Double_t));
991 memset(
fY + begin, 0, (end - begin)*
sizeof(
Double_t));
999 if (fFunctions)
return fFunctions->
FindObject(name);
1008 if (fFunctions)
return fFunctions->
FindObject(obj);
1027 linear = (
char*) strstr(fname,
"++");
1030 f1 =
new TF1(fname, fname, xmin, xmax);
1032 f1 = (
TF1*)
gROOT->GetFunction(fname);
1034 Printf(
"Unknown function: %s", fname);
1038 return Fit(f1, option,
"", xmin, xmax);
1286 gROOT->MakeDefCanvas();
1289 Error(
"FitPanel",
"Unable to create a default canvas");
1295 if (handler && handler->
LoadPlugin() != -1) {
1297 Error(
"FitPanel",
"Unable to crate the FitPanel");
1299 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
1308 if (rms1 == 0)
return 0;
1310 if (rms2 == 0)
return 0;
1319 if (fNpoints <= 0)
return 0;
1325 sumxy +=
fX[i] *
fY[i];
1327 return sumxy / sum - sumx / sum * sumy / sum;
1335 if (axis < 1 || axis > 2)
return 0;
1336 if (fNpoints <= 0)
return 0;
1339 if (axis == 1) sumx +=
fX[i];
1350 if (axis < 1 || axis > 2)
return 0;
1351 if (fNpoints <= 0)
return 0;
1356 sumx2 +=
fX[i] *
fX[i];
1359 sumx2 +=
fY[i] *
fY[i];
1433 if (!fFunctions)
return 0;
1445 Double_t rwxmin, rwxmax, rwymin, rwymax, maximum, minimum, dx, dy;
1459 if (rwxmin <= 0 || fHistogram->
GetXaxis()->
GetXmin() != 0)
return fHistogram;
1460 }
else if (
gPad &&
gPad->GetLogy()) {
1461 if (rwymin <= 0 || fHistogram->
GetMinimum() != 0)
return fHistogram;
1468 if (rwxmin == rwxmax) rwxmax += 1.;
1469 if (rwymin == rwymax) rwymax += 1.;
1470 dx = 0.1 * (rwxmax - rwxmin);
1471 dy = 0.1 * (rwymax - rwymin);
1472 uxmin = rwxmin - dx;
1473 uxmax = rwxmax + dx;
1474 minimum = rwymin - dy;
1475 maximum = rwymax + dy;
1482 if (uxmin < 0 && rwxmin >= 0) {
1483 if (
gPad &&
gPad->GetLogx()) uxmin = 0.9 * rwxmin;
1486 if (uxmax > 0 && rwxmax <= 0) {
1487 if (
gPad &&
gPad->GetLogx()) uxmax = 1.1 * rwxmax;
1490 if (minimum < 0 && rwymin >= 0) {
1491 if (
gPad &&
gPad->GetLogy()) minimum = 0.9 * rwymin;
1494 if (minimum <= 0 && gPad && gPad->GetLogy()) minimum = 0.001 * maximum;
1495 if (uxmin <= 0 && gPad && gPad->GetLogx()) {
1496 if (uxmax > 1000) uxmin = 1;
1497 else uxmin = 0.001 * uxmax;
1503 if (fNpoints > npt) npt =
fNpoints;
1504 const char *gname =
GetName();
1505 if (!gname[0]) gname =
"Graph";
1507 if (!fHistogram)
return 0;
1508 fHistogram->SetMinimum(minimum);
1510 fHistogram->SetMaximum(maximum);
1511 fHistogram->GetYaxis()->SetLimits(minimum, maximum);
1512 fHistogram->SetDirectory(0);
1553 if (i < 0 || i >= fNpoints)
return -1;
1554 if (!
fX || !
fY)
return -1;
1585 Double_t allcha, sumx, sumx2,
x, val, rms, mean;
1592 xmax =
fX[fNpoints-1];
1595 allcha = sumx = sumx2 = 0;
1596 for (bin = 0; bin <
fNpoints; bin++) {
1598 if (x < xmin || x > xmax)
continue;
1602 sumx2 += val * x *
x;
1605 if (np == 0 || allcha == 0)
return;
1606 mean = sumx / allcha;
1609 if (rms == 0) rms = 1;
1612 f1->
SetParameter(0, binwidx * allcha / (sqrtpi * rms));
1627 xmax =
fX[fNpoints-1];
1651 xmax =
fX[fNpoints-1];
1671 for (i = 0; i < fNpoints - 1; i++) {
1680 for (i = 0; i < fNpoints - 1; i++) {
1692 if (dpx * dpx + dpy * dpy < 25) ipoint = 0;
1701 fX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(px));
1702 fY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(py));
1740 if (first < 0) first = 0;
1741 if (last < 0) last = fNpoints - 1;
1742 if (last >= fNpoints) last = fNpoints - 1;
1743 if (first >= last)
return 0;
1744 Int_t np = last - first + 1;
1751 for (
Int_t i = first; i <= last; i++) {
1752 Int_t j = first + (i - first + 1) % np;
1753 sum += (
fY[i] +
fY[j]) * (
fX[j] -
fX[i]);
1790 const Int_t idim = 20;
1799 xmax =
fX[fNpoints-1];
1806 if (m > idim || m > n)
return;
1808 for (l = 2; l <=
m; ++
l) {
1810 b[m + l*20 - 21] = zero;
1816 if (xk < xmin || xk > xmax)
continue;
1821 for (l = 2; l <=
m; ++
l) {
1824 da[l-1] += power * yk;
1826 for (l = 2; l <=
m; ++
l) {
1828 b[m + l*20 - 21] += power;
1832 for (i = 3; i <=
m; ++i) {
1833 for (k = i; k <=
m; ++k) {
1834 b[k - 1 + (i-1)*20 - 21] = b[k + (i-2)*20 - 21];
1841 for (i = 1; i <
m; ++i) a[i] = 0;
1844 for (i = 0; i <
m; ++i) a[i] = da[i];
1870 xmax =
fX[fNpoints-1];
1874 xbar = ybar = x2bar = xybar = 0;
1878 if (xk < xmin || xk > xmax)
continue;
1882 if (yk <= 0) yk = 1e-9;
1891 det = fn * x2bar - xbar * xbar;
1894 if (fn > 0) a0 = ybar / fn;
1900 a0 = (x2bar * ybar - xbar * xybar) / det;
1901 a1 = (fn * xybar - xbar * ybar) / det;
1919 if (painter) painter->
PaintGraph(
this, npoints, x, y, chopt);
1928 if (painter) painter->
PaintGrapHist(
this, npoints, x, y, chopt);
1946 printf(
"x[%d]=%g, y[%d]=%g\n", i,
fX[i], i,
fY[i]);
1956 if (!fFunctions->TestBit(
kInvalidObject)) fFunctions->RecursiveRemove(obj);
1958 if (fHistogram == obj) fHistogram = 0;
1976 if (dpx * dpx + dpy * dpy < 100) {
1989 if (ipoint < 0)
return -1;
1990 if (ipoint >= fNpoints)
return -1;
2004 out <<
" " << std::endl;
2005 static Int_t frameNumber = 0;
2008 if (fNpoints >= 1) {
2012 out <<
" Double_t " << fXName <<
"[" << fNpoints <<
"] = {" << std::endl;
2013 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fX[i] <<
"," << std::endl;
2014 out <<
" " <<
fX[fNpoints-1] <<
"};" << std::endl;
2015 out <<
" Double_t " << fYName <<
"[" << fNpoints <<
"] = {" << std::endl;
2016 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fY[i] <<
"," << std::endl;
2017 out <<
" " <<
fY[fNpoints-1] <<
"};" << std::endl;
2019 else out <<
" TGraph *";
2020 out <<
"graph = new TGraph(" << fNpoints <<
"," << fXName <<
"," << fYName <<
");" << std::endl;
2023 else out <<
" TGraph *";
2024 out <<
"graph = new TGraph();" << std::endl;
2027 out <<
" graph->SetName(" << quote <<
GetName() << quote <<
");" << std::endl;
2028 out <<
" graph->SetTitle(" << quote <<
GetTitle() << quote <<
");" << std::endl;
2035 TString hname = fHistogram->GetName();
2036 hname += frameNumber;
2037 fHistogram->SetName(
Form(
"Graph_%s", hname.
Data()));
2038 fHistogram->SavePrimitive(out,
"nodraw");
2039 out <<
" graph->SetHistogram(" << fHistogram->GetName() <<
");" << std::endl;
2040 out <<
" " << std::endl;
2046 while ((obj =
next())) {
2049 out <<
" graph->GetListOfFunctions()->Add(ptstats);" << std::endl;
2050 out <<
" ptstats->SetParent(graph->GetListOfFunctions());" << std::endl;
2052 out <<
" graph->GetListOfFunctions()->Add("
2053 <<
Form(
"%s%d",obj->
GetName(),frameNumber) <<
");" << std::endl;
2058 l = strstr(option,
"multigraph");
2060 out <<
" multigraph->Add(graph," << quote << l + 10 << quote <<
");" << std::endl;
2063 l = strstr(option,
"th2poly");
2065 out <<
" " << l + 7 <<
"->AddBin(graph);" << std::endl;
2068 out <<
" graph->Draw(" << quote << option << quote <<
");" << std::endl;
2079 if (n == fNpoints)
return;
2138 if (i >= fNpoints) {
2156 if (fHistogram) fHistogram->SetTitle(title);
2201 if (high == -1111) high =
GetN() - 1;
2203 if (high <= low)
return;
2208 while (left < right) {
2210 while (left <= high && greaterfunc(
this, left, low) != ascending)
2213 while (right > low && greaterfunc(
this, right, low) == ascending)
2215 if (left < right && left < high && right > low)
2221 Sort(greaterfunc, ascending, low, right - 1);
2222 Sort(greaterfunc, ascending, right + 1, high);
2228 void TGraph::Streamer(
TBuffer &b)
2235 if (fHistogram) fHistogram->SetDirectory(0);
2238 while ((obj =
next())) {
2248 TNamed::Streamer(b);
2249 TAttLine::Streamer(b);
2250 TAttFill::Streamer(b);
2251 TAttMarker::Streamer(b);
2307 arr[pos1] = arr[pos2];
2337 if (fHistogram) fHistogram->UseCurrentStyle();
2342 while ((obj =
next())) {
2358 "Cannot merge - an object which doesn't inherit from TGraph found in the list");
2371 for (
Int_t i = 0 ; i < g->
GetN(); i++) {
2384 ,
Int_t maxiterations)
2387 static Int_t j1, it, j3, j2;
2420 if (j1 != 2)
goto L100;
2421 if (ya * Y < 0)
goto L120;
2430 if (it >= maxiterations) k = j1;
2438 if (j1 > 3)
goto L170;
2454 if (it >= maxiterations) k = j1;
2483 x2 = X - Y * (X -
x1) / (Y - y1);
2487 if ((x2 - a)*(x2 - b) < 0) {
2489 if (it >= maxiterations) k = j1;
2500 if ((x2 - a)*(x2 - b) >= 0) {
2505 if (it >= maxiterations) k = j1;
2513 if (j1 != 4)
return;
2524 if (ytest <= 0)
goto L130;
virtual Double_t GetErrorX(Int_t bin) const
This function is called by GraphFitChisquare.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
virtual TObject * FindObject(const char *name) const
Search object named name in the list of functions.
void PaintGrapHist(Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
Draw the (x,y) as a histogram.
Int_t fNpoints
Current dimension of arrays fX and fY.
virtual const char * GetTitle() const
Returns title of object.
virtual void PaintHelper(TGraph *theGraph, Option_t *option)=0
void Copy(TAttMarker &attmarker) const
Copy this marker attributes to a new TAttMarker.
virtual Style_t GetLineStyle() const
virtual Style_t GetFillStyle() const
virtual void SetLineWidth(Width_t lwidth)
Abstract interface to a histogram painter.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void FitPanel()
Display a GUI panel with all graph fit options.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetErrorYhigh(Int_t bin) const
This function is called by GraphFitChisquare.
virtual void SetMaximum(Double_t maximum=-1111)
static Bool_t CompareRadius(const TGraph *gr, Int_t left, Int_t right)
Return kTRUE if point number "left"'s distance to origin is bigger than that of point number "right"...
Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual Double_t ** Allocate(Int_t newsize)
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
void PaintGraph(Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
Draw the (x,y) as a graph.
virtual void DrawPanelHelper(TGraph *theGraph)=0
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Style_t GetHistLineStyle() const
virtual void InitPolynom(Double_t xmin=0, Double_t xmax=0)
Compute Initial values of parameters for a polynom.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetMinimum(Double_t minimum=-1111)
Set the minimum of the graph.
R__EXTERN TStyle * gStyle
void SetHistLineWidth(Width_t width=1)
virtual Int_t GetDimension() const
virtual Int_t IsInside(Double_t x, Double_t y) const
Return 1 if the point (x,y) is inside the polygon defined by the graph vertices 0 otherwise...
virtual void SetName(const char *name)
Change (i.e.
static Bool_t CompareX(const TGraph *gr, Int_t left, Int_t right)
Return kTRUE if fX[left] > fX[right]. Can be used by Sort.
Base class for spline implementation containing the Draw/Paint methods //.
Double_t Atof() const
Return floating-point value contained in string.
void H1LeastSquareSeqnd(Int_t n, Double_t *a, Int_t idim, Int_t &ifail, Int_t k, Double_t *b)
Extracted from CERN Program library routine DSEQN.
virtual Bool_t GetTimeDisplay() const
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
void ToUpper()
Change string to upper case.
Buffer base class used for serializing objects.
static const char * filename()
virtual void SetMinimum(Double_t minimum=-1111)
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Int_t LoadPlugin()
Load the plugin library for this handler.
1-D histogram with a float per channel (see TH1 documentation)}
virtual TObject * GetUserFunc() const
virtual void DrawPanel()
Display a panel with all graph drawing options.
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
virtual void LeastSquareFit(Int_t m, Double_t *a, Double_t xmin=0, Double_t xmax=0)
Least squares polynomial fitting without weights.
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
virtual void SetFillStyle(Style_t fstyle)
virtual void SetTitle(const char *title="")
Set graph title.
virtual Style_t GetTitleFont() const
virtual void UseCurrentStyle()
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
virtual Double_t Chisquare(TF1 *f1, Option_t *option="") const
Return the chisquare of this graph with respect to f1.
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases...
static std::string format(double x, double y, int digits, int width)
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from the list of functions.
Style_t GetHistFillStyle() const
Long_t ExecPlugin(int nargs, const T &...params)
virtual Float_t GetTitleSize() const
virtual Double_t GetXmin() const
virtual void Apply(TF1 *f)
Apply function f to all the data points f may be a 1-D function TF1 or 2-d function TF2 The Y values ...
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
virtual Double_t GetErrorXhigh(Int_t bin) const
This function is called by GraphFitChisquare.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual Int_t Merge(TCollection *list)
Adds all graphs from the collection to this graph.
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
const char * Data() const
virtual Bool_t CopyPoints(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy points from fX and fY to arrays[0] and arrays[1] or to fX and fY if arrays == 0 and ibegin != ie...
Double_t ** ShrinkAndCopy(Int_t size, Int_t iend)
if size*2 <= fMaxSize allocate new arrays of size points, copy points [0,oend).
virtual void SetParent(TObject *p=0)
static const double x2[5]
virtual void Paint(Option_t *chopt="")
Draw this graph with its current attributes.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
TGraph & operator=(const TGraph &)
Equal operator for this graph.
void SetHistFillColor(Color_t color=1)
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual void Sort(Bool_t(*greater)(const TGraph *, Int_t, Int_t)=&TGraph::CompareX, Bool_t ascending=kTRUE, Int_t low=0, Int_t high=-1111)
Sorts the points of this TGraph using in-place quicksort (see e.g.
TList * GetListOfFunctions() const
Double_t Eval(Double_t x) const
Eval this spline at x.
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum of the graph.
void Zero(Int_t &k, Double_t AZ, Double_t BZ, Double_t E2, Double_t &X, Double_t &Y, Int_t maxiterations)
Find zero of a continuous function.
Double_t GetMinimum() const
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute the x/y range of the points in this graph.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Int_t Atoi() const
Return integer value of string.
Double_t ATan2(Double_t, Double_t)
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual Int_t RemovePoint()
Delete point close to the mouse position.
virtual Double_t GetXmax() const
virtual Float_t GetTitleOffset() const
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual void Expand(Int_t newsize)
If array sizes <= newsize, expand storage to 2*newsize.
Bool_t CtorAllocate()
In constructors set fNpoints than call this method.
virtual const char * GetTimeFormat() const
virtual Double_t GetErrorXlow(Int_t bin) const
This function is called by GraphFitChisquare.
virtual void SetLineColor(Color_t lcolor)
Using a TBrowser one can browse all ROOT objects.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual Size_t GetMarkerSize() const
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
Color_t GetHistFillColor() const
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Width_t GetHistLineWidth() const
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
TAxis * GetXaxis() const
Get x axis of the graph.
void SetHistFillStyle(Style_t styl=0)
Class to manage histogram axis.
R__EXTERN TSystem * gSystem
virtual void SetFillColor(Color_t fcolor)
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
static void SwapValues(Double_t *arr, Int_t pos1, Int_t pos2)
Swap values.
virtual Int_t DistancetoPrimitiveHelper(TGraph *theGraph, Int_t px, Int_t py)=0
virtual Color_t GetFillColor() const
Collection abstract base class.
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph
TF1 * GetFunction(const char *name) const
Return pointer to function with name.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Bool_t TestBit(UInt_t f) const
virtual Double_t GetRMS(Int_t axis=1) const
Return RMS of X (axis=1) or Y (axis=2)
char * Form(const char *fmt,...)
virtual Int_t InsertPoint()
Insert a new point at the mouse position.
static TVirtualFitter * GetFitter()
static: return the current Fitter
virtual const char * GetName() const
Returns name of object.
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual Double_t Eval(Double_t x) const =0
double Chisquare(const TH1 &h1, TF1 &f1, bool useRange)
compute the chi2 value for an histogram given a function (see TH1::Chisquare for the documentation) ...
const char * GetTitle() const
Returns title of object.
virtual Double_t Eval(Double_t x, TSpline *spline=0, Option_t *option="") const
Interpolate points in this graph at x using a TSpline -if spline==0 and option="" a linear interpolat...
virtual Color_t GetLineColor() const
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual void SetMarkerSize(Size_t msize=1)
Bool_t GetNoExponent() const
virtual Double_t GetCovariance() const
Return covariance of vectors x,y.
virtual Int_t GetNpx() const
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual void Print(Option_t *chopt="") const
Print graph values.
virtual void InitGaus(Double_t xmin=0, Double_t xmax=0)
Compute Initial values of parameters for a gaussian.
virtual Double_t GetErrorYlow(Int_t bin) const
This function is called by GraphFitChisquare.
Bool_t GetCenterTitle() const
static const double x1[5]
class describing the range in the coordinates it supports multiple range in a coordinate.
virtual const char * GetName() const
Returns name of object.
void SetHistLineStyle(Style_t styl=0)
virtual void PaintStats(TF1 *fit)
Draw the stats.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a graph.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual Style_t GetLabelFont() const
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
double func(double *x, double *p)
virtual Int_t GetNdivisions() const
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Compute distance from point px,py to a line.
static TVirtualGraphPainter * GetPainter()
virtual ~TGraph()
Graph default destructor.
Color_t GetHistLineColor() const
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
virtual void SetLineStyle(Style_t lstyle)
Double_t ** ExpandAndCopy(Int_t size, Int_t iend)
if size > fMaxSize allocate new arrays of 2*size points and copy iend first points.
void FitOptionsMake(EFitObjectType type, const char *option, Foption_t &fitOption)
Decode list of options into fitOption.
Abstract Base Class for Fitting.
Binding & operator=(OUT(*fun)(void))
virtual Double_t Integral(Int_t first=0, Int_t last=-1) const
Integrate the TGraph data within a given (index) range.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Mother of all ROOT objects.
virtual void UseCurrentStyle()
Set current style settings in this graph This function is called when either TCanvas::UseCurrentStyle...
TAxis * GetYaxis() const
Get y axis of the graph.
virtual void Browse(TBrowser *b)
Browse.
virtual Float_t GetLabelSize() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
virtual Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare.
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
Set zero values for point arrays in the range [begin, end) Should be redefined in descendant classes...
virtual Color_t GetMarkerColor() const
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual void InitExpo(Double_t xmin=0, Double_t xmax=0)
Compute Initial values of parameters for an exponential.
virtual Double_t GetMean(Int_t axis=1) const
Return mean value of X (axis=1) or Y (axis=2)
virtual void LeastSquareLinearFit(Int_t n, Double_t &a0, Double_t &a1, Int_t &ifail, Double_t xmin=0, Double_t xmax=0)
Least square linear fit without weights.
static Bool_t CompareArg(const TGraph *gr, Int_t left, Int_t right)
Return kTRUE if point number "left"'s argument (angle with respect to positive x-axis) is bigger than...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Bool_t GetEditable() const
Return kTRUE if kNotEditable bit is not set, kFALSE otherwise.
virtual void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy points from fX and fY to arrays[0] and arrays[1] or to fX and fY if arrays == 0 and ibegin != ie...
virtual void DrawGraph(Int_t n, const Int_t *x, const Int_t *y, Option_t *option="")
Draw this graph with new attributes.
virtual void SetParameter(Int_t param, Double_t value)
TFitResultPtr FitObject(TH1 *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
fitting function for a TH1 (called from TH1::Fit)
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Double_t Sqrt(Double_t x)
virtual void ExecuteEventHelper(TGraph *theGraph, Int_t event, Int_t px, Int_t py)=0
virtual void PaintStats(TGraph *theGraph, TF1 *fit)=0
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual void Set(Int_t n)
Set number of points in the graph Existing coordinates are preserved New coordinates above fNpoints a...
virtual Style_t GetMarkerStyle() const
Bool_t GetRotateTitle() const
virtual Width_t GetLineWidth() const
void SetHistLineColor(Color_t color=1)
virtual void SetEditable(Bool_t editable=kTRUE)
if editable=kFALSE, the graph cannot be modified with the mouse by default a TGraph is editable ...
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
Allocate arrays.
virtual void PaintGrapHist(TGraph *theGraph, Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)=0
virtual Int_t GetNpar() const
virtual void PaintGraph(TGraph *theGraph, Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)=0
virtual Double_t GetCorrelationFactor() const
Return graph correlation factor.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
static Bool_t CompareY(const TGraph *gr, Int_t left, Int_t right)
Return kTRUE if fY[left] > fY[right]. Can be used by Sort.
virtual Float_t GetLabelOffset() const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".