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