35 extern void H1LeastSquareSeqnd(Int_t n, Double_t *a, Int_t idim, Int_t &ifail, Int_t k, Double_t *b);
37 ClassImp(TMultiGraph);
359 TMultiGraph::TMultiGraph(): TNamed()
372 TMultiGraph::TMultiGraph(
const char *name,
const char *title)
386 TMultiGraph::TMultiGraph(
const TMultiGraph& mg) :
389 fFunctions(mg.fFunctions),
390 fHistogram(mg.fHistogram),
391 fMaximum(mg.fMaximum),
392 fMinimum(mg.fMinimum)
400 TMultiGraph& TMultiGraph::operator=(
const TMultiGraph& mg)
403 TNamed::operator=(mg);
405 fFunctions=mg.fFunctions;
406 fHistogram=mg.fHistogram;
407 fMaximum=mg.fMaximum;
408 fMinimum=mg.fMinimum;
417 TMultiGraph::~TMultiGraph()
419 if (!fGraphs)
return;
422 while ((g = (TGraph*) next())) {
423 g->ResetBit(kMustCleanup);
431 fFunctions->SetBit(kInvalidObject);
437 while ((obj = fFunctions->First())) {
438 while (fFunctions->Remove(obj)) { }
452 void TMultiGraph::Add(TGraph *graph, Option_t *chopt)
454 if (!fGraphs) fGraphs =
new TList();
455 graph->SetBit(kMustCleanup);
456 fGraphs->Add(graph,chopt);
468 void TMultiGraph::Add(TMultiGraph *multigraph, Option_t *chopt)
470 TList *graphlist = multigraph->GetListOfGraphs();
471 if (!graphlist)
return;
473 if (!fGraphs) fGraphs =
new TList();
475 TObjOptLink *lnk = (TObjOptLink*)graphlist->FirstLink();
479 obj = lnk->GetObject();
480 if (!strlen(chopt)) fGraphs->Add(obj,lnk->GetOption());
481 else fGraphs->Add(obj,chopt);
482 lnk = (TObjOptLink*)lnk->Next();
490 void TMultiGraph::Browse(TBrowser *b)
492 TString opt = gEnv->GetValue(
"TGraph.BrowseOption",
"");
494 opt = b ? b->GetDrawOption() :
"alp";
495 opt = (opt ==
"") ?
"alp" : opt.Data();
505 Int_t TMultiGraph::DistancetoPrimitive(Int_t px, Int_t py)
508 const Int_t kMaxDiff = 10;
509 Int_t distance = 9999;
511 distance = fHistogram->DistancetoPrimitive(px,py);
512 if (distance <= 0)
return distance;
516 if (!fGraphs)
return distance;
519 while ((g = (TGraph*) next())) {
520 Int_t dist = g->DistancetoPrimitive(px,py);
521 if (dist <= 0)
return 0;
522 if (dist < kMaxDiff) {gPad->SetSelected(g);
return dist;}
542 void TMultiGraph::Draw(Option_t *option)
544 TString opt = option;
548 if (!gPad->IsEditable()) gROOT->MakeDefCanvas();
549 if (opt.Contains(
"a")) gPad->Clear();
560 TFitResultPtr TMultiGraph::Fit(
const char *fname, Option_t *option, Option_t *, Axis_t xmin, Axis_t xmax)
563 linear= (
char*)strstr(fname,
"++");
565 TF1 f1(fname, fname, xmin, xmax);
566 return Fit(&f1,option,
"",xmin,xmax);
568 TF1 * f1 = (TF1*)gROOT->GetFunction(fname);
569 if (!f1) { Printf(
"Unknown function: %s",fname);
return -1; }
571 return Fit(f1,option,
"",xmin,xmax);
734 TFitResultPtr TMultiGraph::Fit(TF1 *f1, Option_t *option, Option_t *goption, Axis_t rxmin, Axis_t rxmax)
738 ROOT::Fit::FitOptionsMake(ROOT::Fit::kGraph,option,fitOption);
741 ROOT::Fit::DataRange range(rxmin,rxmax);
742 ROOT::Math::MinimizerOptions minOption;
743 return ROOT::Fit::FitObject(
this, f1 , fitOption , minOption, goption, range);
751 void TMultiGraph::FitPanel()
754 gROOT->MakeDefCanvas();
757 Error(
"FitPanel",
"Unable to create a default canvas");
762 TPluginHandler *handler = gROOT->GetPluginManager()->FindHandler(
"TFitEditor");
763 if (handler && handler->LoadPlugin() != -1) {
764 if (handler->ExecPlugin(2, gPad,
this) == 0)
765 Error(
"FitPanel",
"Unable to crate the FitPanel");
768 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
775 Option_t *TMultiGraph::GetGraphDrawOption(
const TGraph *gr)
const
777 if (!fGraphs || !gr)
return "";
778 TListIter next(fGraphs);
780 while ((obj = next())) {
781 if (obj == (TObject*)gr)
return next.GetOption();
790 void TMultiGraph::InitGaus(Double_t xmin, Double_t xmax)
792 Double_t allcha, sumx, sumx2, x, val, rms, mean;
794 const Double_t sqrtpi = 2.506628;
798 allcha = sumx = sumx2 = 0;
803 while ((g = (TGraph*) next())) {
807 for (bin=0; bin<npp; bin++) {
809 if (x<xmin || x>xmax)
continue;
817 if (np == 0 || allcha == 0)
return;
819 rms = TMath::Sqrt(sumx2/allcha - mean*mean);
821 Double_t binwidx = TMath::Abs((xmax-xmin)/np);
822 if (rms == 0) rms = 1;
823 TVirtualFitter *grFitter = TVirtualFitter::GetFitter();
824 TF1 *f1 = (TF1*)grFitter->GetUserFunc();
825 f1->SetParameter(0,binwidx*allcha/(sqrtpi*rms));
826 f1->SetParameter(1,mean);
827 f1->SetParameter(2,rms);
828 f1->SetParLimits(2,0,10*rms);
835 void TMultiGraph::InitExpo(Double_t xmin, Double_t xmax)
837 Double_t constant, slope;
840 LeastSquareLinearFit(-1, constant, slope, ifail, xmin, xmax);
842 TVirtualFitter *grFitter = TVirtualFitter::GetFitter();
843 TF1 *f1 = (TF1*)grFitter->GetUserFunc();
844 f1->SetParameter(0,constant);
845 f1->SetParameter(1,slope);
852 void TMultiGraph::InitPolynom(Double_t xmin, Double_t xmax)
856 TVirtualFitter *grFitter = TVirtualFitter::GetFitter();
857 TF1 *f1 = (TF1*)grFitter->GetUserFunc();
858 Int_t npar = f1->GetNpar();
860 LeastSquareFit(npar, fitpar, xmin, xmax);
862 for (Int_t i=0;i<npar;i++) f1->SetParameter(i, fitpar[i]);
876 void TMultiGraph::LeastSquareFit(Int_t m, Double_t *a, Double_t xmin, Double_t xmax)
878 const Double_t zero = 0.;
879 const Double_t one = 1.;
880 const Int_t idim = 20;
883 Int_t i, k, l, ifail, bin;
885 Double_t da[20], xk, yk;
894 while ((g = (TGraph*) next())) {
897 for (bin=0; bin<npp; bin++) {
899 if (xk < xmin || xk > xmax)
continue;
904 LeastSquareLinearFit(n, a[0], a[1], ifail, xmin, xmax);
907 if (m > idim || m > n)
return;
909 for (l = 2; l <= m; ++l) {
911 b[m + l*20 - 21] = zero;
917 while ((g = (TGraph*) next())) {
922 for (k = 0; k <= npp; ++k) {
924 if (xk < xmin || xk > xmax)
continue;
929 for (l = 2; l <= m; ++l) {
934 for (l = 2; l <= m; ++l) {
936 b[m + l*20 - 21] += power;
941 for (i = 3; i <= m; ++i) {
942 for (k = i; k <= m; ++k) {
943 b[k - 1 + (i-1)*20 - 21] = b[k + (i-2)*20 - 21];
946 H1LeastSquareSeqnd(m, b, idim, ifail, 1, da);
950 py=((TGraph *)fGraphs->First())->GetY();
952 for (i=1; i<m; ++i) a[i] = 0;
955 for (i=0; i<m; ++i) a[i] = da[i];
971 void TMultiGraph::LeastSquareLinearFit(Int_t ndata, Double_t &a0, Double_t &a1,
972 Int_t &ifail, Double_t xmin, Double_t xmax)
974 Double_t xbar, ybar, x2bar;
981 xbar = ybar = x2bar = xybar = 0;
987 while ((g = (TGraph*) next())) {
991 for (i = 0; i < npp; ++i) {
993 if (xk < xmin || xk > xmax)
continue;
997 if (yk <= 0) yk = 1e-9;
1007 det = fn*x2bar - xbar*xbar;
1010 if (fn > 0) a0 = ybar/fn;
1016 a0 = (x2bar*ybar - xbar*xybar) / det;
1017 a1 = (fn*xybar - xbar*ybar) / det;
1024 Int_t TMultiGraph::IsInside(Double_t x, Double_t y)
const
1027 if (!fGraphs)
return in;
1029 TIter next(fGraphs);
1030 while ((g = (TGraph*) next())) {
1031 in = g->IsInside(x, y);
1050 TH1F *TMultiGraph::GetHistogram()
1052 if (fHistogram)
return fHistogram;
1057 if (fHistogram)
return fHistogram;
1058 TH1F *h1 = (TH1F*)gPad->FindObject(
"hframe");
1062 Bool_t initialrangeset = kFALSE;
1063 Double_t rwxmin = 0.,rwxmax = 0.,rwymin = 0.,rwymax = 0.;
1066 TIter next(fGraphs);
1067 while ((g = (TGraph*) next())) {
1068 if (g->GetN() <= 0)
continue;
1069 if (initialrangeset) {
1070 Double_t rx1,ry1,rx2,ry2;
1071 g->ComputeRange(rx1, ry1, rx2, ry2);
1072 if (rx1 < rwxmin) rwxmin = rx1;
1073 if (ry1 < rwymin) rwymin = ry1;
1074 if (rx2 > rwxmax) rwxmax = rx2;
1075 if (ry2 > rwymax) rwymax = ry2;
1077 g->ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1078 initialrangeset = kTRUE;
1080 if (g->GetN() > npt) npt = g->GetN();
1082 fHistogram =
new TH1F(GetName(),GetTitle(),npt,rwxmin,rwxmax);
1083 if (!fHistogram)
return 0;
1084 fHistogram->SetMinimum(rwymin);
1085 fHistogram->SetBit(TH1::kNoStats);
1086 fHistogram->SetMaximum(rwymax);
1087 fHistogram->GetYaxis()->SetLimits(rwymin,rwymax);
1088 fHistogram->SetDirectory(0);
1099 TF1 *TMultiGraph::GetFunction(
const char *name)
const
1101 if (!fFunctions)
return 0;
1102 return (TF1*)fFunctions->FindObject(name);
1109 TList *TMultiGraph::GetListOfFunctions()
1111 if (!fFunctions) fFunctions =
new TList();
1120 TAxis *TMultiGraph::GetXaxis()
1122 TH1 *h = GetHistogram();
1124 return h->GetXaxis();
1132 TAxis *TMultiGraph::GetYaxis()
1134 TH1 *h = GetHistogram();
1136 return h->GetYaxis();
1143 void TMultiGraph::Paint(Option_t *choptin)
1145 const TPickerStackGuard pushGuard(
this);
1147 if (!fGraphs)
return;
1148 if (fGraphs->GetSize() == 0)
return;
1151 strlcpy(option,choptin,128);
1152 Int_t nch = strlen(choptin);
1153 for (Int_t i=0;i<nch;i++) option[i] = toupper(option[i]);
1156 char *l1 = strstr(option,
"PFC");
1157 char *l2 = strstr(option,
"PLC");
1158 char *l3 = strstr(option,
"PMC");
1159 if (l1 || l2 || l3) {
1160 TString opt1 = option; opt1.ToLower();
1161 if (l1) memcpy(l1,
" ",3);
1162 if (l2) memcpy(l2,
" ",3);
1163 if (l3) memcpy(l3,
" ",3);
1164 TObjOptLink *lnk = (TObjOptLink*)fGraphs->FirstLink();
1166 Int_t ngraphs = fGraphs->GetSize();
1168 gPad->IncrementPaletteColor(ngraphs, opt1);
1169 for (Int_t i=0;i<ngraphs;i++) {
1170 ic = gPad->NextPaletteColor();
1171 gAti = (TGraph*)(fGraphs->At(i));
1172 if (l1) gAti->SetFillColor(ic);
1173 if (l2) gAti->SetLineColor(ic);
1174 if (l3) gAti->SetMarkerColor(ic);
1175 lnk = (TObjOptLink*)lnk->Next();
1181 TString chopt = option;
1183 l = (
char*)strstr(chopt.Data(),
"3D");
1185 l = (
char*)strstr(chopt.Data(),
"L");
1186 if (l) PaintPolyLine3D(chopt.Data());
1190 l = (
char*)strstr(chopt.Data(),
"PADS");
1192 chopt.ReplaceAll(
"PADS",
"");
1193 PaintPads(chopt.Data());
1197 char *lrx = (
char *)strstr(chopt.Data(),
"RX");
1198 char *lry = (
char *)strstr(chopt.Data(),
"RY");
1200 PaintReverse(chopt.Data());
1206 l = (
char*)strstr(chopt.Data(),
"A");
1209 TIter next(fGraphs);
1211 Double_t maximum, minimum, rwxmin, rwxmax, rwymin, rwymax, uxmin, uxmax, dx, dy;
1212 rwxmin = gPad->GetUxmin();
1213 rwxmax = gPad->GetUxmax();
1214 rwymin = gPad->GetUymin();
1215 rwymax = gPad->GetUymax();
1220 Bool_t timedisplay = kFALSE;
1221 char *timeformat = 0;
1225 TObjOptLink *lnk = (TObjOptLink*)fGraphs->FirstLink();
1227 Int_t ngraphs = fGraphs->GetSize();
1228 Bool_t reset_hist = kFALSE;
1229 for (Int_t i=0;i<ngraphs;i++) {
1230 gAti = (TGraph*)(fGraphs->At(i));
1231 if(gAti->TestBit(TGraph::kResetHisto)) {reset_hist = kTRUE;
break;}
1232 lnk = (TObjOptLink*)lnk->Next();
1234 if (fHistogram->GetMinimum() >= fHistogram->GetMaximum() || reset_hist) {
1235 nch = strlen(fHistogram->GetXaxis()->GetTitle());
1236 firstx = fHistogram->GetXaxis()->GetFirst();
1237 lastx = fHistogram->GetXaxis()->GetLast();
1238 timedisplay = fHistogram->GetXaxis()->GetTimeDisplay();
1240 xtitle =
new char[nch+1];
1241 strlcpy(xtitle,fHistogram->GetXaxis()->GetTitle(),nch+1);
1243 nch = strlen(fHistogram->GetYaxis()->GetTitle());
1245 ytitle =
new char[nch+1];
1246 strlcpy(ytitle,fHistogram->GetYaxis()->GetTitle(),nch+1);
1248 nch = strlen(fHistogram->GetXaxis()->GetTimeFormat());
1250 timeformat =
new char[nch+1];
1251 strlcpy(timeformat,fHistogram->GetXaxis()->GetTimeFormat(),nch+1);
1258 minimum = fHistogram->GetYaxis()->GetXmin();
1259 maximum = fHistogram->GetYaxis()->GetXmax();
1260 uxmin = gPad->PadtoX(rwxmin);
1261 uxmax = gPad->PadtoX(rwxmax);
1263 Bool_t initialrangeset = kFALSE;
1264 while ((g = (TGraph*) next())) {
1265 if (g->GetN() <= 0)
continue;
1266 if (initialrangeset) {
1267 Double_t rx1,ry1,rx2,ry2;
1268 g->ComputeRange(rx1, ry1, rx2, ry2);
1269 if (rx1 < rwxmin) rwxmin = rx1;
1270 if (ry1 < rwymin) rwymin = ry1;
1271 if (rx2 > rwxmax) rwxmax = rx2;
1272 if (ry2 > rwymax) rwymax = ry2;
1274 g->ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1275 initialrangeset = kTRUE;
1277 if (g->GetN() > npt) npt = g->GetN();
1279 if (rwxmin == rwxmax) rwxmax += 1.;
1280 if (rwymin == rwymax) rwymax += 1.;
1281 dx = 0.05*(rwxmax-rwxmin);
1282 dy = 0.05*(rwymax-rwymin);
1283 uxmin = rwxmin - dx;
1284 uxmax = rwxmax + dx;
1285 if (gPad->GetLogy()) {
1286 if (rwymin <= 0) rwymin = 0.001*rwymax;
1287 minimum = rwymin/(1+0.5*TMath::Log10(rwymax/rwymin));
1288 maximum = rwymax*(1+0.2*TMath::Log10(rwymax/rwymin));
1290 minimum = rwymin - dy;
1291 maximum = rwymax + dy;
1293 if (minimum < 0 && rwymin >= 0) minimum = 0;
1294 if (maximum > 0 && rwymax <= 0) maximum = 0;
1297 if (fMinimum != -1111) rwymin = minimum = fMinimum;
1298 if (fMaximum != -1111) rwymax = maximum = fMaximum;
1299 if (uxmin < 0 && rwxmin >= 0) {
1300 if (gPad->GetLogx()) uxmin = 0.9*rwxmin;
1303 if (uxmax > 0 && rwxmax <= 0) {
1304 if (gPad->GetLogx()) uxmax = 1.1*rwxmax;
1307 if (minimum < 0 && rwymin >= 0) {
1308 if (gPad->GetLogy()) minimum = 0.9*rwymin;
1311 if (maximum > 0 && rwymax <= 0) {
1312 if (gPad->GetLogy()) maximum = 1.1*rwymax;
1315 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1316 if (uxmin <= 0 && gPad->GetLogx()) {
1317 if (uxmax > 1000) uxmin = 1;
1318 else uxmin = 0.001*uxmax;
1323 fHistogram->GetYaxis()->SetLimits(rwymin,rwymax);
1332 fHistogram =
new TH1F(GetName(),GetTitle(),npt,rwxmin,rwxmax);
1333 if (!fHistogram)
return;
1334 fHistogram->SetMinimum(rwymin);
1335 fHistogram->SetBit(TH1::kNoStats);
1336 fHistogram->SetMaximum(rwymax);
1337 fHistogram->GetYaxis()->SetLimits(rwymin,rwymax);
1338 fHistogram->SetDirectory(0);
1339 if (xtitle) {fHistogram->GetXaxis()->SetTitle(xtitle);
delete [] xtitle;}
1340 if (ytitle) {fHistogram->GetYaxis()->SetTitle(ytitle);
delete [] ytitle;}
1341 if (firstx != lastx) fHistogram->GetXaxis()->SetRange(firstx,lastx);
1342 if (timedisplay) {fHistogram->GetXaxis()->SetTimeDisplay(timedisplay);}
1343 if (timeformat) {fHistogram->GetXaxis()->SetTimeFormat(timeformat);
delete [] timeformat;}
1345 fHistogram->Paint(
"0");
1348 TGraph *gfit =
nullptr;
1350 TObjOptLink *lnk = (TObjOptLink*)fGraphs->FirstLink();
1353 chopt.ReplaceAll(
"A",
"");
1357 obj = lnk->GetObject();
1359 gPad->PushSelectableObject(obj);
1361 if (!gPad->PadInHighlightMode() || (gPad->PadInHighlightMode() && obj == gPad->GetSelected())) {
1362 TString opt = lnk->GetOption();
1363 if (!opt.IsWhitespace())
1364 obj->Paint(opt.ReplaceAll(
"A",
"").Data());
1366 if (!chopt.IsWhitespace()) obj->Paint(chopt.Data());
1367 else obj->Paint(
"L");
1371 lnk = (TObjOptLink*)lnk->Next();
1374 gfit = (TGraph*)obj;
1380 TIter next(fFunctions);
1381 while ((f = (TObject*) next())) {
1382 if (f->InheritsFrom(TF1::Class())) {
1383 if (f->TestBit(TF1::kNotDraw) == 0) f->Paint(
"lsame");
1391 if (gfit && fit) gfit->PaintStats(fit);
1398 void TMultiGraph::PaintPads(Option_t *option)
1400 TIter next(fGraphs);
1401 Int_t neededPads = fGraphs->GetSize();
1402 Int_t existingPads = 0;
1403 TString opt = (TString)option;
1405 TVirtualPad *curPad = gPad;
1407 TIter nextPad(curPad->GetListOfPrimitives());
1409 while ((obj = nextPad())) {
1410 if (obj->InheritsFrom(TVirtualPad::Class())) existingPads++;
1412 if (existingPads < neededPads) {
1414 Int_t nx = (Int_t)TMath::Sqrt((Double_t)neededPads);
1415 if (nx*nx < neededPads) nx++;
1417 if (((nx*ny)-nx) >= neededPads) ny--;
1418 curPad->Divide(nx,ny);
1423 TObjOptLink *lnk = (TObjOptLink*)fGraphs->FirstLink();
1427 g = (TGraph*)lnk->GetObject();
1430 TString apopt = lnk->GetOption();
1431 if (strlen(apopt)) {
1432 g->Draw((apopt.Append(
"A")).Data());
1434 if (strlen(opt)) g->Draw(opt.Append(
"A"));
1437 lnk = (TObjOptLink*)lnk->Next();
1447 void TMultiGraph::PaintPolyLine3D(Option_t *option)
1451 Double_t rwxmin=0., rwxmax=0., rwymin=0., rwymax=0.;
1452 TIter next(fGraphs);
1455 g = (TGraph*) next();
1457 g->ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1462 fHistogram =
new TH1F(GetName(),GetTitle(),npt,rwxmin,rwxmax);
1465 while ((g = (TGraph*) next())) {
1466 Double_t rx1,ry1,rx2,ry2;
1467 g->ComputeRange(rx1, ry1, rx2, ry2);
1468 if (rx1 < rwxmin) rwxmin = rx1;
1469 if (ry1 < rwymin) rwymin = ry1;
1470 if (rx2 > rwxmax) rwxmax = rx2;
1471 if (ry2 > rwymax) rwymax = ry2;
1472 if (g->GetN() > npt) npt = g->GetN();
1475 Int_t ndiv = fGraphs->GetSize();
1477 TH2F* frame =
new TH2F(
"frame",
"", ndiv, 0., (Double_t)(ndiv), npt, rwxmin, rwxmax);
1479 frame->SetTitle(fHistogram->GetTitle());
1480 frame->GetYaxis()->SetTitle(fHistogram->GetXaxis()->GetTitle());
1481 frame->GetYaxis()->SetRange(fHistogram->GetXaxis()->GetFirst(), fHistogram->GetXaxis()->GetLast());
1482 frame->GetZaxis()->SetTitle(fHistogram->GetYaxis()->GetTitle());
1485 TAxis *Xaxis = frame->GetXaxis();
1486 Xaxis->SetNdivisions(-ndiv);
1488 for (i=ndiv; i>=1; i--) {
1489 g = (TGraph*) next();
1490 Xaxis->SetBinLabel(i, g->GetTitle());
1493 frame->SetStats(kFALSE);
1494 if (fMinimum != -1111) frame->SetMinimum(fMinimum);
1495 else frame->SetMinimum(rwymin);
1496 if (fMaximum != -1111) frame->SetMaximum(fMaximum);
1497 else frame->SetMaximum(rwymax);
1499 l = (
char*)strstr(option,
"A");
1500 if (l) frame->Paint(
"lego9,fb,bb");
1501 l = (
char*)strstr(option,
"BB");
1502 if (!l) frame->Paint(
"lego9,fb,a,same");
1505 Double_t xyz1[3], xyz2[3];
1507 Double_t xl = frame->GetYaxis()->GetBinLowEdge(frame->GetYaxis()->GetFirst());
1508 Double_t xu = frame->GetYaxis()->GetBinUpEdge(frame->GetYaxis()->GetLast());
1509 Double_t yl = frame->GetMinimum();
1510 Double_t yu = frame->GetMaximum();
1511 Double_t xc[2],yc[2];
1515 while ((g = (TGraph*) next())) {
1519 gPad->SetLineColor(g->GetLineColor());
1520 gPad->SetLineWidth(g->GetLineWidth());
1521 gPad->SetLineStyle(g->GetLineStyle());
1522 gPad->TAttLine::Modify();
1523 for (i=0; i<npt-1; i++) {
1528 if (gPad->Clip(&xc[0], &yc[0], xl, yl, xu, yu)<2) {
1535 gPad->PaintLine3D(xyz1, xyz2);
1541 l = (
char*)strstr(option,
"FB");
1542 if (!l) frame->Paint(
"lego9,bb,a,same");
1551 void TMultiGraph::PaintReverse(Option_t *option)
1553 auto *h = GetHistogram();
1555 TGraph *fg =
nullptr;
1558 TString mgopt = option;
1561 TIter next(fGraphs);
1563 Bool_t first = kTRUE;
1565 while ((g = (TGraph *)next())) {
1566 gopt = GetGraphDrawOption(g);
1570 hg = fg->GetHistogram();
1571 fg->SetHistogram(h);
1572 fg->Paint(gopt.Data());
1575 g->Paint(gopt.ReplaceAll(
"a",
"").Data());
1579 fg->SetHistogram(hg);
1586 void TMultiGraph::Print(Option_t *option)
const
1590 TIter next(fGraphs);
1591 while ((g = (TGraph*) next())) {
1602 void TMultiGraph::RecursiveRemove(TObject *obj)
1604 if (!fGraphs)
return;
1605 TObject *objr = fGraphs->Remove(obj);
1607 delete fHistogram; fHistogram = 0;
1608 if (gPad) gPad->Modified();
1615 void TMultiGraph::SavePrimitive(std::ostream &out, Option_t *option )
1618 out<<
" "<<std::endl;
1619 if (gROOT->ClassSaved(TMultiGraph::Class())) {
1622 out<<
" TMultiGraph *";
1624 out<<
"multigraph = new TMultiGraph();"<<std::endl;
1625 out<<
" multigraph->SetName("<<quote<<GetName()<<quote<<
");"<<std::endl;
1626 out<<
" multigraph->SetTitle("<<quote<<GetTitle()<<quote<<
");"<<std::endl;
1629 TObjOptLink *lnk = (TObjOptLink*)fGraphs->FirstLink();
1633 g = lnk->GetObject();
1634 g->SavePrimitive(out, Form(
"multigraph%s",lnk->GetOption()));
1635 lnk = (TObjOptLink*)lnk->Next();
1638 const char *l = strstr(option,
"th2poly");
1640 out<<
" "<<l+7<<
"->AddBin(multigraph);"<<std::endl;
1642 out<<
" multigraph->Draw(" <<quote<<option<<quote<<
");"<<std::endl;
1644 TAxis *xaxis = GetXaxis();
1645 TAxis *yaxis = GetYaxis();
1648 out<<
" multigraph->GetXaxis()->SetLimits("<<xaxis->GetXmin()<<
", "<<xaxis->GetXmax()<<
");"<<std::endl;
1649 xaxis->SaveAttributes(out,
"multigraph",
"->GetXaxis()");
1651 if (yaxis) yaxis->SaveAttributes(out,
"multigraph",
"->GetYaxis()");
1652 if (fMinimum != -1111) out<<
" multigraph->SetMinimum("<<fMinimum<<
");"<<std::endl;
1653 if (fMaximum != -1111) out<<
" multigraph->SetMaximum("<<fMaximum<<
");"<<std::endl;
1660 void TMultiGraph::SetMaximum(Double_t maximum)
1663 if (fHistogram) fHistogram->SetMaximum(maximum);
1670 void TMultiGraph::SetMinimum(Double_t minimum)
1673 if (fHistogram) fHistogram->SetMinimum(minimum);
1680 TIter TMultiGraph::begin()
const
1682 return TIter(fGraphs);