342 while ((g = (
TGraph*) next())) {
391 if (!graphlist)
return;
415 opt = (opt ==
"") ?
"alp" : opt.
Data();
428 const Int_t kMaxDiff = 10;
429 Int_t distance = 9999;
432 if (distance <= 0)
return distance;
439 while ((g = (
TGraph*) next())) {
441 if (dist <= 0)
return 0;
442 if (dist < kMaxDiff) {
gPad->SetSelected(g);
return dist;}
468 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
483 linear= (
char*)strstr(fname,
"++");
486 f1=
new TF1(fname, fname, xmin, xmax);
488 f1 = (
TF1*)
gROOT->GetFunction(fname);
489 if (!f1) {
Printf(
"Unknown function: %s",fname);
return -1; }
492 return Fit(f1,option,
"",xmin,xmax);
675 gROOT->MakeDefCanvas();
678 Error(
"FitPanel",
"Unable to create a default canvas");
686 Error(
"FitPanel",
"Unable to crate the FitPanel");
689 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
701 while ((obj = next())) {
719 allcha = sumx = sumx2 = 0;
724 while ((g = (
TGraph*) next())) {
728 for (bin=0; bin<npp; bin++) {
730 if (x<xmin || x>xmax)
continue;
738 if (np == 0 || allcha == 0)
return;
743 if (rms == 0) rms = 1;
801 const Int_t idim = 20;
804 Int_t i, k,
l, ifail, bin;
815 while ((g = (
TGraph*) next())) {
818 for (bin=0; bin<npp; bin++) {
820 if (xk < xmin || xk > xmax)
continue;
828 if (m > idim || m > n)
return;
830 for (l = 2; l <=
m; ++
l) {
832 b[m + l*20 - 21] = zero;
838 while ((g = (
TGraph*) next())) {
843 for (k = 0; k <= npp; ++k) {
845 if (xk < xmin || xk > xmax)
continue;
850 for (l = 2; l <=
m; ++
l) {
855 for (l = 2; l <=
m; ++
l) {
857 b[m + l*20 - 21] += power;
862 for (i = 3; i <=
m; ++i) {
863 for (k = i; k <=
m; ++k) {
864 b[k - 1 + (i-1)*20 - 21] = b[k + (i-2)*20 - 21];
873 for (i=1; i<
m; ++i) a[i] = 0;
876 for (i=0; i<
m; ++i) a[i] = da[i];
902 xbar = ybar = x2bar = xybar = 0;
908 while ((g = (
TGraph*) next())) {
912 for (i = 0; i < npp; ++i) {
914 if (xk < xmin || xk > xmax)
continue;
918 if (yk <= 0) yk = 1
e-9;
928 det = fn*x2bar - xbar*xbar;
931 if (fn > 0) a0 = ybar/fn;
937 a0 = (x2bar*ybar - xbar*xybar) / det;
938 a1 = (fn*xybar - xbar*ybar) / det;
951 while ((g = (
TGraph*) next())) {
978 Double_t rwxmin = 0.,rwxmax = 0.,rwymin = 0.,rwymax = 0.;
982 while ((g = (
TGraph*) next())) {
983 if (g->
GetN() <= 0)
continue;
984 if (initialrangeset) {
987 if (rx1 < rwxmin) rwxmin = rx1;
988 if (ry1 < rwymin) rwymin = ry1;
989 if (rx2 > rwxmax) rwxmax = rx2;
990 if (ry2 > rwymax) rwymax = ry2;
993 initialrangeset =
kTRUE;
995 if (g->
GetN() > npt) npt = g->
GetN();
1067 strlcpy(option,choptin,128);
1068 Int_t nch = strlen(choptin);
1069 for (
Int_t i=0;i<nch;i++) option[i] = toupper(option[i]);
1072 char *l1 = strstr(option,
"PFC");
1073 char *l2 = strstr(option,
"PLC");
1074 char *l3 = strstr(option,
"PMC");
1075 if (l1 || l2 || l3) {
1077 if (l1) strncpy(l1,
" ",3);
1078 if (l2) strncpy(l2,
" ",3);
1079 if (l3) strncpy(l3,
" ",3);
1084 gPad->IncrementPaletteColor(ngraphs, opt1);
1085 for (
Int_t i=0;i<ngraphs;i++) {
1086 ic =
gPad->NextPaletteColor();
1099 l = (
char*)strstr(chopt.
Data(),
"3D");
1101 l = (
char*)strstr(chopt.
Data(),
"L");
1106 l = (
char*)strstr(chopt.
Data(),
"PADS");
1115 l = (
char*)strstr(chopt.
Data(),
"A");
1120 Double_t maximum, minimum, rwxmin, rwxmax, rwymin, rwymax, uxmin, uxmax, dx, dy;
1121 rwxmin =
gPad->GetUxmin();
1122 rwxmax =
gPad->GetUxmax();
1123 rwymin =
gPad->GetUymin();
1124 rwymax =
gPad->GetUymax();
1130 char *timeformat = 0;
1138 for (
Int_t i=0;i<ngraphs;i++) {
1149 xtitle =
new char[nch+1];
1154 ytitle =
new char[nch+1];
1159 timeformat =
new char[nch+1];
1169 uxmin =
gPad->PadtoX(rwxmin);
1170 uxmax =
gPad->PadtoX(rwxmax);
1173 while ((g = (
TGraph*) next())) {
1174 if (g->
GetN() <= 0)
continue;
1175 if (initialrangeset) {
1178 if (rx1 < rwxmin) rwxmin = rx1;
1179 if (ry1 < rwymin) rwymin = ry1;
1180 if (rx2 > rwxmax) rwxmax = rx2;
1181 if (ry2 > rwymax) rwymax = ry2;
1184 initialrangeset =
kTRUE;
1186 if (g->
GetN() > npt) npt = g->
GetN();
1188 if (rwxmin == rwxmax) rwxmax += 1.;
1189 if (rwymin == rwymax) rwymax += 1.;
1190 dx = 0.05*(rwxmax-rwxmin);
1191 dy = 0.05*(rwymax-rwymin);
1192 uxmin = rwxmin - dx;
1193 uxmax = rwxmax + dx;
1194 if (
gPad->GetLogy()) {
1195 if (rwymin <= 0) rwymin = 0.001*rwymax;
1199 minimum = rwymin - dy;
1200 maximum = rwymax + dy;
1202 if (minimum < 0 && rwymin >= 0) minimum = 0;
1203 if (maximum > 0 && rwymax <= 0) maximum = 0;
1208 if (uxmin < 0 && rwxmin >= 0) {
1209 if (
gPad->GetLogx()) uxmin = 0.9*rwxmin;
1212 if (uxmax > 0 && rwxmax <= 0) {
1213 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1216 if (minimum < 0 && rwymin >= 0) {
1217 if (
gPad->GetLogy()) minimum = 0.9*rwymin;
1220 if (maximum > 0 && rwymax <= 0) {
1221 if (
gPad->GetLogy()) maximum = 1.1*rwymax;
1224 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1225 if (uxmin <= 0 && gPad->GetLogx()) {
1226 if (uxmax > 1000) uxmin = 1;
1227 else uxmin = 0.001*uxmax;
1268 gPad->PushSelectableObject(obj);
1270 if (!
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() && obj ==
gPad->GetSelected())) {
1276 else obj->
Paint(
"L");
1290 while ((f = (
TObject*) next())) {
1311 Int_t existingPads = 0;
1318 while ((obj = nextPad())) {
1321 if (existingPads < neededPads) {
1324 if (nx*nx < neededPads) nx++;
1326 if (((nx*ny)-nx) >= neededPads) ny--;
1340 if (strlen(apopt)) {
1360 Double_t rwxmin=0., rwxmax=0., rwymin=0., rwymax=0.;
1374 while ((g = (
TGraph*) next())) {
1377 if (rx1 < rwxmin) rwxmin = rx1;
1378 if (ry1 < rwymin) rwymin = ry1;
1379 if (rx2 > rwxmax) rwxmax = rx2;
1380 if (ry2 > rwymax) rwymax = ry2;
1381 if (g->
GetN() > npt) npt = g->
GetN();
1386 TH2F* frame =
new TH2F(
"frame",
"", ndiv, 0., (
Double_t)(ndiv), npt, rwxmin, rwxmax);
1397 for (i=ndiv; i>=1; i--) {
1408 l = (
char*)strstr(option,
"A");
1409 if (l) frame->
Paint(
"lego9,fb,bb");
1410 l = (
char*)strstr(option,
"BB");
1411 if (!l) frame->
Paint(
"lego9,fb,a,same");
1424 while ((g = (
TGraph*) next())) {
1431 gPad->TAttLine::Modify();
1432 for (i=0; i<npt-1; i++) {
1437 if (
gPad->Clip(&xc[0], &yc[0], xl, yl, xu, yu)<2) {
1444 gPad->PaintLine3D(xyz1, xyz2);
1450 l = (
char*)strstr(option,
"FB");
1451 if (!l) frame->
Paint(
"lego9,bb,a,same");
1464 while ((g = (
TGraph*) next())) {
1491 out<<
" "<<std::endl;
1495 out<<
" TMultiGraph *";
1497 out<<
"multigraph = new TMultiGraph();"<<std::endl;
1498 out<<
" multigraph->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
1499 out<<
" multigraph->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
1511 const char *l = strstr(option,
"th2poly");
1513 out<<
" "<<l+7<<
"->AddBin(multigraph);"<<std::endl;
1515 out<<
" multigraph->Draw(" <<quote<<option<<quote<<
");"<<std::endl;
1520 if (xaxis) xaxis->
SaveAttributes(out,
"multigraph",
"->GetXaxis()");
1521 if (yaxis) yaxis->
SaveAttributes(out,
"multigraph",
"->GetYaxis()");
void PaintPads(Option_t *chopt="")
Divides the active pad and draws all Graphs in the Multigraph separately.
virtual const char * GetName() const
Returns name of object.
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 void SetMinimum(Double_t minimum=-1111)
Set multigraph minimum.
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.
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms.
TF1 * GetFunction(const char *name) const
Return pointer to function with name.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual void FitPanel()
Display a panel with all histogram fit options.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetLimits(Double_t xmin, Double_t xmax)
virtual void SetTimeFormat(const char *format="")
Change the format used for time plotting.
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual void LeastSquareLinearFit(Int_t ndata, Double_t &a0, Double_t &a1, Int_t &ifail, Double_t xmin, Double_t xmax)
Least square linear fit without weights.
TString & ReplaceAll(const TString &s1, const TString &s2)
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
virtual void InitPolynom(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a polynom.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
A TMultiGraph is a collection of TGraph (or derived) objects.
virtual void SetMinimum(Double_t minimum=-1111)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Int_t LoadPlugin()
Load the plugin library for this handler.
Option_t * GetOption() const
1-D histogram with a float per channel (see TH1 documentation)}
void ToLower()
Change string to lower-case.
virtual void Paint(Option_t *chopt="")
Paint all the graphs of this multigraph.
virtual Int_t IsInside(Double_t x, Double_t y) const
Return 1 if the point (x,y) is inside one of the graphs 0 otherwise.
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual Width_t GetLineWidth() const
Return the line width.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static constexpr double mg
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual Style_t GetLineStyle() const
Return the line style.
TAxis * GetXaxis()
Get x axis of the graph.
virtual Bool_t GetTimeDisplay() const
The TNamed class is the base class for all named ROOT classes.
virtual void Print(Option_t *chopt="") const
Print graph values.
Double_t Log10(Double_t x)
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
TString & Append(const char *cs)
virtual ~TMultiGraph()
TMultiGraph destructor.
TList * GetListOfFunctions()
Return pointer to list of functions.
TH1F * GetHistogram()
Returns a pointer to the histogram used to draw the axis.
virtual void Draw(Option_t *chopt="")
Draw this multigraph with its current attributes.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
TMultiGraph & operator=(const TMultiGraph &)
Assignment operator.
virtual const char * GetTimeFormat() const
virtual void LeastSquareFit(Int_t m, Double_t *a, Double_t xmin, Double_t xmax)
Least squares lpolynomial fitting without weights.
virtual void SetTimeDisplay(Int_t value)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Using a TBrowser one can browse all ROOT objects.
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Int_t GetLast() const
Return last bin on the axis i.e.
const char * GetTitle() const
Returns title of object.
Class to manage histogram axis.
if object ctor succeeded but object should not be used
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void Print(Option_t *chopt="") const
Print the list of graphs.
virtual void Browse(TBrowser *b)
Browse multigraph.
Long_t ExecPlugin(int nargs, const T &... params)
2-D histogram with a float per channel (see TH1 documentation)}
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
fHistogram must be reset in GetHistogram
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
virtual void Clear(Option_t *option="")=0
static TVirtualFitter * GetFitter()
static: return the current Fitter
TAxis * GetYaxis()
Get y axis of the graph.
virtual TList * GetListOfPrimitives() const =0
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void InitExpo(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for an exponential.
if object destructor must call RecursiveRemove()
virtual TObjLink * FirstLink() const
TMultiGraph()
TMultiGraph default constructor.
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to each graph.
virtual Color_t GetLineColor() const
Return the line color.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
class describing the range in the coordinates it supports multiple range in a coordinate.
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.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Option_t * GetOption() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
void FitOptionsMake(EFitObjectType type, const char *option, Foption_t &fitOption)
Decode list of options into fitOption.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)=0
Abstract Base Class for Fitting.
void PaintPolyLine3D(Option_t *chopt="")
Paint all the graphs of this multigraph as 3D lines.
Mother of all ROOT objects.
TObject * GetObject() const
virtual Int_t GetNpar() const
virtual void SetMaximum(Double_t maximum=-1111)
Set multigraph maximum.
TList * GetListOfGraphs() const
virtual void Add(TObject *obj)
A Graph is a graphics object made of two arrays X and Y with npoints each.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual void SetParameter(Int_t param, Double_t value)
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
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)
Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
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 Add(TGraph *graph, Option_t *chopt="")
Add a new graph to the list of graphs.
Double_t Sqrt(Double_t x)
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.
virtual Option_t * GetGraphDrawOption(const TGraph *gr) const
Return the draw option for the TGraph gr in this TMultiGraph.
virtual Int_t GetSize() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual TObject * GetUserFunc() const
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
Bool_t IsWhitespace() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void InitGaus(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a gaussian.
TIter begin() const
Get iterator over internal graphs list.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
static constexpr double g