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");
698 if (!
fGraphs || !gr)
return "";
701 while ((obj = next())) {
713 Double_t allcha, sumx, sumx2,
x, val, rms, mean;
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())) {
984 Double_t rwxmin = 0.,rwxmax = 0.,rwymin = 0.,rwymax = 0.;
988 while ((g = (
TGraph*) next())) {
989 if (g->
GetN() <= 0)
continue;
990 if (initialrangeset) {
993 if (rx1 < rwxmin) rwxmin = rx1;
994 if (ry1 < rwymin) rwymin = ry1;
995 if (rx2 > rwxmax) rwxmax = rx2;
996 if (ry2 > rwymax) rwymax = ry2;
999 initialrangeset =
kTRUE;
1001 if (g->
GetN() > npt) npt = g->
GetN();
1072 strlcpy(option,choptin,128);
1073 Int_t nch = strlen(choptin);
1074 for (
Int_t i=0;i<nch;i++) option[i] = toupper(option[i]);
1077 char *l1 = strstr(option,
"PFC");
1078 char *l2 = strstr(option,
"PLC");
1079 char *l3 = strstr(option,
"PMC");
1080 if (l1 || l2 || l3) {
1082 if (l1) strncpy(l1,
" ",3);
1083 if (l2) strncpy(l2,
" ",3);
1084 if (l3) strncpy(l3,
" ",3);
1089 gPad->IncrementPaletteColor(ngraphs, opt1);
1090 for (
Int_t i=0;i<ngraphs;i++) {
1091 ic =
gPad->NextPaletteColor();
1104 l = (
char*)strstr(chopt.
Data(),
"3D");
1106 l = (
char*)strstr(chopt.
Data(),
"L");
1111 l = (
char*)strstr(chopt.
Data(),
"PADS");
1120 l = (
char*)strstr(chopt.
Data(),
"A");
1125 Double_t maximum, minimum, rwxmin, rwxmax, rwymin, rwymax, uxmin, uxmax, dx, dy;
1126 rwxmin =
gPad->GetUxmin();
1127 rwxmax =
gPad->GetUxmax();
1128 rwymin =
gPad->GetUymin();
1129 rwymax =
gPad->GetUymax();
1135 char *timeformat = 0;
1143 for (
Int_t i=0;i<ngraphs;i++) {
1154 xtitle =
new char[nch+1];
1159 ytitle =
new char[nch+1];
1164 timeformat =
new char[nch+1];
1174 uxmin =
gPad->PadtoX(rwxmin);
1175 uxmax =
gPad->PadtoX(rwxmax);
1178 while ((g = (
TGraph*) next())) {
1179 if (g->
GetN() <= 0)
continue;
1180 if (initialrangeset) {
1183 if (rx1 < rwxmin) rwxmin = rx1;
1184 if (ry1 < rwymin) rwymin = ry1;
1185 if (rx2 > rwxmax) rwxmax = rx2;
1186 if (ry2 > rwymax) rwymax = ry2;
1189 initialrangeset =
kTRUE;
1191 if (g->
GetN() > npt) npt = g->
GetN();
1193 if (rwxmin == rwxmax) rwxmax += 1.;
1194 if (rwymin == rwymax) rwymax += 1.;
1195 dx = 0.05*(rwxmax-rwxmin);
1196 dy = 0.05*(rwymax-rwymin);
1197 uxmin = rwxmin - dx;
1198 uxmax = rwxmax + dx;
1199 if (
gPad->GetLogy()) {
1200 if (rwymin <= 0) rwymin = 0.001*rwymax;
1204 minimum = rwymin - dy;
1205 maximum = rwymax + dy;
1207 if (minimum < 0 && rwymin >= 0) minimum = 0;
1208 if (maximum > 0 && rwymax <= 0) maximum = 0;
1213 if (uxmin < 0 && rwxmin >= 0) {
1214 if (
gPad->GetLogx()) uxmin = 0.9*rwxmin;
1217 if (uxmax > 0 && rwxmax <= 0) {
1218 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1221 if (minimum < 0 && rwymin >= 0) {
1222 if (
gPad->GetLogy()) minimum = 0.9*rwymin;
1225 if (maximum > 0 && rwymax <= 0) {
1226 if (
gPad->GetLogy()) maximum = 1.1*rwymax;
1229 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1230 if (uxmin <= 0 && gPad->GetLogx()) {
1231 if (uxmax > 1000) uxmin = 1;
1232 else uxmin = 0.001*uxmax;
1273 gPad->PushSelectableObject(obj);
1275 if (!
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() && obj ==
gPad->GetSelected())) {
1281 else obj->
Paint(
"L");
1295 while ((f = (
TObject*) next())) {
1316 Int_t existingPads = 0;
1323 while ((obj = nextPad())) {
1326 if (existingPads < neededPads) {
1329 if (nx*nx < neededPads) nx++;
1331 if (((nx*ny)-nx) >= neededPads) ny--;
1345 if (strlen(apopt)) {
1365 Double_t rwxmin=0., rwxmax=0., rwymin=0., rwymax=0.;
1379 while ((g = (
TGraph*) next())) {
1382 if (rx1 < rwxmin) rwxmin = rx1;
1383 if (ry1 < rwymin) rwymin = ry1;
1384 if (rx2 > rwxmax) rwxmax = rx2;
1385 if (ry2 > rwymax) rwymax = ry2;
1386 if (g->
GetN() > npt) npt = g->
GetN();
1391 TH2F* frame =
new TH2F(
"frame",
"", ndiv, 0., (
Double_t)(ndiv), npt, rwxmin, rwxmax);
1402 for (i=ndiv; i>=1; i--) {
1413 l = (
char*)strstr(option,
"A");
1414 if (l) frame->
Paint(
"lego9,fb,bb");
1415 l = (
char*)strstr(option,
"BB");
1416 if (!l) frame->
Paint(
"lego9,fb,a,same");
1429 while ((g = (
TGraph*) next())) {
1436 gPad->TAttLine::Modify();
1437 for (i=0; i<npt-1; i++) {
1442 if (
gPad->Clip(&xc[0], &yc[0], xl, yl, xu, yu)<2) {
1449 gPad->PaintLine3D(xyz1, xyz2);
1455 l = (
char*)strstr(option,
"FB");
1456 if (!l) frame->
Paint(
"lego9,bb,a,same");
1469 while ((g = (
TGraph*) next())) {
1496 out<<
" "<<std::endl;
1500 out<<
" TMultiGraph *";
1502 out<<
"multigraph = new TMultiGraph();"<<std::endl;
1503 out<<
" multigraph->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
1504 out<<
" multigraph->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
1516 const char *
l = strstr(option,
"th2poly");
1518 out<<
" "<<l+7<<
"->AddBin(multigraph);"<<std::endl;
1520 out<<
" multigraph->Draw(" <<quote<<option<<quote<<
");"<<std::endl;
1525 if (xaxis) xaxis->
SaveAttributes(out,
"multigraph",
"->GetXaxis()");
1526 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
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
Return the capacity of the collection, i.e.
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.
Option_t * GetOption() const
Returns the object option stored in the list.
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".