1184 {
1186 groupDir->cd();
1187
1188 int iMarkerStyle = 20;
1189 gStyle->SetFrameBorderMode(0);
1190 gStyle->SetFrameFillColor(0);
1191 gStyle->SetCanvasBorderMode(0);
1192 gStyle->SetPadBorderMode(0);
1193 gStyle->SetPadColor(0);
1194 gStyle->SetCanvasColor(0);
1195 gStyle->SetTitleColor(0);
1196 gStyle->SetStatColor(0);
1197 gStyle->SetFillColor(1);
1198 gStyle->SetPalette(1, 0);
1199 gStyle->SetTitleFontSize(0.06);
1200 gStyle->SetTitleH(0.06);
1201 gStyle->SetMarkerStyle(iMarkerStyle);
1202 gStyle->SetOptStat(111100);
1203 gStyle->SetStatBorderSize(0);
1204 gStyle->SetStatX(0.99);
1205 gStyle->SetStatY(0.99);
1206 gStyle->SetStatW(0.2);
1207 gStyle->SetStatH(0.1);
1208
1209
1213 TImage* img = nullptr;
1214
1215 gROOT->SetBatch();
1216 TImageDump tid;
1217 std::string pathname(groupDir->GetPath());
1219 bool WasCollectionReference = false;
1221 bool LookForDisplay;
1222 if (file_version == 1) {
1223 LookForDisplay =
containsDir(
"Config/annotations/display", (pathname +
"/" + nameHis +
"_"));
1224 if (LookForDisplay) {
1225 display =
getStringName(pathname +
"/" + nameHis +
"_/Config/annotations/display", file_version);
1226 }
1227 } else if (file_version == 2) {
1228 std::optional<std::string> JSON_content;
1229 LookForDisplay =
containsDir((nameHis +
"_"), pathname);
1230 if (LookForDisplay) {
1231 JSON_content =
containsKeyInJSON(
"/annotations/display",
"Config", (pathname +
"/" + nameHis +
"_"));
1232 if (JSON_content) {
1233 LookForDisplay = true;
1234 } else {
1235 LookForDisplay = false;
1236 }
1237 }
1238 if (LookForDisplay) {
1239 display = JSON_content.value();
1240 }
1241 }
1242
1243 bool PlotOverflows = (
display.find(
"PlotUnderOverflow") != std::string::npos);
1244
1246 std::string drawopt = "";
1247 while (found != std::string::npos) {
1248 std::size_t found1 =
display.find_first_of(
',', found + 1);
1249 auto temp =
display.substr(found + 5, found1 != std::string::npos ? found1 - found - 5 :
display.size());
1250 std::ranges::transform(temp, temp.begin(), [](unsigned char c) { return std::tolower(c); });
1251 drawopt += temp;
1253 }
1254
1256 std::string drawrefopt = "";
1257 while (found != std::string::npos) {
1258 std::size_t found1 =
display.find_first_of(
',', found + 1);
1259 auto temp =
display.substr(found + 8, found1 != std::string::npos ? found1 - found - 8 :
display.size());
1260 std::ranges::transform(temp, temp.begin(), [](unsigned char c) { return std::tolower(c); });
1261 drawrefopt += temp;
1263 }
1264 if (drawrefopt == "") {
1265 drawrefopt = drawopt;
1266 }
1267
1269 std::string drawrefopt2D = "";
1270 while (found != std::string::npos) {
1271 std::size_t found1 =
display.find_first_of(
',', found + 1);
1272 auto temp =
display.substr(found + 10, found1 != std::string::npos ? found1 - found - 10 :
display.size());
1273 std::ranges::transform(temp, temp.begin(), [](unsigned char c) { return std::tolower(c); });
1274 drawrefopt2D += temp;
1276 }
1277
1278
1280 std::string datatitle;
1281 if (found == std::string::npos) {
1282 datatitle = "Data";
1283 }
1284 while (found != std::string::npos) {
1285 std::size_t found1 =
display.find_first_of(
',', found + 1);
1286 if (found1 != std::string::npos) {
1287 datatitle +=
display.substr(found + 9, found1 - found - 9);
1288 } else {
1290 }
1292 }
1293 groupDir->cd();
1294 TKey* hkey = groupDir->FindKey(nameHis.c_str());
1295 if (hkey == 0) {
1296 std::cerr << "Did not find TKey for \"" << nameHis << "\", will not save this histogram.\n";
1297 return std::pair<std::string, std::string>{
1298 "", ""
1299 };
1300 }
1302 TObject* hobj = hkey->ReadObj();
1304 TH1* hRef(0);
1305 TEfficiency* eRef(0);
1306 TH2* h2Ref(0);
1307 std::vector<TH1*> hRefs;
1308 std::vector<TEfficiency*> eRefs;
1309 bool hasPlotted(false);
1310 TH1*
h =
dynamic_cast<TH1*
>(hobj);
1311 TH2* h2 =
dynamic_cast<TH2*
>(
h);
1312 TGraph*
g =
dynamic_cast<TGraph*
>(hobj);
1313 TEfficiency*
e =
dynamic_cast<TEfficiency*
>(hobj);
1314
1315 std::string
name = nameHis;
1316
1317
1318
1319
1320
1321
1322 std::string AlgoName("");
1323 AlgoName =
getStringName(pathname +
"/" + nameHis +
"_/Config/name", file_version);
1324 int ww = 550;
1327 if (found != std::string::npos) {
1328 std::size_t found1 =
display.find_first_of(
',', found + 1);
1329 ww = std::atoi((
display.substr(found + 8, found1 - found - 8)).c_str());
1331 wh = std::atoi((
display.substr(found1 + 1, found - found1 - 1)).c_str());
1332 }
1333 if (h != 0) {
1334 auto myC = std::make_unique<TCanvas>(nameHis.c_str(), "myC", ww, wh);
1335
1336
1337
1338
1339
1340
1341
1342 gPad->SetGridx(
display.find(
"SetGridx") != std::string::npos);
1343 gPad->SetGridy(
display.find(
"SetGridy") != std::string::npos);
1345 if (found != std::string::npos) {
1346 std::size_t found1 =
display.find_first_of(
'(', found + 1);
1347 std::size_t found2 =
display.find_first_of(
",)", found + 1);
1348 std::string cn =
display.substr(found1 + 1, found2 - found1 - 1);
1349 int n1 = std::strtol(cn.c_str(), NULL, 0);
1350 gStyle->SetPalette((Int_t) n1);
1351 }
1353 if (found != std::string::npos) {
1354 std::size_t found1 =
display.find_first_of(
'(', found + 1);
1355 std::size_t found2 =
display.find_first_of(
",)", found + 1);
1356 std::string cn =
display.substr(found1 + 1, found2 - found1 - 1);
1357 int n1 = std::strtol(cn.c_str(), NULL, 0);
1358 gStyle->SetGridStyle((Style_t) n1);
1359 }
1360
1361
1363 if (found != std::string::npos) {
1364 Double_t minstat = 0.;
1365 std::size_t fpos1, fpos2, fpos;
1366 fpos =
display.find(
"MinStat");
1367 if (fpos != std::string::npos) {
1368 fpos1 =
display.find(
'(', fpos + 1);
1369 if (fpos1 != std::string::npos) {
1370 fpos2 =
display.find(
')', fpos1 + 1);
1371 if (fpos2 != std::string::npos) {
1372 std::string s_minstat =
display.substr(fpos1 + 1, fpos2 - fpos1 - 1);
1373 minstat = std::strtod(s_minstat.c_str(), NULL);
1374 }
1375 }
1376 }
1377 std::string fitopt("");
1378 fpos =
display.find(
"FitOption");
1379 if (fpos != std::string::npos) {
1380 fpos1 =
display.find(
'(', fpos + 1);
1381 if (fpos1 != std::string::npos) {
1382 fpos2 =
display.find(
')', fpos1 + 1);
1383 if (fpos2 != std::string::npos) {
1384 fitopt =
display.substr(fpos1 + 1, fpos2 - fpos1 - 1);
1385 }
1386 }
1387 }
1388
1389 std::size_t found1 =
display.find(
"doublegaus");
1390 if (found1 != std::string::npos) {
1391 std::size_t found2 =
display.find(
'(', found1 + 1);
1392 if (found2 != std::string::npos) {
1393 std::size_t found3 =
display.find(
')', found2 + 1);
1394 if (found3 != std::string::npos) {
1395 std::string
range =
display.substr(found2 + 1, found3 - found2 - 1);
1396 Double_t
xmin = std::strtod(
range.c_str(), NULL);
1397 std::size_t found4 =
display.find(
',', found2 + 1);
1398 if (found4 != std::string::npos) {
1399 range =
display.substr(found4 + 1, found3 - found4 - 1);
1400 Double_t
xmax = std::strtod(
range.c_str(), NULL);
1404 f1->GetParameters(par);
1405 TF1* func =
new TF1(
"func",
"gaus(0)+gaus(3)",
xmin,
xmax);
1406 func->SetParameters(par);
1407 func->SetParameter(3,
h->GetBinContent(
h->GetMaximumBin()));
1408 func->SetParameter(4,
h->GetMean());
1409 func->SetParameter(5, par[2]);
1410 func->SetLineColor(kRed);
1411 func->SetLineWidth(2);
1412 if (
h->GetEffectiveEntries() > minstat) {
1413 h->Fit(func, (
"rq" + fitopt).c_str());
1414 }
1416 delete func;
1417 }
1418 }
1419 }
1420 } else {
1421
1422 std::size_t found1 =
display.find(
"gauspluspol1");
1423 if (found1 != std::string::npos) {
1424 std::size_t found2 =
display.find(
'(', found1 + 1);
1425 if (found2 != std::string::npos) {
1426 std::size_t found3 =
display.find(
')', found2 + 1);
1427 if (found3 != std::string::npos) {
1428 std::string
range =
display.substr(found2 + 1, found3 - found2 - 1);
1429 Double_t
xmin = std::strtod(
range.c_str(), NULL);
1430 std::size_t found4 =
display.find(
',', found2 + 1);
1431 if (found4 != std::string::npos) {
1432 range =
display.substr(found4 + 1, found3 - found4 - 1);
1433 Double_t
xmax = std::strtod(
range.c_str(), NULL);
1434 TF1* func =
new TF1(
"func",
"gaus(0)+pol1(3)",
xmin,
xmax);
1435 func->SetLineColor(kRed);
1436 func->SetLineWidth(2);
1437 func->SetParameters(
h->GetBinContent(
h->GetMaximumBin()),
h->GetMean(),
h->GetRMS());
1438 if (
h->GetEffectiveEntries() > minstat) {
1439 h->Fit(func, (
"rq" + fitopt).c_str());
1440 }
1441 delete func;
1442 }
1443 }
1444 }
1445 } else {
1446
1447 found1 =
display.find(
"gausplusexpo");
1448 if (found1 != std::string::npos) {
1449 std::size_t found2 =
display.find(
'(', found1 + 1);
1450 if (found2 != std::string::npos) {
1451 std::size_t found3 =
display.find(
')', found2 + 1);
1452 if (found3 != std::string::npos) {
1453 std::string
range =
display.substr(found2 + 1, found3 - found2 - 1);
1454 Double_t
xmin = std::strtod(
range.c_str(), NULL);
1455 std::size_t found4 =
display.find(
',', found2 + 1);
1456 if (found4 != std::string::npos) {
1457 range =
display.substr(found4 + 1, found3 - found4 - 1);
1458 Double_t
xmax = std::strtod(
range.c_str(), NULL);
1459
1460 TF1* func =
new TF1(
"func",
"gaus(0)+expo(3)",
xmin,
xmax);
1461 func->SetLineColor(kRed);
1462 func->SetLineWidth(2);
1463 func->SetParameters(
h->GetBinContent(
h->GetMaximumBin()),
h->GetMean(),
h->GetRMS());
1464 if (
h->GetEffectiveEntries() > minstat) {
1465 h->Fit(func, (
"rq" + fitopt).c_str());
1466 }
1467 delete func;
1468 }
1469 }
1470 }
1471 } else {
1472
1473 std::size_t found2 =
display.find(
'(', found + 1);
1474 if (found2 != std::string::npos) {
1475 std::size_t found3 =
display.find(
')', found2 + 1);
1476 if (found3 != std::string::npos) {
1477 std::string
range =
display.substr(found2 + 1, found3 - found2 - 1);
1478 Double_t
xmin = std::strtod(
range.c_str(), NULL);
1479 std::size_t found4 =
display.find(
',', found2 + 1);
1480 if (found4 != std::string::npos) {
1481 range =
display.substr(found4 + 1, found3 - found4 - 1);
1482 Double_t
xmax = std::strtod(
range.c_str(), NULL);
1483 TF1* func =
new TF1(
"func",
"gaus",
xmin,
xmax);
1484 func->SetLineColor(kRed);
1485 func->SetLineWidth(2);
1486 if (
h->GetEffectiveEntries() > minstat) {
1487 h->Fit(func, (
"rq" + fitopt).c_str());
1488 }
1489 delete func;
1490 }
1491 }
1492 }
1493 }
1494 }
1495 }
1496 }
1497 if (h2 != 0) {
1499 myC->cd();
1500 if (h2->GetMinimum() >= 0 && h2->GetMaximum() > 0.) {
1501 gPad->SetLogy(
display.find(
"LogY") != std::string::npos);
1502 gPad->SetLogz(
display.find(
"LogZ") != std::string::npos);
1503 }
1505 gPad->SetLogx(
display.find(
"LogX") != std::string::npos);
1506 }
1507 if (
h->GetXaxis()->GetXmin() >=
h->GetXaxis()->GetXmax()) {
1508 std::cerr << "HanOutputFile::saveHistogramToFile(): "
1509 <<
"Inconsistent x-axis settings: min=" <<
h->GetXaxis()->GetXmin() <<
", "
1510 <<
"max=" <<
h->GetXaxis()->GetXmax() <<
", "
1511 << "Will not save this histogram.\n";
1512 return std::pair<std::string, std::string>{
1513 "", ""
1514 };
1515 }
1516 if (
h->GetYaxis()->GetXmin() >=
h->GetYaxis()->GetXmax()) {
1517 std::cerr << "HanOutputFile::saveHistogramToFile(): "
1518 <<
"Inconsistent y-axis settings: min=" <<
h->GetYaxis()->GetXmin() <<
", "
1519 <<
"max=" <<
h->GetYaxis()->GetXmax() <<
", "
1520 << "Will not save this histogram.\n";
1521 return std::pair<std::string, std::string>{
1522 "", ""
1523 };
1524 }
1526 if (drawopt == "") {
1527 drawopt = "COLZ";
1528 }
1529 if (drawRefs) {
1530 if (file_version == 1) {
1531 groupDir->cd((nameHis + "_/Results").c_str());
1533 } else if (file_version == 2) {
1534 if (groupDir->GetDirectory((nameHis + "_").c_str()) != 0) {
1535 groupDir->cd((nameHis + "_").c_str());
1537 }
1538 }
1539 h2Ref =
dynamic_cast<TH2*
>(
ref);
1540 TCollection* colln =
dynamic_cast<TCollection*
>(
ref);
1541 if (colln) {
1542 h2Ref = dynamic_cast<TH2*>(colln->MakeIterator()->Next());
1543 }
1544 if (h2Ref && (drawrefopt2D != "")) {
1546 h2Ref->Draw(drawrefopt2D.c_str());
1547 }
1548 }
1549 h2->Draw(("SAME" + drawopt).c_str());
1551 if (drawopt.find("lego") == std::string::npos) {
1552 myC->RedrawAxis();
1553 }
1554 if (h2Ref)
ratioplot2D(myC.get(), h2, h2Ref, display);
1555
1559 t.SetTextSize(0.03);
1560 t.DrawLatex(0.02, 0.04, run_min_LB.c_str());
1563 tt.SetTextSize(0.03);
1566 } else if (h != 0) {
1568 if (
display.find(
"StatBox") != std::string::npos) {
1570 }
1571 if (
h->GetXaxis()->GetXmin() >=
h->GetXaxis()->GetXmax()) {
1572 std::cerr << "HanOutputFile::saveHistogramToFile(): "
1573 <<
"Inconsistent x-axis settings: min=" <<
h->GetXaxis()->GetXmin() <<
", "
1574 <<
"max=" <<
h->GetXaxis()->GetXmax() <<
", "
1575 << "Will not save this histogram.\n";
1576 return std::pair<std::string, std::string>{
1577 "", ""
1578 };
1579 }
1580 h->SetLineColor(kBlack);
1581 h->SetMarkerColor(1);
1582
1583
1586 myC->cd();
1587 if (drawRefs) {
1588 if (file_version == 1) {
1589 groupDir->cd((nameHis + "_/Results").c_str());
1591 } else if (file_version == 2) {
1592 if (groupDir->GetDirectory((nameHis + "_").c_str()) != 0) {
1593 groupDir->cd((nameHis + "_").c_str());
1595 }
1596 }
1597 hRef =
dynamic_cast<TH1*
>(
ref);
1598 if (hRef) {
1599 hRefs.push_back(hRef);
1600 } else {
1601 TCollection* colln =
dynamic_cast<TCollection*
>(
ref);
1602 if (colln) {
1603 WasCollectionReference = true;
1604 std::unique_ptr<TIterator> icolln(colln->MakeIterator());
1605 TObject* ref2;
1606 while ((ref2 = icolln->Next())) {
1607 hRef = dynamic_cast<TH1*>(ref2);
1608 if (hRef) {
1609 if (hRef->GetDimension() ==
h->GetDimension()) {
1610 hRefs.push_back(hRef);
1611 }
1612 } else std::cout << "hRef cast failed!!!" << std::endl;
1613 }
1614 }
1615 }
1616 groupDir->cd();
1617 }
1618
1619 if (hRefs.size() > 0) {
1620 legend =
new TLegend(0.55, 0.77, 0.87, 0.87);
1624 legend->SetBorderSize(0);
1625 legend->AddEntry(h, datatitle.c_str());
1626 int itrcolor(0);
1627 for (auto hRef : hRefs) {
1629 itrcolor++;
1632 if (pRef != 0) {
1633 hRef->SetMarkerColor(local_color);
1634
1635
1636 hRef->SetLineColor(local_color);
1637 hRef->SetLineWidth(2);
1638 double ymin = (hRef->GetMinimum() <
h->GetMinimum()) ? hRef->GetMinimum() :
h->GetMinimum();
1639 double ymax = (hRef->GetMaximum() >
h->GetMaximum()) ? hRef->GetMaximum() :
h->GetMaximum();
1641 if (PlotOverflows) {
1648 } else {
1653 }
1654
1655
1656 bool isLogY = (
display.find(
"LogY") != std::string::npos);
1657 if (isLogY) {
1662 h->SetAxisRange(
exp(lymin - (lymax - lymin) * 0.05),
exp(lymax + (lymax - lymin) * 0.05),
1663 "Y");
1664 } else {
1665 std::cerr << "ymin is <0. and LogY requested for histogram \"" << pathname + "/" + nameHis
1666 <<
"\", ymin=" <<
ymin << std::endl;
1667 }
1668 } else {
1669 double yMargin = (
ymax -
ymin) * 0.05;
1670 h->SetAxisRange(
ymin - yMargin,
ymax + yMargin,
"Y");
1671 }
1672 h->GetXaxis()->SetRangeUser(
xmin,
xmax);
1673 hRef->GetXaxis()->SetRangeUser(
xmin,
xmax);
1675 if (
h->GetMinimum() >= 0. && hRef->GetMinimum() >= 0. &&
h->GetMaximum() > 0. &&
1676 hRef->GetMaximum() > 0.) {
1677 gPad->SetLogy(
display.find(
"LogY") != std::string::npos);
1678 }
1680 gPad->SetLogx(
display.find(
"LogX") != std::string::npos);
1681 }
1682 if (!hasPlotted) {
1683 h->Draw(drawopt.c_str());
1684 hasPlotted = true;
1685 }
1686 hRef->Draw(("SAME" + drawrefopt).c_str());
1687 } else {
1689 if (
display.find(
"ScaleRef") != std::string::npos) {
1690 scale = getScaleVal(display);
1691 }
else if (
h->Integral(
"width") > 0.0 && hRef->Integral(
"width") > 0.0 &&
1692 (AlgoName.find("BinContentComp") == std::string::npos) &&
1693 (
display.find(
"NoNorm") == std::string::npos)) {
1694 scale =
h->Integral(
"width") / hRef->Integral(
"width");
1695 }
1696 hRef->Scale(scale);
1697
1698
1699 hRef->SetMarkerColor(local_color);
1700
1701 hRef->SetLineColor(local_color);
1702 double ymin = (hRef->GetMinimum() <
h->GetMinimum()) ? hRef->GetMinimum() :
h->GetMinimum();
1703 double ymax = (hRef->GetMaximum() >
h->GetMaximum()) ? hRef->GetMaximum() :
h->GetMaximum();
1705 if (PlotOverflows) {
1712 } else {
1718 }
1719
1720
1721
1722 bool isLogY = (
display.find(
"LogY") != std::string::npos);
1723
1724
1725 if (isLogY) {
1730 h->SetAxisRange(
exp(lymin - (lymax - lymin) * 0.05),
exp(lymax + (lymax - lymin) * 0.05),
"Y");
1731
1732 } else {
1733 std::cerr << "ymin is <=0. and LogY requested for histogram \"" << pathname + "/" + nameHis
1734 <<
"\", ymin=" <<
ymin << std::endl;
1735 }
1736 } else {
1738 h->SetAxisRange(
ymin - yDiff * 0.05,
ymax + yDiff * 0.05,
"Y");
1739 }
1740
1741 h->GetXaxis()->SetRangeUser(
xmin,
xmax);
1742 hRef->GetXaxis()->SetRangeUser(
xmin,
xmax);
1743 myC->cd();
1744 if (
h->GetMinimum() >= 0 && hRef->GetMinimum() >= 0 &&
h->GetMaximum() > 0. && hRef->GetMaximum() > 0.) {
1745 gPad->SetLogy(
display.find(
"LogY") != std::string::npos);
1746 }
1748 gPad->SetLogx(
display.find(
"LogX") != std::string::npos);
1749 }
1751 if (!hasPlotted) {
1752 h->Draw(drawopt.c_str());
1753 hasPlotted = true;
1754 }
1755 hRef->Draw(("SAME" + drawrefopt).c_str());
1756 }
1757 if (WasCollectionReference) {
1758 legend->AddEntry(hRef, hRef->GetName());
1759 } else {
1760 std::string refInfo("");
1761 refInfo =
getStringName(pathname +
"/" + nameHis +
"_/Config/annotations/refInfo", file_version);
1762 legend->AddEntry(hRef, refInfo !=
"Undefined" ? refInfo.c_str() :
"Reference");
1763 }
1764 }
1765 h->Draw((
"SAME" + drawopt).c_str());
1767 } else {
1768 myC->cd();
1769 if (
h->GetMinimum() >= 0) {
1770 gPad->SetLogy(
display.find(
"LogY") != std::string::npos);
1771 }
1773 gPad->SetLogx(
display.find(
"LogX") != std::string::npos);
1774 }
1776 h->Draw(drawopt.c_str());
1777 }
1778 myC->cd();
1780 myC->RedrawAxis();
1781
1782 if (hRef) {
1784 }
1785 myC->cd();
1787
1790 t.SetTextSize(0.03);
1791 t.DrawLatex(0.02, 0.04, run_min_LB.c_str());
1794 tt.SetTextSize(0.03);
1796
1798 }
1799
1800 gStyle->Reset();
1801 }
1802 if (g) {
1803 auto myC = std::make_unique<TCanvas>(nameHis.c_str(), "myC", ww, wh);
1804 myC->cd();
1805 if (
g->GetMinimum() >= 0. &&
g->GetMaximum() > 0.) {
1806 gPad->SetLogy(
display.find(
"LogY") != std::string::npos);
1807 }
1808
1809
1810
1811
1813
1814 g->Draw((std::string(
"AP") + drawopt).c_str());
1818 t.SetTextSize(0.03);
1819 t.DrawLatex(0.02, 0.04, run_min_LB.c_str());
1822 tt.SetTextSize(0.03);
1824
1825
1827
1828 gStyle->Reset();
1829 }
1830 if (e != 0) {
1831 hasPlotted = false;
1832 auto myC = std::make_unique<TCanvas>(nameHis.c_str(), "myC", ww, wh);
1834 if (drawopt == "") {
1835 if (
e->GetDimension() == 1) {
1836 drawopt = "AP";
1837 } else {
1838 drawopt = "COLZ";
1839 }
1840 }
1841 if (drawRefs) {
1842 if (file_version == 1) {
1843 groupDir->cd((nameHis + "_/Results").c_str());
1845 } else if (file_version == 2) {
1846 if (groupDir->cd((nameHis + "_").c_str())) {
1848 }
1849 }
1850 eRef =
dynamic_cast<TEfficiency*
>(
ref);
1851 if (eRef) {
1852 eRefs.push_back(eRef);
1853 } else {
1854 TCollection* colln =
dynamic_cast<TCollection*
>(
ref);
1855 if (colln) {
1856 WasCollectionReference = true;
1857 TIterator* icolln = colln->MakeIterator();
1858 TObject* ref2;
1859 while ((ref2 = icolln->Next())) {
1860 eRef = dynamic_cast<TEfficiency*>(ref2);
1861 if (eRef) {
1862 if (eRef->GetDimension() ==
e->GetDimension()) {
1863 eRefs.push_back(eRef);
1864 }
1865 } else std::cout << "eRef cast failed!!!" << std::endl;
1866 }
1867 }
1868 }
1869 groupDir->cd();
1870 }
1871 if (eRefs.size() > 0) {
1872 legend =
new TLegend(0.55, 0.77, 0.87, 0.87);
1876 legend->SetBorderSize(0);
1877 legend->AddEntry(e, datatitle.c_str());
1878 int itrcolor(0);
1879 for (auto eRef : eRefs) {
1880 myC->cd();
1882 eRef->Draw("");
1883 gPad->Update();
1884
1886 itrcolor++;
1887
1889 eRef->SetMarkerColor(local_color);
1890 eRef->SetLineColor(local_color);
1891
1892 if (!hasPlotted) {
1893 e->Draw(drawopt.c_str());
1894 hasPlotted = true;
1895 }
1896 eRef->Draw("SAME");
1897 myC->Update();
1898
1899 if (WasCollectionReference) {
1900 legend->AddEntry(eRef, eRef->GetName());
1901 } else {
1902 std::string refInfo("");
1903 refInfo =
getStringName(pathname +
"/" + nameHis +
"_/Config/annotations/refInfo", file_version);
1904 legend->AddEntry(eRef, refInfo !=
"Undefined" ? refInfo.c_str() :
"Reference");
1905 }
1906 }
1908 } else {
1909 myC->cd();
1910 e->Draw(drawopt.c_str());
1911 }
1912
1913
1914 myC->Update();
1915 e->GetPaintedGraph()->GetXaxis()->SetTitleColor();
1916
1917 myC->cd();
1921 t.SetTextSize(0.03);
1922 t.DrawLatex(0.02, 0.04, run_min_LB.c_str());
1925 tt.SetTextSize(0.03);
1928 gStyle->Reset();
1929 }
1932 if (
x)
rv.assign(
x,
y);
1933 }
1934 ;
1935 std::pair<std::string, std::string> rvPair {
1937 };
1938
1940 delete hobj;
1943 return rvPair;
1944 }
const boost::regex ref(r_ef)
virtual void formatTEfficiency(TCanvas *c, TEfficiency *e) const
static std::optional< std::string > containsKeyInJSON(const std::string &pathInJSON, const std::string &jsonName, const std::string &path_to_JSON)
Checks JSON file for a key (by its path)
virtual void polynomial(TCanvas *c, std::string str, TH1 *h)
virtual void ratioplot(TCanvas *myC_main, TH1 *h, TH1 *href, std::string str)
virtual void convertToGraphics(int cnvsType, TCanvas *myC, std::string &json, TImage **img=0, char **x=0, int *y=0)
virtual int getFileVersion()
static std::string getStringName(const std::string &location, int file_version)
virtual void ratioplot2D(TCanvas *canvas, TH2 *h2, TH2 *h2Ref, std::string display)
virtual void formatTGraph(TCanvas *c, TGraph *g) const
std::vector< int > root_color_choices