128 if (!CtorAllocate())
return;
139 if (!CtorAllocate())
return;
140 FillZero(0, fNpoints);
154 if (!CtorAllocate())
return;
155 for (
Int_t i = 0; i <
n; i++) {
172 if (!CtorAllocate())
return;
173 for (
Int_t i = 0; i <
n; i++) {
191 if (!CtorAllocate())
return;
192 for (
Int_t i = 0; i <
n; i++) {
193 fX[i] =
start+i*step;
209 if (!CtorAllocate())
return;
221 fNpoints =
gr.fNpoints;
222 fMaxSize =
gr.fMaxSize;
223 if (
gr.fFunctions) fFunctions = (
TList*)
gr.fFunctions->Clone();
224 else fFunctions =
new TList;
226 fHistogram = (TH1F*)gr.fHistogram->Clone();
227 fHistogram->SetDirectory(nullptr);
229 fHistogram = nullptr;
231 fMinimum =
gr.fMinimum;
232 fMaximum =
gr.fMaximum;
242 memcpy(fX,
gr.fX,
n);
243 memcpy(fY,
gr.fY,
n);
253 TAttLine::operator=(
gr);
254 TAttFill::operator=(
gr);
255 TAttMarker::operator=(
gr);
289 if (
fX)
delete []
fX;
290 if (
fY)
delete []
fY;
318 if (!CtorAllocate())
return;
321 for (
Int_t i = 0; i < fNpoints; i++) {
322 fX[i] = vx(i + ivxlow);
323 fY[i] = vy(i + ivylow);
337 if (!CtorAllocate())
return;
340 for (
Int_t i = 0; i < fNpoints; i++) {
341 fX[i] = vx(i + ivxlow);
342 fY[i] = vy(i + ivylow);
353 Error(
"TGraph",
"Pointer to histogram is null");
357 if (
h->GetDimension() != 1) {
358 Error(
"TGraph",
"Histogram must be 1-D; h %s is %d-D", h->GetName(), h->GetDimension());
361 fNpoints = h->GetXaxis()->GetNbins();
367 auto xaxis =
h->GetXaxis();
368 for (
Int_t i = 0; i < fNpoints; i++) {
369 fX[i] = xaxis->GetBinCenter(i + 1);
370 fY[i] =
h->GetBinContent(i + 1);
372 h->TAttLine::Copy(*
this);
373 h->TAttFill::Copy(*
this);
374 h->TAttMarker::Copy(*
this);
376 std::string gname =
"Graph_from_" + std::string(
h->GetName());
378 SetTitle(
h->GetTitle());
397 Error(
"TGraph",
"Pointer to function is null");
400 fNpoints =
f->GetNpx();
401 if (option) coption = *option;
402 if (coption ==
'i' || coption ==
'I') fNpoints++;
404 if (!CtorAllocate())
return;
411 for (i = 0; i < fNpoints; i++) {
412 if (coption ==
'i' || coption ==
'I') {
413 fX[i] =
xmin + i * dx;
414 if (i == 0) fY[i] = 0;
415 else fY[i] = integ + ((
TF1*)
f)->Integral(fX[i] - dx, fX[i]);
417 }
else if (coption ==
'd' || coption ==
'D') {
418 fX[i] =
xmin + (i + 0.5) * dx;
419 fY[i] = ((
TF1*)
f)->Derivative(fX[i]);
421 fX[i] =
xmin + (i + 0.5) * dx;
422 fY[i] = ((
TF1*)
f)->Eval(fX[i]);
425 if (integ != 0 && coption ==
'I') {
426 for (i = 1; i < fNpoints; i++) fY[i] /= integ;
429 f->TAttLine::Copy(*
this);
430 f->TAttFill::Copy(*
this);
431 f->TAttMarker::Copy(*
this);
434 SetTitle(
f->GetTitle());
463 gSystem->ExpandPathName(fname);
466 if (!infile.good()) {
468 Error(
"TGraph",
"Cannot open file: %s, TGraph is Zombie", filename);
474 if (!CtorAllocate())
return;
480 if (!option || !*option) {
486 format_ =
"%lg\t%lg";
491 while (std::getline(infile,
line,
'\n')) {
492 if (2 != sscanf(
line.c_str(), format_.
Data(), &
x, &
y)) {
511 Error(
"TGraph",
"Incorrect input format! Allowed formats are {\"%%lg\",\"%%*lg\" or \"%%*s\"}");
516 Error(
"TGraph",
"Incorrect input format! Only %d tag(s) in format whereas 2 \"%%lg\" tags are expected!", ntokens);
519 Int_t ntokensToBeSaved = 0 ;
521 for (
Int_t idx = 0; idx < ntokens; idx++) {
523 if (isTokenToBeSaved[idx] == 1) {
527 if (ntokens >= 2 && ntokensToBeSaved != 2) {
528 Error(
"TGraph",
"Incorrect input format! There are %d \"%%lg\" tag(s) in format whereas 2 and only 2 are expected!", ntokensToBeSaved);
529 delete [] isTokenToBeSaved ;
535 char * token = nullptr ;
537 Int_t token_idx = 0 ;
539 Int_t value_idx = 0 ;
543 while (std::getline(infile,
line,
'\n')) {
545 if (
line[
line.size() - 1] ==
char(13)) {
549 token = R__STRTOK_R(
const_cast<char *
>(
line.c_str()), option, &rest);
550 while (token !=
nullptr && value_idx < 2) {
551 if (isTokenToBeSaved[token_idx]) {
555 isLineToBeSkipped =
kTRUE ;
558 value[value_idx] = token_str.
Atof() ;
562 token = R__STRTOK_R(
nullptr, option, &rest);
565 if (!isLineToBeSkipped && value_idx == 2) {
572 isLineToBeSkipped =
kFALSE ;
580 delete [] isTokenToBeSaved ;
586 Warning(
"TGraph",
"No points were found in file %s with the specified input format %s", filename, format);
633 for (
Int_t i = 0; i < Narrays; ++i)
634 newarrays[i] =
nullptr;
636 for (
Int_t i = 0; i < Narrays; ++i)
637 newarrays[i] =
new Double_t[arraySize];
681 TString opt =
gEnv->GetValue(
"TGraph.BrowseOption",
"");
683 opt =
b ?
b->GetDrawOption() :
"alp";
684 opt = (opt ==
"") ?
"alp" : opt.Data();
708 Error(
"Chisquare",
"Function pointer is Null - return -1");
712 TString opt(option); opt.
ToUpper();
724 Double_t xl = 0, yl = 0, xr = 0, yr = 0;
735 return gr->
fX[left] >
gr->
fX[right];
743 return gr->
fY[left] >
gr->
fY[right];
810 if (ibegin < 0 || iend <= ibegin || obegin < 0) {
813 if (!arrays && ibegin == obegin) {
818 memmove(&arrays[0][obegin], &
fX[ibegin],
n);
819 memmove(&arrays[1][obegin], &
fY[ibegin],
n);
821 memmove(&
fX[obegin], &
fX[ibegin],
n);
822 memmove(&
fY[obegin], &
fY[ibegin],
n);
861 TString opt = option;
880 if ((!option || !strlen(option))) {
883 if (!
gPad->GetListOfPrimitives()->FindObject(
"TFrame"))
891 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
897 gPad->IncrementPaletteColor(1, opt);
986 return spline->
Eval(
x);
992 if (option && *option) {
993 TString opt = option;
999 std::vector<Double_t> xsort(
fNpoints);
1000 std::vector<Double_t> ysort(
fNpoints);
1001 std::vector<Int_t> indxsort(
fNpoints);
1004 xsort[i] =
fX[ indxsort[i] ];
1005 ysort[i] =
fY[ indxsort[i] ];
1009 TSpline3 s(
"", &xsort[0], &ysort[0],
fNpoints);
1027 if (
fX[low] ==
x)
return fY[low];
1042 if (low == -1 ||
fX[i] >
fX[low]) {
1045 }
else if (low2 == -1) low2 = i;
1046 }
else if (
fX[i] >
x) {
1047 if (up == -1 ||
fX[i] <
fX[up]) {
1050 }
else if (up2 == -1) up2 = i;
1066 assert(low != -1 && up != -1);
1068 if (
fX[low] ==
fX[up])
return fY[low];
1108 Double_t **ps =
Allocate(step * (newsize / step + (newsize % step ? 1 : 0)));
1132 memset(
fX + begin, 0, (end - begin)*
sizeof(
Double_t));
1133 memset(
fY + begin, 0, (end - begin)*
sizeof(
Double_t));
1261 Foption_t fitOption;
1264 ROOT::Fit::DataRange range(rxmin, rxmax);
1265 ROOT::Math::MinimizerOptions minOption;
1287 const char *linear = fname ? strstr(fname,
"++") : nullptr;
1292 TF1 *
f1 = (TF1*)
gROOT->GetFunction(fname);
1294 Printf(
"Unknown function: %s", fname);
1308 gROOT->MakeDefCanvas();
1311 Error(
"FitPanel",
"Unable to create a default canvas");
1316 TPluginHandler *handler =
gROOT->GetPluginManager()->FindHandler(
"TFitEditor");
1317 if (handler && handler->
LoadPlugin() != -1) {
1319 Error(
"FitPanel",
"Unable to crate the FitPanel");
1321 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
1330 if (rms1 == 0)
return 0;
1332 if (rms2 == 0)
return 0;
1347 sumxy +=
fX[i] *
fY[i];
1349 return sumxy /
sum - sumx /
sum * sumy /
sum;
1357 if (axis < 1 || axis > 2)
return 0;
1361 if (axis == 1) sumx +=
fX[i];
1372 if (axis < 1 || axis > 2)
return 0;
1378 sumx2 +=
fX[i] *
fX[i];
1381 sumx2 +=
fY[i] *
fY[i];
1460 Double_t rwxmin, rwxmax, rwymin, rwymax, maximum, minimum, dx,
dy;
1471 TH1F *histogr =
nullptr;
1476 }
else if (
gPad &&
gPad->GetLogy()) {
1487 if (rwxmin == rwxmax) rwxmax += 1.;
1488 if (rwymin == rwymax) rwymax += 1.;
1489 dx = 0.1 * (rwxmax - rwxmin);
1490 dy = 0.1 * (rwymax - rwymin);
1491 uxmin = rwxmin - dx;
1492 uxmax = rwxmax + dx;
1493 minimum = rwymin - dy;
1494 maximum = rwymax + dy;
1501 if (uxmin < 0 && rwxmin >= 0) {
1502 if (
gPad &&
gPad->GetLogx()) uxmin = 0.9 * rwxmin;
1505 if (uxmax > 0 && rwxmax <= 0) {
1506 if (
gPad &&
gPad->GetLogx()) uxmax = 1.1 * rwxmax;
1510 if (minimum < 0 && rwymin >= 0) minimum = 0.9 * rwymin;
1512 if (minimum <= 0 && gPad && gPad->GetLogy()) minimum = 0.001 * maximum;
1513 if (uxmin <= 0 && gPad && gPad->GetLogx()) {
1514 if (uxmax > 1000) uxmin = 1;
1515 else uxmin = 0.001 * uxmax;
1522 const char *gname =
GetName();
1523 if (!gname[0]) gname =
"Graph";
1529 ((
TGraph*)
this)->fHistogram =
new TH1F(gname,
GetTitle(), npt, rwxmin, rwxmax);
1535 fHistogram->GetYaxis()->SetLimits(minimum, maximum);
1599 return h ?
h->GetXaxis() :
nullptr;
1608 return h ?
h->GetYaxis() :
nullptr;
1618 Error(
"GetObjectInfo",
"Cannot be used without gPad");
1629 if (dpx * dpx + dpy * dpy < 25) {
1639 return Form(
"x=%g, y=%g",
x,
y);
1644 return Form(
"x=%g, y=%g, point=%d, xval=%g, yval=%g",
x,
y, ipoint, xval, yval);
1652 Double_t allcha, sumx, sumx2,
x, val, rms, mean;
1662 allcha = sumx = sumx2 = 0;
1663 for (bin = 0; bin <
fNpoints; bin++) {
1669 sumx2 += val *
x *
x;
1672 if (np == 0 || allcha == 0)
return;
1673 mean = sumx / allcha;
1676 if (rms == 0) rms = 1;
1732 Error(
"InsertPoint",
"Cannot be used without gPad, requires last mouse position");
1743 for (i = 0; i <
fNpoints - 1; i++) {
1752 for (i = 0; i <
fNpoints - 1; i++) {
1764 if (dpx * dpx + dpy * dpy < 25) ipoint = 0;
1782 Error(
"TGraph",
"Inserted point index should be >= 0");
1787 Error(
"TGraph",
"Inserted point index should be <= %d",
fNpoints);
1840 if (first < 0) first = 0;
1843 if (first >= last)
return 0;
1844 Int_t np = last - first + 1;
1851 for (
Int_t i = first; i <= last; i++) {
1852 Int_t j = first + (i - first + 1) % np;
1890 const Int_t idim = 20;
1906 if (
m > idim ||
m >
n)
return;
1908 for (
l = 2;
l <=
m; ++
l) {
1910 b[
m +
l*20 - 21] = zero;
1916 if (xk < xmin || xk >
xmax)
continue;
1921 for (
l = 2;
l <=
m; ++
l) {
1924 da[
l-1] += power * yk;
1926 for (
l = 2;
l <=
m; ++
l) {
1928 b[
m +
l*20 - 21] += power;
1932 for (i = 3; i <=
m; ++i) {
1933 for (k = i; k <=
m; ++k) {
1934 b[k - 1 + (i-1)*20 - 21] =
b[k + (i-2)*20 - 21];
1941 for (i = 1; i <
m; ++i)
a[i] = 0;
1944 for (i = 0; i <
m; ++i)
a[i] = da[i];
1974 xbar = ybar = x2bar = xybar = 0;
1978 if (xk < xmin || xk >
xmax)
continue;
1982 if (yk <= 0) yk = 1
e-9;
1991 det = fn * x2bar - xbar * xbar;
1994 if (fn > 0) a0 = ybar / fn;
2000 a0 = (x2bar * ybar - xbar * xybar) / det;
2001 a1 = (fn * xybar - xbar * ybar) / det;
2019 if (painter) painter->
PaintGraph(
this, npoints,
x,
y, chopt);
2046 printf(
"x[%d]=%g, y[%d]=%g\n", i,
fX[i], i,
fY[i]);
2070 Error(
"RemovePoint",
"Cannot be used without gPad, requires last mouse position");
2083 if (dpx * dpx + dpy * dpy < 100) {
2097 if ((ipoint < 0) || (ipoint >=
fNpoints))
2138 TString fname = filename;
2139 TString opt = option;
2143 if (fname.
EndsWith(
".csv")) {del =
','; ext =
"csv";}
2144 else if (fname.
EndsWith(
".tsv")) {del =
'\t'; ext =
"tsv";}
2145 else if (fname.
EndsWith(
".txt")) {del =
' '; ext =
"txt";}
2149 out.open(filename, std::ios::out);
2151 Error(
"SaveAs",
"cannot open file: %s", filename);
2159 else if (opt.
Contains(
"asymmerrors"))
2160 asymm_erros =
kTRUE;
2162 plain_errors =
kTRUE;
2164 plain_errors =
kTRUE;
2166 asymm_erros =
kTRUE;
2170 TString xtitle, ytitle;
2183 out <<
"# " << xtitle <<
"\t" << ytitle <<
"\tex\tey\n";
2185 out <<
"# " << xtitle <<
"\tex\t" << ytitle <<
"\tey\n";
2187 for(
int i = 0; i <
fNpoints ; i++) {
2193 out <<
x << del <<
y << del <<
ex << del <<
ey <<
"\n";
2195 out <<
x << del <<
ex << del <<
y << del <<
ey <<
"\n";
2197 }
else if (asymm_erros) {
2200 out <<
"# " << xtitle <<
"\t" << ytitle <<
"\texl\texh\teyl\teyh\n";
2202 out <<
"# " << xtitle <<
"\texl\texh\t" << ytitle <<
"\teyl\teyh\n";
2204 for(
int i = 0; i <
GetN(); i++) {
2212 out <<
x << del <<
y << del << exl << del << exh << del << eyl << del << eyh <<
"\n";
2214 out <<
x << del << exl << del << exh << del <<
y << del << eyl << del << eyh <<
"\n";
2216 }
else if (no_errors) {
2218 out <<
"# " << xtitle <<
"\t" << ytitle <<
"\n";
2223 Info(
"SaveAs",
"%s file: %s has been generated", ext.
Data(), filename);
2253 thread_local Int_t frameNumber = 0;
2255 TString ref =
"Graph";
2267 out <<
" " <<varname <<
"->SetHistogram(" <<
fHistogram->GetName() <<
");\n";
2276 const char *
l = strstr(option,
"multigraph");
2278 out <<
" multigraph->Add(" << varname <<
",\"" <<
l + 10 <<
"\");\n";
2281 l = strstr(option,
"th2poly");
2283 out <<
" " <<
l + 7 <<
"->AddBin(" << varname <<
");\n";
2299 TString opt = option; opt.
ToLower();
2354 if (!painter)
return;
2445 fTitle.ReplaceAll(
"#;",2,
"#semicolon",10);
2453 fTitle.ReplaceAll(
"#semicolon",10,
"#;",2);
2535 if (greaterfunc ==
TGraph::CompareX && ascending && low == 0 && high == -1111)
2544 std::vector<int> sorting_indices(
fNpoints);
2545 std::iota(sorting_indices.begin(), sorting_indices.end(), 0);
2551 std::stable_sort(sorting_indices.begin() + low, sorting_indices.begin() + high + 1,
2552 [&](
int left,
int right) { return left != right && greaterfunc(this, left, right) != ascending; });
2554 Int_t numSortedPoints = high - low + 1;
2563 if (
b.IsReading()) {
2565 Version_t R__v =
b.ReadVersion(&R__s, &R__c);
2571 while ((obj = next())) {
2573 TF1 *
f1 = (TF1*)obj;
2639 std::vector<Double_t> fXSorted(numSortedPoints);
2640 std::vector<Double_t> fYSorted(numSortedPoints);
2643 std::generate(fXSorted.begin(), fXSorted.end(),
2644 [begin = low, &sorting_indices,
this]()
mutable { return fX[sorting_indices[begin++]]; });
2645 std::generate(fYSorted.begin(), fYSorted.end(),
2646 [begin = low, &sorting_indices,
this]()
mutable { return fY[sorting_indices[begin++]]; });
2649 std::copy(fXSorted.begin(), fXSorted.end(),
fX + low);
2650 std::copy(fYSorted.begin(), fYSorted.end(),
fY + low);
2659 arr[pos1] = arr[pos2];
2670 if (
gStyle->IsReading()) {
2694 while ((obj = next())) {
2710 "Cannot merge - an object which doesn't inherit from TGraph found in the list");
2724 for (
Int_t i = 0 ; i <
g->GetN(); i++) {
2725 g->GetPoint(i,
x,
y);
2763 ,
Int_t maxiterations)
2766 static Int_t j1, it, j3, j2;
2799 if (j1 != 2)
goto L100;
2800 if (ya * Y < 0)
goto L120;
2809 if (it >= maxiterations) k = j1;
2817 if (j1 > 3)
goto L170;
2833 if (it >= maxiterations) k = j1;
2862 x2 =
X - Y * (
X - x1) / (Y - y1);
2866 if ((x2 -
a)*(x2 -
b) < 0) {
2868 if (it >= maxiterations) k = j1;
2879 if ((x2 -
a)*(x2 -
b) >= 0) {
2884 if (it >= maxiterations) k = j1;
2892 if (j1 != 4)
return;
2903 if (ytest <= 0)
goto L130;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Axis_t
Axis values type (double).
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
TVectorT< Double_t > TVectorD
TVectorT< Float_t > TVectorF
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
void Copy(TAttFill &attfill) const
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
void Copy(TAttLine &attline) const
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
void Copy(TAttMarker &attmarker) const
virtual void Streamer(TBuffer &)
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Class to manage histogram axis.
virtual Bool_t GetTimeDisplay() const
Bool_t GetRotateTitle() const
const char * GetTitle() const override
Returns title of object.
Bool_t GetCenterTitle() const
Bool_t GetNoExponent() const
virtual const char * GetTimeFormat() const
Using a TBrowser one can browse all ROOT objects.
Buffer base class used for serializing objects.
Collection abstract base class.
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
virtual Int_t GetNpar() const
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
virtual void SetParent(TObject *p=nullptr)
virtual void SetParameter(Int_t param, Double_t value)
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
Int_t fNpoints
Number of points <= fMaxSize.
void UseCurrentStyle() override
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
virtual void Expand(Int_t newsize)
Int_t fMaxSize
!Current dimension of arrays fX and fY
virtual void SetPointX(Int_t i, Double_t x)
TString fOption
Options used for drawing the graph.
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
Double_t ** ShrinkAndCopy(Int_t size, Int_t iend)
virtual Int_t RemovePoint()
static Bool_t CompareX(const TGraph *gr, Int_t left, Int_t right)
TH1F * fHistogram
Pointer to histogram used for drawing axis.
void Paint(Option_t *chopt="") override
This method must be overridden if a class wants to paint itself.
@ kNotEditable
Bit set if graph is non editable.
@ kIsHighlight
Bit set if graph is highlight.
@ kIsSortedX
Graph is sorted in X points.
@ kClipFrame
Clip to the frame boundary.
@ kResetHisto
fHistogram must be reset in GetHistogram
@ kNoStats
Don't draw stats box.
virtual Bool_t DoMerge(const TGraph *g)
virtual Double_t GetMean(Int_t axis=1) const
virtual void InitGaus(Double_t xmin=0, Double_t xmax=0)
Double_t GetMinimum() const
virtual void DrawGraph(Int_t n, const Int_t *x, const Int_t *y, Option_t *option="")
void Print(Option_t *chopt="") const override
This method must be overridden when a class wants to print itself.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
virtual void SetStats(Bool_t stats=kTRUE)
virtual void Add(TF1 *f, Double_t c1=1)
virtual void Scale(Double_t c1=1., Option_t *option="y")
TClass * IsA() const override
static Bool_t CompareRadius(const TGraph *gr, Int_t left, Int_t right)
virtual void LeastSquareLinearFit(Int_t n, Double_t &a0, Double_t &a1, Int_t &ifail, Double_t xmin=0, Double_t xmax=0)
virtual Double_t GetErrorXlow(Int_t bin) const
virtual void SetEditable(Bool_t editable=kTRUE)
TF1 * GetFunction(const char *name) const
virtual Double_t Eval(Double_t x, TSpline *spline=nullptr, Option_t *option="") const
Double_t * fY
[fNpoints] array of Y points
virtual Double_t GetErrorX(Int_t bin) const
virtual Double_t ** Allocate(Int_t newsize)
virtual Int_t InsertPoint()
virtual Double_t GetErrorY(Int_t bin) const
virtual Int_t IsInside(Double_t x, Double_t y) const
virtual void Set(Int_t n)
virtual Int_t Merge(TCollection *list)
char * GetObjectInfo(Int_t px, Int_t py) const override
Returns string containing info about the object at position (px,py).
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
static Bool_t CompareY(const TGraph *gr, Int_t left, Int_t right)
TList * fFunctions
Pointer to list of functions (fits and user).
virtual void SetMinimum(Double_t minimum=-1111)
static Bool_t CompareArg(const TGraph *gr, Int_t left, Int_t right)
virtual void InsertPointBefore(Int_t ipoint, Double_t x, Double_t y)
virtual TH1F * GetHistogram() const
void Streamer(TBuffer &) override
Stream an object of class TObject.
void Zero(Int_t &k, Double_t AZ, Double_t BZ, Double_t E2, Double_t &X, Double_t &Y, Int_t maxiterations)
void Browse(TBrowser *b) override
Browse object. May be overridden for another default action.
TList * GetListOfFunctions() const
virtual Double_t GetErrorXhigh(Int_t bin) const
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
void SaveAs(const char *filename="graph", Option_t *option="") const override
Save this object in the file specified by filename.
virtual Double_t GetCorrelationFactor() const
virtual Bool_t IsHighlight() const
virtual void SetPointY(Int_t i, Double_t y)
void SetName(const char *name="") override
Set the name of the TNamed.
virtual void SwapPoints(Int_t pos1, Int_t pos2)
virtual void PaintStats(TF1 *fit)
virtual Double_t Integral(Int_t first=0, Int_t last=-1) const
virtual Double_t GetRMS(Int_t axis=1) const
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
Bool_t GetEditable() const
virtual Double_t GetPointY(Int_t i) const
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
virtual Bool_t CopyPoints(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Double_t ** ExpandAndCopy(Int_t size, Int_t iend)
void SaveHistogramAndFunctions(std::ostream &out, const char *varname, Option_t *option)
Double_t * fX
[fNpoints] array of X points
TObject * FindObject(const char *name) const override
Must be redefined in derived classes.
virtual Double_t GetCovariance() const
virtual Double_t Chisquare(TF1 *f1, Option_t *option="") const
static void SwapValues(Double_t *arr, Int_t pos1, Int_t pos2)
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
virtual void SetHistogram(TH1F *h)
virtual Double_t GetErrorYlow(Int_t bin) const
Double_t fMinimum
Minimum value for plotting along y.
void PaintGraph(Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
void SetTitle(const char *title="") override
Set the title of the TNamed.
virtual void SetMaximum(Double_t maximum=-1111)
void RecursiveRemove(TObject *obj) override
Recursively remove this object from a list.
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
virtual void Apply(TF1 *f)
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
virtual void UpdateArrays(const std::vector< Int_t > &sorting_indices, Int_t numSortedPoints, Int_t low)
virtual void LeastSquareFit(Int_t m, Double_t *a, Double_t xmin=0, Double_t xmax=0)
virtual Double_t GetPointX(Int_t i) const
void PaintGrapHist(Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
virtual void InitExpo(Double_t xmin=0, Double_t xmax=0)
virtual void MovePoints(Double_t dx, Double_t dy, Bool_t logx=kFALSE, Bool_t logy=kFALSE)
void SetNameTitle(const char *name="", const char *title="") override
Set all the TNamed parameters (name and title).
virtual void InitPolynom(Double_t xmin=0, Double_t xmax=0)
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)
virtual void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Double_t fMaximum
Maximum value for plotting along y.
virtual void SetHighlight(Bool_t set=kTRUE)
virtual Double_t GetErrorYhigh(Int_t bin) const
TGraph & operator=(const TGraph &)
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
@ kNoStats
Don't draw stats box.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
static void SavePrimitiveFunctions(std::ostream &out, const char *varname, TList *lst)
Save list of functions Also can be used by TGraph classes.
The TNamed class is the base class for all named ROOT classes.
void SavePrimitiveNameTitle(std::ostream &out, const char *variable_name)
Save object name and title into the output stream "out".
const char * GetName() const override
Returns name of object.
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Mother of all ROOT objects.
Bool_t TestBit(UInt_t f) const
virtual void UseCurrentStyle()
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object in the file specified by filename.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
TObject()
TObject constructor.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
static TString SavePrimitiveVector(std::ostream &out, const char *prefix, Int_t len, Double_t *arr, Int_t flag=0)
Save array in the output stream "out" as vector.
@ kCanDelete
if object in a list can be deleted
@ kInvalidObject
if object ctor succeeded but object should not be used
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.
Base class for spline implementation containing the Draw/Paint methods.
virtual Double_t Eval(Double_t x) const =0
void ToLower()
Change string to lower-case.
Int_t Atoi() const
Return integer value of string.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
static TVirtualFitter * GetFitter()
static: return the current Fitter
virtual TObject * GetUserFunc() const
virtual void DrawPanelHelper(TGraph *theGraph)=0
virtual void ExecuteEventHelper(TGraph *theGraph, Int_t event, Int_t px, Int_t py)=0
virtual void SetHighlight(TGraph *theGraph)=0
virtual void PaintGrapHist(TGraph *theGraph, Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)=0
virtual Int_t DistancetoPrimitiveHelper(TGraph *theGraph, Int_t px, Int_t py)=0
virtual void PaintGraph(TGraph *theGraph, Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)=0
virtual void PaintStats(TGraph *theGraph, TF1 *fit)=0
virtual void PaintHelper(TGraph *theGraph, Option_t *option)=0
static TVirtualGraphPainter * GetPainter()
Static function returning a pointer to the current graph painter.
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)
double Chisquare(const TH1 &h1, TF1 &f1, bool useRange, EChisquareType type, bool useIntegral=false)
compute the chi2 value for an histogram given a function (see TH1::Chisquare for the documentation)
void FitOptionsMake(EFitObjectType type, const char *option, Foption_t &fitOption)
Decode list of options into fitOption.
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in array...
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
static uint64_t sum(uint64_t i)