336 while ((g = (
TGraph*) next())) {
385 if (!graphlist)
return;
409 opt = (opt ==
"") ?
"alp" : opt.
Data();
422 const Int_t kMaxDiff = 10;
423 Int_t distance = 9999;
426 if (distance <= 0)
return distance;
433 while ((g = (
TGraph*) next())) {
435 if (dist <= 0)
return 0;
436 if (dist < kMaxDiff) {
gPad->SetSelected(g);
return dist;}
462 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
477 linear= (
char*)strstr(fname,
"++");
480 f1=
new TF1(fname, fname, xmin, xmax);
482 f1 = (
TF1*)
gROOT->GetFunction(fname);
483 if (!f1) {
Printf(
"Unknown function: %s",fname);
return -1; }
486 return Fit(f1,option,
"",xmin,xmax);
669 gROOT->MakeDefCanvas();
672 Error(
"FitPanel",
"Unable to create a default canvas");
680 Error(
"FitPanel",
"Unable to crate the FitPanel");
683 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
695 while ((obj = next())) {
713 allcha = sumx = sumx2 = 0;
718 while ((g = (
TGraph*) next())) {
722 for (bin=0; bin<npp; bin++) {
724 if (x<xmin || x>xmax)
continue;
732 if (np == 0 || allcha == 0)
return;
737 if (rms == 0) rms = 1;
795 const Int_t idim = 20;
798 Int_t i, k,
l, ifail, bin;
809 while ((g = (
TGraph*) next())) {
812 for (bin=0; bin<npp; bin++) {
814 if (xk < xmin || xk > xmax)
continue;
822 if (m > idim || m > n)
return;
824 for (l = 2; l <=
m; ++
l) {
826 b[m + l*20 - 21] = zero;
832 while ((g = (
TGraph*) next())) {
837 for (k = 0; k <= npp; ++k) {
839 if (xk < xmin || xk > xmax)
continue;
844 for (l = 2; l <=
m; ++
l) {
849 for (l = 2; l <=
m; ++
l) {
851 b[m + l*20 - 21] += power;
856 for (i = 3; i <=
m; ++i) {
857 for (k = i; k <=
m; ++k) {
858 b[k - 1 + (i-1)*20 - 21] = b[k + (i-2)*20 - 21];
867 for (i=1; i<
m; ++i) a[i] = 0;
870 for (i=0; i<
m; ++i) a[i] = da[i];
896 xbar = ybar = x2bar = xybar = 0;
902 while ((g = (
TGraph*) next())) {
906 for (i = 0; i < npp; ++i) {
908 if (xk < xmin || xk > xmax)
continue;
912 if (yk <= 0) yk = 1
e-9;
922 det = fn*x2bar - xbar*xbar;
925 if (fn > 0) a0 = ybar/fn;
931 a0 = (x2bar*ybar - xbar*xybar) / det;
932 a1 = (fn*xybar - xbar*ybar) / det;
945 while ((g = (
TGraph*) next())) {
1032 strlcpy(option,choptin,128);
1033 Int_t nch = strlen(choptin);
1034 for (
Int_t i=0;i<nch;i++) option[i] = toupper(option[i]);
1037 char *l1 = strstr(option,
"PFC");
1038 char *l2 = strstr(option,
"PLC");
1039 char *l3 = strstr(option,
"PMC");
1040 if (l1 || l2 || l3) {
1042 if (l1) strncpy(l1,
" ",3);
1043 if (l2) strncpy(l2,
" ",3);
1044 if (l3) strncpy(l3,
" ",3);
1049 gPad->IncrementPaletteColor(ngraphs, opt1);
1050 for (
Int_t i=0;i<ngraphs;i++) {
1051 ic =
gPad->NextPaletteColor();
1064 l = (
char*)strstr(chopt.
Data(),
"3D");
1066 l = (
char*)strstr(chopt.
Data(),
"L");
1071 l = (
char*)strstr(chopt.
Data(),
"PADS");
1080 l = (
char*)strstr(chopt.
Data(),
"A");
1085 Double_t maximum, minimum, rwxmin, rwxmax, rwymin, rwymax, uxmin, uxmax, dx, dy;
1086 rwxmin =
gPad->GetUxmin();
1087 rwxmax =
gPad->GetUxmax();
1088 rwymin =
gPad->GetUymin();
1089 rwymax =
gPad->GetUymax();
1095 char *timeformat = 0;
1103 for (
Int_t i=0;i<ngraphs;i++) {
1114 xtitle =
new char[nch+1];
1119 ytitle =
new char[nch+1];
1124 timeformat =
new char[nch+1];
1134 uxmin =
gPad->PadtoX(rwxmin);
1135 uxmax =
gPad->PadtoX(rwxmax);
1138 while ((g = (
TGraph*) next())) {
1139 if (g->
GetN() <= 0)
continue;
1140 if (initialrangeset) {
1143 if (rx1 < rwxmin) rwxmin = rx1;
1144 if (ry1 < rwymin) rwymin = ry1;
1145 if (rx2 > rwxmax) rwxmax = rx2;
1146 if (ry2 > rwymax) rwymax = ry2;
1149 initialrangeset =
kTRUE;
1151 if (g->
GetN() > npt) npt = g->
GetN();
1153 if (rwxmin == rwxmax) rwxmax += 1.;
1154 if (rwymin == rwymax) rwymax += 1.;
1155 dx = 0.05*(rwxmax-rwxmin);
1156 dy = 0.05*(rwymax-rwymin);
1157 uxmin = rwxmin - dx;
1158 uxmax = rwxmax + dx;
1159 if (
gPad->GetLogy()) {
1160 if (rwymin <= 0) rwymin = 0.001*rwymax;
1164 minimum = rwymin - dy;
1165 maximum = rwymax + dy;
1167 if (minimum < 0 && rwymin >= 0) minimum = 0;
1168 if (maximum > 0 && rwymax <= 0) maximum = 0;
1173 if (uxmin < 0 && rwxmin >= 0) {
1174 if (
gPad->GetLogx()) uxmin = 0.9*rwxmin;
1177 if (uxmax > 0 && rwxmax <= 0) {
1178 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1181 if (minimum < 0 && rwymin >= 0) {
1182 if (
gPad->GetLogy()) minimum = 0.9*rwymin;
1185 if (maximum > 0 && rwymax <= 0) {
1186 if (
gPad->GetLogy()) maximum = 1.1*rwymax;
1189 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1190 if (uxmin <= 0 && gPad->GetLogx()) {
1191 if (uxmax > 1000) uxmin = 1;
1192 else uxmin = 0.001*uxmax;
1233 gPad->PushSelectableObject(obj);
1235 if (!
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() && obj ==
gPad->GetSelected())) {
1241 else obj->
Paint(
"L");
1255 while ((f = (
TObject*) next())) {
1276 Int_t existingPads = 0;
1283 while ((obj = nextPad())) {
1286 if (existingPads < neededPads) {
1289 if (nx*nx < neededPads) nx++;
1291 if (((nx*ny)-nx) >= neededPads) ny--;
1305 if (strlen(apopt)) {
1325 Double_t rwxmin=0., rwxmax=0., rwymin=0., rwymax=0.;
1335 while ((g = (
TGraph*) next())) {
1338 if (rx1 < rwxmin) rwxmin = rx1;
1339 if (ry1 < rwymin) rwymin = ry1;
1340 if (rx2 > rwxmax) rwxmax = rx2;
1341 if (ry2 > rwymax) rwymax = ry2;
1342 if (g->
GetN() > npt) npt = g->
GetN();
1346 TH2F* frame =
new TH2F(
"frame",
"", ndiv, 0., (
Double_t)(ndiv), 1, rwxmin, rwxmax);
1351 for (i=ndiv; i>=1; i--) {
1361 l = (
char*)strstr(option,
"A");
1362 if (l) frame->
Paint(
"lego0,fb,bb");
1363 l = (
char*)strstr(option,
"BB");
1364 if (!l) frame->
Paint(
"lego0,fb,a,same");
1371 while ((g = (
TGraph*) next())) {
1378 gPad->TAttLine::Modify();
1379 for (i=0; i<npt-1; i++) {
1386 gPad->PaintLine3D(xyz1, xyz2);
1391 l = (
char*)strstr(option,
"FB");
1392 if (!l) frame->
Paint(
"lego0,bb,a,same");
1405 while ((g = (
TGraph*) next())) {
1432 out<<
" "<<std::endl;
1436 out<<
" TMultiGraph *";
1438 out<<
"multigraph = new TMultiGraph();"<<std::endl;
1439 out<<
" multigraph->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
1440 out<<
" multigraph->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
1452 const char *l = strstr(option,
"th2poly");
1454 out<<
" "<<l+7<<
"->AddBin(multigraph);"<<std::endl;
1456 out<<
" multigraph->Draw(" <<quote<<option<<quote<<
");"<<std::endl;
1461 if (xaxis) xaxis->
SaveAttributes(out,
"multigraph",
"->GetXaxis()");
1462 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.
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)
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
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 &)
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.
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 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)
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 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)
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 void SetBinContent(Int_t bin, Double_t content)
Set bin content.
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.
TIter begin() const
Get iterator over internal graphs list.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
virtual const char * GetTitle() const
Returns title of object.
fHistogram must be reset in GetHistogram
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".