388 fFunctions(
mg.fFunctions),
389 fHistogram(
mg.fHistogram),
390 fMaximum(
mg.fMaximum),
391 fMinimum(
mg.fMinimum)
421 while ((
g = (
TGraph*) next())) {
470 if (!graphlist)
return;
493 opt =
b ?
b->GetDrawOption() :
"alp";
494 opt = (opt ==
"") ?
"alp" : opt.
Data();
507 const Int_t kMaxDiff = 10;
508 Int_t distance = 9999;
511 if (distance <= 0)
return distance;
518 while ((
g = (
TGraph*) next())) {
520 if (
dist <= 0)
return 0;
547 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
562 linear= (
char*)strstr(fname,
"++");
568 if (!
f1) {
Printf(
"Unknown function: %s",fname);
return -1; }
753 gROOT->MakeDefCanvas();
756 Error(
"FitPanel",
"Unable to create a default canvas");
764 Error(
"FitPanel",
"Unable to crate the FitPanel");
767 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
779 while ((obj = next())) {
791 Double_t allcha, sumx, sumx2,
x, val, rms, mean;
797 allcha = sumx = sumx2 = 0;
802 while ((
g = (
TGraph*) next())) {
806 for (bin=0; bin<npp; bin++) {
808 if (x<xmin || x>
xmax)
continue;
816 if (np == 0 || allcha == 0)
return;
821 if (rms == 0) rms = 1;
879 const Int_t idim = 20;
882 Int_t i, k,
l, ifail, bin;
893 while ((
g = (
TGraph*) next())) {
896 for (bin=0; bin<npp; bin++) {
898 if (xk < xmin || xk >
xmax)
continue;
906 if (
m > idim ||
m >
n)
return;
908 for (
l = 2;
l <=
m; ++
l) {
910 b[
m +
l*20 - 21] = zero;
916 while ((
g = (
TGraph*) next())) {
921 for (k = 0; k <= npp; ++k) {
923 if (xk < xmin || xk >
xmax)
continue;
928 for (
l = 2;
l <=
m; ++
l) {
933 for (
l = 2;
l <=
m; ++
l) {
935 b[
m +
l*20 - 21] += power;
940 for (i = 3; i <=
m; ++i) {
941 for (k = i; k <=
m; ++k) {
942 b[k - 1 + (i-1)*20 - 21] =
b[k + (i-2)*20 - 21];
951 for (i=1; i<
m; ++i)
a[i] = 0;
954 for (i=0; i<
m; ++i)
a[i] = da[i];
980 xbar = ybar = x2bar = xybar = 0;
986 while ((
g = (
TGraph*) next())) {
990 for (i = 0; i < npp; ++i) {
992 if (xk < xmin || xk >
xmax)
continue;
996 if (yk <= 0) yk = 1
e-9;
1006 det = fn*x2bar - xbar*xbar;
1009 if (fn > 0) a0 = ybar/fn;
1015 a0 = (x2bar*ybar - xbar*xybar) / det;
1016 a1 = (fn*xybar - xbar*ybar) / det;
1029 while ((
g = (
TGraph*) next())) {
1030 in =
g->IsInside(
x,
y);
1062 Double_t rwxmin = 0.,rwxmax = 0.,rwymin = 0.,rwymax = 0.;
1066 while ((
g = (
TGraph*) next())) {
1067 if (
g->GetN() <= 0)
continue;
1068 if (initialrangeset) {
1070 g->ComputeRange(rx1, ry1, rx2, ry2);
1071 if (rx1 < rwxmin) rwxmin = rx1;
1072 if (ry1 < rwymin) rwymin = ry1;
1073 if (rx2 > rwxmax) rwxmax = rx2;
1074 if (ry2 > rwymax) rwymax = ry2;
1076 g->ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1077 initialrangeset =
kTRUE;
1079 if (
g->GetN() > npt) npt =
g->GetN();
1081 if (rwxmin == rwxmax) rwxmax += 1.;
1082 if (rwymin == rwymax) rwymax += 1.;
1083 double dx = 0.05*(rwxmax-rwxmin);
1084 double dy = 0.05*(rwymax-rwymin);
1085 rwxmin = rwxmin - dx;
1086 rwxmax = rwxmax + dx;
1087 rwymin = rwymin - dy;
1088 rwymax = rwymax + dy;
1131 return h->GetXaxis();
1143 return h->GetYaxis();
1158 strlcpy(option,choptin,128);
1159 Int_t nch = strlen(choptin);
1160 for (
Int_t i=0;i<nch;i++) option[i] = toupper(option[i]);
1163 char *l1 = strstr(option,
"PFC");
1164 char *l2 = strstr(option,
"PLC");
1165 char *l3 = strstr(option,
"PMC");
1166 if (l1 || l2 || l3) {
1168 if (l1) memcpy(l1,
" ",3);
1169 if (l2) memcpy(l2,
" ",3);
1170 if (l3) memcpy(l3,
" ",3);
1175 gPad->IncrementPaletteColor(ngraphs, opt1);
1176 for (
Int_t i=0;i<ngraphs;i++) {
1177 ic =
gPad->NextPaletteColor();
1190 l = (
char*)strstr(chopt.
Data(),
"3D");
1192 l = (
char*)strstr(chopt.
Data(),
"L");
1197 l = (
char*)strstr(chopt.
Data(),
"PADS");
1204 char *lrx = (
char *)strstr(chopt.
Data(),
"RX");
1205 char *lry = (
char *)strstr(chopt.
Data(),
"RY");
1213 l = (
char*)strstr(chopt.
Data(),
"A");
1218 Double_t maximum, minimum, rwxmin, rwxmax, rwymin, rwymax, uxmin, uxmax, dx, dy;
1219 rwxmin =
gPad->GetUxmin();
1220 rwxmax =
gPad->GetUxmax();
1221 rwymin =
gPad->GetUymin();
1222 rwymax =
gPad->GetUymax();
1228 char *timeformat = 0;
1236 for (
Int_t i=0;i<ngraphs;i++) {
1247 xtitle =
new char[nch+1];
1252 ytitle =
new char[nch+1];
1257 timeformat =
new char[nch+1];
1267 uxmin =
gPad->PadtoX(rwxmin);
1268 uxmax =
gPad->PadtoX(rwxmax);
1271 while ((
g = (
TGraph*) next())) {
1272 if (
g->GetN() <= 0)
continue;
1273 if (initialrangeset) {
1275 g->ComputeRange(rx1, ry1, rx2, ry2);
1276 if (rx1 < rwxmin) rwxmin = rx1;
1277 if (ry1 < rwymin) rwymin = ry1;
1278 if (rx2 > rwxmax) rwxmax = rx2;
1279 if (ry2 > rwymax) rwymax = ry2;
1281 g->ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1282 initialrangeset =
kTRUE;
1284 if (
g->GetN() > npt) npt =
g->GetN();
1286 if (rwxmin == rwxmax) rwxmax += 1.;
1287 if (rwymin == rwymax) rwymax += 1.;
1288 dx = 0.05*(rwxmax-rwxmin);
1289 dy = 0.05*(rwymax-rwymin);
1290 uxmin = rwxmin - dx;
1291 uxmax = rwxmax + dx;
1292 if (
gPad->GetLogy()) {
1293 if (rwymin <= 0) rwymin = 0.001*rwymax;
1297 minimum = rwymin - dy;
1298 maximum = rwymax + dy;
1300 if (minimum < 0 && rwymin >= 0) minimum = 0;
1301 if (maximum > 0 && rwymax <= 0) maximum = 0;
1306 if (uxmin < 0 && rwxmin >= 0) {
1307 if (
gPad->GetLogx()) uxmin = 0.9*rwxmin;
1310 if (uxmax > 0 && rwxmax <= 0) {
1311 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1314 if (minimum < 0 && rwymin >= 0) {
1315 if (
gPad->GetLogy()) minimum = 0.9*rwymin;
1318 if (maximum > 0 && rwymax <= 0) {
1319 if (
gPad->GetLogy()) maximum = 1.1*rwymax;
1322 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1323 if (uxmin <= 0 && gPad->GetLogx()) {
1324 if (uxmax > 1000) uxmin = 1;
1325 else uxmin = 0.001*uxmax;
1366 gPad->PushSelectableObject(obj);
1368 if (!
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() && obj ==
gPad->GetSelected())) {
1374 else obj->
Paint(
"L");
1409 Int_t existingPads = 0;
1416 while ((obj = nextPad())) {
1419 if (existingPads < neededPads) {
1422 if (nx*nx < neededPads) nx++;
1424 if (((nx*ny)-nx) >= neededPads) ny--;
1438 if (strlen(apopt)) {
1439 g->Draw((apopt.
Append(
"A")).Data());
1441 if (strlen(opt))
g->Draw(opt.
Append(
"A"));
1458 Double_t rwxmin=0., rwxmax=0., rwymin=0., rwymax=0.;
1464 g->ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1472 while ((
g = (
TGraph*) next())) {
1474 g->ComputeRange(rx1, ry1, rx2, ry2);
1475 if (rx1 < rwxmin) rwxmin = rx1;
1476 if (ry1 < rwymin) rwymin = ry1;
1477 if (rx2 > rwxmax) rwxmax = rx2;
1478 if (ry2 > rwymax) rwymax = ry2;
1479 if (
g->GetN() > npt) npt =
g->GetN();
1484 TH2F* frame =
new TH2F(
"frame",
"", ndiv, 0., (
Double_t)(ndiv), npt, rwxmin, rwxmax);
1495 for (i=ndiv; i>=1; i--) {
1506 l = (
char*)strstr(option,
"A");
1507 if (
l) frame->
Paint(
"lego9,fb,bb");
1508 l = (
char*)strstr(option,
"BB");
1509 if (!
l) frame->
Paint(
"lego9,fb,a,same");
1522 while ((
g = (
TGraph*) next())) {
1526 gPad->SetLineColor(
g->GetLineColor());
1527 gPad->SetLineWidth(
g->GetLineWidth());
1528 gPad->SetLineStyle(
g->GetLineStyle());
1529 gPad->TAttLine::Modify();
1530 for (i=0; i<npt-1; i++) {
1535 if (
gPad->Clip(&xc[0], &yc[0], xl, yl, xu, yu)<2) {
1542 gPad->PaintLine3D(xyz1, xyz2);
1548 l = (
char*)strstr(option,
"FB");
1549 if (!
l) frame->
Paint(
"lego9,bb,a,same");
1572 while ((
g = (
TGraph *)next())) {
1598 while ((
g = (
TGraph*) next())) {
1625 out<<
" "<<std::endl;
1629 out<<
" TMultiGraph *";
1631 out<<
"multigraph = new TMultiGraph();"<<std::endl;
1632 out<<
" multigraph->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
1633 out<<
" multigraph->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
1645 const char *
l = strstr(option,
"th2poly");
1647 out<<
" "<<
l+7<<
"->AddBin(multigraph);"<<std::endl;
1649 out<<
" multigraph->Draw(" <<quote<<option<<quote<<
");"<<std::endl;
1655 out<<
" multigraph->GetXaxis()->SetLimits("<<xaxis->
GetXmin()<<
", "<<xaxis->
GetXmax()<<
");"<<std::endl;
1658 if (yaxis) yaxis->
SaveAttributes(out,
"multigraph",
"->GetYaxis()");
1659 if (
fMinimum != -1111) out<<
" multigraph->SetMinimum("<<
fMinimum<<
");"<<std::endl;
1660 if (
fMaximum != -1111) out<<
" multigraph->SetMaximum("<<
fMaximum<<
");"<<std::endl;
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,...)
void Printf(const char *fmt,...)
class describing the range in the coordinates it supports multiple range in a coordinate.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Class to manage histogram axis.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
virtual Bool_t GetTimeDisplay() const
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual void SetTimeDisplay(Int_t value)
Int_t GetLast() const
Return last bin on the axis i.e.
virtual void SetLimits(Double_t xmin, Double_t xmax)
virtual const char * GetTimeFormat() const
const char * GetTitle() const
Returns title of object.
virtual void SetTimeFormat(const char *format="")
Change the format used for time plotting.
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
Using a TBrowser one can browse all ROOT objects.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual Int_t GetNpar() const
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
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...
A TGraph is an object made of two arrays X and Y with npoints each.
@ kResetHisto
fHistogram must be reset in GetHistogram
virtual void Paint(Option_t *chopt="")
Draw this graph with its current attributes.
virtual void PaintStats(TF1 *fit)
Draw the stats.
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
virtual void SetHistogram(TH1F *h)
1-D histogram with a float per channel (see TH1 documentation)}
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 SetTitle(const char *title)
See GetStatOverflows for more information.
@ kNoStats
don't draw stats box
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
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 SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms.
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 a line.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a float per channel (see TH1 documentation)}
Option_t * GetOption() const
Returns the object option stored in the list.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObjLink * FirstLink() const
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
A TMultiGraph is a collection of TGraph (or derived) objects.
TMultiGraph()
TMultiGraph default constructor.
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.
TList * GetListOfGraphs() const
virtual void Add(TGraph *graph, Option_t *chopt="")
Add a new graph to the list of graphs.
virtual void SetMinimum(Double_t minimum=-1111)
Set multigraph minimum.
TH1F * GetHistogram()
Returns a pointer to the histogram used to draw the axis.
TF1 * GetFunction(const char *name) const
Return pointer to function with name.
virtual void LeastSquareFit(Int_t m, Double_t *a, Double_t xmin, Double_t xmax)
Least squares lpolynomial fitting without weights.
virtual void InitPolynom(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a polynom.
void PaintPolyLine3D(Option_t *chopt="")
Paint all the graphs of this multigraph as 3D lines.
virtual void InitExpo(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for an exponential.
virtual void FitPanel()
Display a panel with all histogram fit options.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to each graph.
virtual void Paint(Option_t *chopt="")
Paint all the graphs of this multigraph.
virtual void Draw(Option_t *chopt="")
Draw this multigraph with its current attributes.
TIter begin() const
Get iterator over internal graphs list.
TMultiGraph & operator=(const TMultiGraph &)
Assignment operator.
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.
void PaintPads(Option_t *chopt="")
Divides the active pad and draws all Graphs in the Multigraph separately.
virtual Option_t * GetGraphDrawOption(const TGraph *gr) const
Return the draw option for the TGraph gr in this TMultiGraph.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
TAxis * GetYaxis()
Get y axis of the graph.
virtual void InitGaus(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a gaussian.
virtual ~TMultiGraph()
TMultiGraph destructor.
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.
TList * GetListOfFunctions()
Return pointer to list of functions.
virtual void Print(Option_t *chopt="") const
Print the list of graphs.
virtual void SetMaximum(Double_t maximum=-1111)
Set multigraph maximum.
virtual void Browse(TBrowser *b)
Browse multigraph.
void PaintReverse(Option_t *chopt="")
Paint all the graphs of this multigraph reverting values along X and/or Y axis.
TAxis * GetXaxis()
Get x axis of the graph.
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
virtual const char * GetName() const
Returns name of object.
TObject * GetObject() const
Option_t * GetOption() const
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
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.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
@ kInvalidObject
if object ctor succeeded but object should not be used
@ kMustCleanup
if object destructor must call RecursiveRemove()
Long_t ExecPlugin(int nargs, const T &... params)
Int_t LoadPlugin()
Load the plugin library for this handler.
void ToLower()
Change string to lower-case.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Append(const char *cs)
Bool_t IsWhitespace() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Abstract Base Class for Fitting.
static TVirtualFitter * GetFitter()
static: return the current Fitter
virtual TObject * GetUserFunc() const
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
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
virtual void Clear(Option_t *option="")=0
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)
void FitOptionsMake(EFitObjectType type, const char *option, Foption_t &fitOption)
Decode list of options into fitOption.
double dist(Rotation3D const &r1, Rotation3D const &r2)
static constexpr double mg
Double_t Sqrt(Double_t x)
Double_t Log10(Double_t x)