356 double par_Pt = 100.;
358 double par_Rho = 20.;
361 auto ip = paramValues.find(
"Jet_Pt");
362 if (ip != paramValues.end()) {
363 par_Pt = std::stod(ip->second);
365 ip = paramValues.find(
"Jet_Eta");
366 if (ip != paramValues.end()) {
367 par_Eta = std::stod(ip->second);
369 ip = paramValues.find(
"Jet_Rho");
370 if (ip != paramValues.end()) {
371 par_Rho = std::stod(ip->second);
378 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
379 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
381 leg_eta->SetBorderSize(0);
382 leg_eta->SetLineStyle(0);
383 leg_eta->SetFillStyle(0);
385 leg_eta->SetTextFont(42);
386 leg_pt->SetBorderSize(0);
387 leg_pt->SetLineStyle(0);
388 leg_pt->SetFillStyle(0);
390 auto tag1 = PlotBase::getTag<0>();
391 auto iov1 = tag1.iovs.front();
392 std::shared_ptr<JetResolutionObject> payload1 =
fetchPayload(std::get<1>(iov1));
393 auto tag2 = PlotBase::getTag<1>();
394 auto iov2 = tag2.iovs.front();
395 std::shared_ptr<JetResolutionObject> payload2 =
fetchPayload(std::get<1>(iov2));
397 std::stringstream ss_tagname1(tag1.name);
398 std::stringstream ss_tagname2(tag1.name);
404 getline(ss_tagname1, stmp,
'_');
405 getline(ss_tagname1, stmp);
408 getline(ss_tagname2, stmp,
'_');
409 getline(ss_tagname2, stmp);
412 if (payload1.get() && payload2.get()) {
413 if (!payload1->getRecords().empty() &&
414 payload1->getDefinition().getFormulaString().compare(
"") == 0)
417 for (
const auto&
record : payload1->getRecords()) {
419 if (!
record.getVariablesRange().empty() && payload1->getDefinition().getVariableName(0) ==
"JetPt" &&
420 record.getVariablesRange()[0].is_inside(par_Pt)) {
421 if (
record.getBinsRange().size() > 1 && payload1->getDefinition().getBinName(1) ==
"Rho" &&
422 record.getBinsRange()[1].is_inside(par_Rho)) {
423 if (!
record.getBinsRange().empty() && payload1->getDefinition().getBinName(0) ==
"JetEta") {
428 if (
record.getBinsRange()[0].is_inside(x_axis)) {
429 std::vector<double>
var = {par_Pt};
430 std::vector<double> param;
431 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
432 double par =
record.getParametersValues()[
i];
433 param.push_back(par);
435 float res =
f.evaluate(
var, param);
436 resol_eta1->SetBinContent(
idx + 1,
res);
443 if (!
record.getBinsRange().empty() && payload1->getDefinition().getBinName(0) ==
"JetEta" &&
444 record.getBinsRange()[0].is_inside(par_Eta)) {
445 if (
record.getBinsRange().size() > 1 && payload1->getDefinition().getBinName(1) ==
"Rho" &&
446 record.getBinsRange()[1].is_inside(par_Rho)) {
447 if (!
record.getVariablesRange().empty() && payload1->getDefinition().getVariableName(0) ==
"JetPt") {
452 if (
record.getVariablesRange()[0].is_inside(x_axis)) {
453 std::vector<double>
var = {x_axis};
454 std::vector<double> param;
455 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
456 double par =
record.getParametersValues()[
i];
457 param.push_back(par);
459 float res =
f.evaluate(
var, param);
460 resol_pt1->SetBinContent(
idx + 1,
res);
468 for (
const auto&
record : payload2->getRecords()) {
470 if (!
record.getVariablesRange().empty() && payload2->getDefinition().getVariableName(0) ==
"JetPt" &&
471 record.getVariablesRange()[0].is_inside(par_Pt)) {
472 if (
record.getBinsRange().size() > 1 && payload2->getDefinition().getBinName(1) ==
"Rho" &&
473 record.getBinsRange()[1].is_inside(par_Rho)) {
474 if (!
record.getBinsRange().empty() && payload2->getDefinition().getBinName(0) ==
"JetEta") {
479 if (
record.getBinsRange()[0].is_inside(x_axis)) {
480 std::vector<double>
var = {par_Pt};
481 std::vector<double> param;
482 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
483 double par =
record.getParametersValues()[
i];
484 param.push_back(par);
486 float res =
f.evaluate(
var, param);
487 resol_eta2->SetBinContent(
idx + 1,
res);
494 if (!
record.getBinsRange().empty() && payload2->getDefinition().getBinName(0) ==
"JetEta" &&
495 record.getBinsRange()[0].is_inside(par_Eta)) {
496 if (
record.getBinsRange().size() > 1 && payload2->getDefinition().getBinName(1) ==
"Rho" &&
497 record.getBinsRange()[1].is_inside(par_Rho)) {
498 if (!
record.getVariablesRange().empty() && payload2->getDefinition().getVariableName(0) ==
"JetPt") {
503 if (
record.getVariablesRange()[0].is_inside(x_axis)) {
504 std::vector<double>
var = {x_axis};
505 std::vector<double> param;
506 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
507 double par =
record.getParametersValues()[
i];
508 param.push_back(par);
510 float res =
f.evaluate(
var, param);
511 resol_pt2->SetBinContent(
idx + 1,
res);
519 gStyle->SetOptStat(0);
520 gStyle->SetLabelFont(42,
"XYZ");
521 gStyle->SetLabelSize(0.05,
"XYZ");
522 gStyle->SetFrameLineWidth(3);
524 std::string title = Form(
"Comparison between %s and %s", tag1.name.c_str(), tag2.name.c_str());
525 TCanvas
canvas(
"Jet Resolution Comparison",
title.c_str(), 800, 1200);
529 resol_eta1->SetTitle(
"Jet Resolution Comparison");
530 resol_eta1->SetXTitle(
"#eta");
531 resol_eta1->SetYTitle(
"Resolution");
532 resol_eta1->SetLineWidth(3);
533 resol_eta1->SetMaximum(resol_eta1->GetMaximum() * 1.25);
534 resol_eta1->Draw(
"][");
536 resol_eta2->SetLineColor(2);
537 resol_eta2->SetLineWidth(3);
538 resol_eta2->SetLineStyle(2);
539 resol_eta2->Draw(
"][same");
541 leg_eta->AddEntry(resol_eta1, tag_ver1.c_str(),
"l");
542 leg_eta->AddEntry(resol_eta2, tag_ver2.c_str(),
"l");
543 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f; JetRho=%.2f", par_Pt, par_Rho),
"");
547 resol_pt1->SetXTitle(
"p_{T} [GeV]");
548 resol_pt1->SetYTitle(
"Resolution");
549 resol_pt1->SetLineWidth(3);
550 resol_pt1->Draw(
"][");
552 resol_pt2->SetLineColor(2);
553 resol_pt2->SetLineWidth(3);
554 resol_pt2->SetLineStyle(2);
555 resol_pt2->Draw(
"][same");
557 leg_pt->AddEntry(resol_pt1, tag_ver1.c_str(),
"l");
558 leg_pt->AddEntry(resol_pt2, tag_ver2.c_str(),
"l");
559 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f; JetRho=%.2f", par_Eta, par_Rho),
"");
std::string m_imageFileName
const std::map< std::string, std::string > & inputParamValues() const
std::string title() const
std::shared_ptr< JetResolutionObject > fetchPayload(const cond::Hash &payloadHash)