336 while ((g = (
TGraph*) next())) {
384 if (!graphlist)
return;
408 opt = (opt ==
"") ?
"alp" : opt.
Data();
421 const Int_t kMaxDiff = 10;
422 Int_t distance = 9999;
425 if (distance <= 0)
return distance;
432 while ((g = (
TGraph*) next())) {
434 if (dist <= 0)
return 0;
435 if (dist < kMaxDiff) {
gPad->SetSelected(g);
return dist;}
460 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
475 linear= (
char*)strstr(fname,
"++");
478 f1=
new TF1(fname, fname,
xmin, xmax);
480 f1 = (
TF1*)
gROOT->GetFunction(fname);
481 if (!f1) {
Printf(
"Unknown function: %s",fname);
return -1; }
484 return Fit(f1,option,
"",
xmin,xmax);
647 gROOT->MakeDefCanvas();
650 Error(
"FitPanel",
"Unable to create a default canvas");
658 Error(
"FitPanel",
"Unable to crate the FitPanel");
661 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
670 if (!
fGraphs || !gr)
return "";
673 while ((obj = next())) {
685 Double_t allcha, sumx, sumx2,
x, val, rms, mean;
691 allcha = sumx = sumx2 = 0;
696 while ((g = (
TGraph*) next())) {
700 for (bin=0; bin<npp; bin++) {
702 if (x<xmin || x>xmax)
continue;
710 if (np == 0 || allcha == 0)
return;
715 if (rms == 0) rms = 1;
773 const Int_t idim = 20;
776 Int_t i, k,
l, ifail, bin;
787 while ((g = (
TGraph*) next())) {
790 for (bin=0; bin<npp; bin++) {
792 if (xk < xmin || xk > xmax)
continue;
800 if (
m > idim ||
m > n)
return;
802 for (l = 2; l <=
m; ++
l) {
804 b[
m + l*20 - 21] = zero;
810 while ((g = (
TGraph*) next())) {
815 for (k = 0; k <= npp; ++k) {
817 if (xk < xmin || xk > xmax)
continue;
822 for (l = 2; l <=
m; ++
l) {
827 for (l = 2; l <=
m; ++
l) {
829 b[
m + l*20 - 21] += power;
834 for (i = 3; i <=
m; ++i) {
835 for (k = i; k <=
m; ++k) {
836 b[k - 1 + (i-1)*20 - 21] = b[k + (i-2)*20 - 21];
845 for (i=1; i<
m; ++i)
a[i] = 0;
848 for (i=0; i<
m; ++i)
a[i] = da[i];
873 xbar = ybar = x2bar = xybar = 0;
879 while ((g = (
TGraph*) next())) {
883 for (i = 0; i < npp; ++i) {
885 if (xk < xmin || xk >
xmax)
continue;
889 if (yk <= 0) yk = 1
e-9;
899 det = fn*x2bar - xbar*xbar;
902 if (fn > 0) a0 = ybar/fn;
908 a0 = (x2bar*ybar - xbar*xybar) / det;
909 a1 = (fn*xybar - xbar*ybar) / det;
922 while ((g = (
TGraph*) next())) {
1008 Int_t nch = strlen(option);
1013 l = (
char*)strstr(chopt.
Data(),
"3D");
1015 l = (
char*)strstr(chopt.
Data(),
"L");
1020 l = (
char*)strstr(chopt.
Data(),
"PADS");
1029 l = (
char*)strstr(chopt.
Data(),
"A");
1034 Double_t maximum, minimum, rwxmin, rwxmax, rwymin, rwymax, uxmin, uxmax, dx, dy;
1035 rwxmin =
gPad->GetUxmin();
1036 rwxmax =
gPad->GetUxmax();
1037 rwymin =
gPad->GetUymin();
1038 rwymax =
gPad->GetUymax();
1044 char *timeformat = 0;
1054 xtitle =
new char[nch+1];
1059 ytitle =
new char[nch+1];
1064 timeformat =
new char[nch+1];
1074 uxmin =
gPad->PadtoX(rwxmin);
1075 uxmax =
gPad->PadtoX(rwxmax);
1078 while ((g = (
TGraph*) next())) {
1079 if (g->
GetN() <= 0)
continue;
1080 if (initialrangeset) {
1083 if (rx1 < rwxmin) rwxmin = rx1;
1084 if (ry1 < rwymin) rwymin = ry1;
1085 if (rx2 > rwxmax) rwxmax = rx2;
1086 if (ry2 > rwymax) rwymax = ry2;
1089 initialrangeset =
kTRUE;
1091 if (g->
GetN() > npt) npt = g->
GetN();
1093 if (rwxmin == rwxmax) rwxmax += 1.;
1094 if (rwymin == rwymax) rwymax += 1.;
1095 dx = 0.05*(rwxmax-rwxmin);
1096 dy = 0.05*(rwymax-rwymin);
1097 uxmin = rwxmin - dx;
1098 uxmax = rwxmax + dx;
1099 if (
gPad->GetLogy()) {
1100 if (rwymin <= 0) rwymin = 0.001*rwymax;
1104 minimum = rwymin - dy;
1105 maximum = rwymax + dy;
1107 if (minimum < 0 && rwymin >= 0) minimum = 0;
1108 if (maximum > 0 && rwymax <= 0) maximum = 0;
1113 if (uxmin < 0 && rwxmin >= 0) {
1114 if (
gPad->GetLogx()) uxmin = 0.9*rwxmin;
1117 if (uxmax > 0 && rwxmax <= 0) {
1118 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1121 if (minimum < 0 && rwymin >= 0) {
1122 if (
gPad->GetLogy()) minimum = 0.9*rwymin;
1125 if (maximum > 0 && rwymax <= 0) {
1126 if (
gPad->GetLogy()) maximum = 1.1*rwymax;
1129 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1130 if (uxmin <= 0 && gPad->GetLogx()) {
1131 if (uxmax > 1000) uxmin = 1;
1132 else uxmin = 0.001*uxmax;
1173 gPad->PushSelectableObject(obj);
1175 if (!
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() && obj ==
gPad->GetSelected())) {
1181 else obj->
Paint(
"L");
1195 while ((f = (
TObject*) next())) {
1216 Int_t existingPads = 0;
1223 while ((obj = nextPad())) {
1226 if (existingPads < neededPads) {
1229 if (nx*nx < neededPads) nx++;
1231 if (((nx*ny)-nx) >= neededPads) ny--;
1245 if (strlen(apopt)) {
1265 Double_t rwxmin=0., rwxmax=0., rwymin=0., rwymax=0.;
1275 while ((g = (
TGraph*) next())) {
1278 if (rx1 < rwxmin) rwxmin = rx1;
1279 if (ry1 < rwymin) rwymin = ry1;
1280 if (rx2 > rwxmax) rwxmax = rx2;
1281 if (ry2 > rwymax) rwymax = ry2;
1282 if (g->
GetN() > npt) npt = g->
GetN();
1287 10, rwxmin, rwxmax);
1292 for (i=ndiv; i>=1; i--) {
1301 l = (
char*)strstr(option,
"A");
1302 if (l) frame->
Paint(
"lego0,fb,bb");
1303 l = (
char*)strstr(option,
"BB");
1304 if (!l) frame->
Paint(
"lego0,fb,a,same");
1311 while ((g = (
TGraph*) next())) {
1318 gPad->TAttLine::Modify();
1319 for (i=0; i<npt-1; i++) {
1326 gPad->PaintLine3D(xyz1, xyz2);
1331 l = (
char*)strstr(option,
"FB");
1332 if (!l) frame->
Paint(
"lego0,bb,a,same");
1345 while ((g = (
TGraph*) next())) {
1372 out<<
" "<<std::endl;
1376 out<<
" TMultiGraph *";
1378 out<<
"multigraph = new TMultiGraph();"<<std::endl;
1379 out<<
" multigraph->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
1380 out<<
" multigraph->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
1392 const char *
l = strstr(option,
"th2poly");
1394 out<<
" "<<l+7<<
"->AddBin(multigraph);"<<std::endl;
1396 out<<
" multigraph->Draw(" <<quote<<option<<quote<<
");"<<std::endl;
1401 if (xaxis) xaxis->
SaveAttributes(out,
"multigraph",
"->GetXaxis()");
1402 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 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)
Bool_t TestBit(UInt_t f) const
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.
void ToUpper()
Change string to upper case.
virtual void SetMinimum(Double_t minimum=-1111)
Int_t LoadPlugin()
Load the plugin library for this handler.
Option_t * GetOption() const
tomato 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.
TAxis * GetXaxis() const
Get x axis of the graph.
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.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Bool_t GetTimeDisplay() const
The TNamed class is the base class for all named ROOT classes.
TAxis * GetYaxis() const
Get y axis of the graph.
virtual void Print(Option_t *chopt="") const
Print graph values.
Double_t Log10(Double_t x)
TString & Append(const char *cs)
std::vector< std::vector< double > > Data
virtual ~TMultiGraph()
TMultiGraph destructor.
TList * GetListOfFunctions()
Return pointer to list of functions.
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 &)
Assignement 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.
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.
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis.
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 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)
tomato 2-D histogram with a float per channel (see TH1 documentation)}
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
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".
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
virtual TList * GetListOfPrimitives() const =0
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)
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 void InitGaus(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a gaussian.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Option_t * GetOption() const
Returns the object option stored in the list.
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".