25 #include "TPaveStats.h" 64 auto ip = paramValues.find(
"Jet_Pt");
65 if (ip != paramValues.end()) {
66 par_Pt = std::stod(ip->second);
69 ip = paramValues.find(
"Jet_Rho");
70 if (ip != paramValues.end()) {
71 par_Rho = std::stod(ip->second);
75 auto tag = PlotBase::getTag<0>();
76 for (
auto const& iov :
tag.iovs) {
77 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
79 if (!
payload->getRecords().empty() &&
80 payload->getDefinition().getFormulaString().compare(
"") == 0)
85 if (!
record.getVariablesRange().empty() &&
payload->getDefinition().getVariableName(0) ==
"JetPt" &&
86 record.getVariablesRange()[0].is_inside(par_Pt)) {
87 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(1) ==
"Rho" &&
88 record.getBinsRange()[1].is_inside(par_Rho)) {
89 if (!
record.getBinsRange().empty() &&
payload->getDefinition().getBinName(0) ==
"JetEta") {
94 if (
record.getBinsRange()[0].is_inside(par_Eta)) {
95 std::vector<double>
var = {par_Pt};
96 std::vector<double> param;
97 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
98 double par =
record.getParametersValues()[
i];
101 float res =
f.evaluate(
var, param);
102 fillWithBinAndValue(
idx + 1,
res);
126 double par_Pt = 100.;
128 double par_Rho = 20.;
131 auto ip = paramValues.find(
"Jet_Eta");
132 if (ip != paramValues.end()) {
133 par_Eta = std::stod(ip->second);
136 ip = paramValues.find(
"Jet_Rho");
137 if (ip != paramValues.end()) {
138 par_Rho = std::stod(ip->second);
142 auto tag = PlotBase::getTag<0>();
143 for (
auto const& iov :
tag.iovs) {
144 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
146 if (!
payload->getRecords().empty() &&
147 payload->getDefinition().getFormulaString().compare(
"") == 0)
152 if (!
record.getBinsRange().empty() &&
payload->getDefinition().getBinName(0) ==
"JetEta" &&
153 record.getBinsRange()[0].is_inside(par_Eta)) {
154 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(1) ==
"Rho" &&
155 record.getBinsRange()[1].is_inside(par_Rho)) {
156 if (!
record.getVariablesRange().empty() &&
payload->getDefinition().getVariableName(0) ==
"JetPt") {
161 if (
record.getVariablesRange()[0].is_inside(par_Pt)) {
162 std::vector<double>
var = {par_Pt};
163 std::vector<double> param;
164 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
165 double par =
record.getParametersValues()[
i];
166 param.push_back(par);
168 float res =
f.evaluate(
var, param);
169 fillWithBinAndValue(
idx + 1,
res);
193 double par_Pt = 100.;
195 double par_Rho = 20.;
198 auto ip = paramValues.find(
"Jet_Pt");
199 if (ip != paramValues.end()) {
200 par_Pt = std::stod(ip->second);
202 ip = paramValues.find(
"Jet_Eta");
203 if (ip != paramValues.end()) {
204 par_Eta = std::stod(ip->second);
206 ip = paramValues.find(
"Jet_Rho");
207 if (ip != paramValues.end()) {
208 par_Rho = std::stod(ip->second);
213 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
214 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
216 leg_eta->SetBorderSize(0);
217 leg_eta->SetLineStyle(0);
218 leg_eta->SetFillStyle(0);
220 leg_eta->SetTextFont(42);
221 leg_pt->SetBorderSize(0);
222 leg_pt->SetLineStyle(0);
223 leg_pt->SetFillStyle(0);
225 auto tag = PlotBase::getTag<0>();
226 auto iov =
tag.iovs.front();
227 std::shared_ptr<JetResolutionObject>
payload = fetchPayload(std::get<1>(iov));
228 unsigned int run = std::get<0>(iov);
230 std::stringstream ss_tagname(
tag.name);
237 getline(ss_tagname, stmp,
'_');
238 getline(ss_tagname, stmp,
'_');
240 getline(ss_tagname, stmp,
'_');
241 tag_ver +=
'_' + stmp;
242 getline(ss_tagname, stmp,
'_');
243 tag_ver +=
'_' + stmp;
244 getline(ss_tagname, stmp,
'_');
245 tag_ver +=
'_' + stmp;
246 getline(ss_tagname, stmp,
'_');
248 getline(ss_tagname, stmp,
'_');
252 if (!
payload->getRecords().empty() &&
253 payload->getDefinition().getFormulaString().compare(
"") == 0)
258 if (!
record.getVariablesRange().empty() &&
payload->getDefinition().getVariableName(0) ==
"JetPt" &&
259 record.getVariablesRange()[0].is_inside(par_Pt)) {
260 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(1) ==
"Rho" &&
261 record.getBinsRange()[1].is_inside(par_Rho)) {
262 if (!
record.getBinsRange().empty() &&
payload->getDefinition().getBinName(0) ==
"JetEta") {
267 if (
record.getBinsRange()[0].is_inside(x_axis)) {
268 std::vector<double>
var = {par_Pt};
269 std::vector<double> param;
270 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
271 double par =
record.getParametersValues()[
i];
272 param.push_back(par);
274 float res =
f.evaluate(
var, param);
275 resol_eta->SetBinContent(
idx + 1,
res);
282 if (!
record.getBinsRange().empty() &&
payload->getDefinition().getBinName(0) ==
"JetEta" &&
283 record.getBinsRange()[0].is_inside(par_Eta)) {
284 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(1) ==
"Rho" &&
285 record.getBinsRange()[1].is_inside(par_Rho)) {
286 if (!
record.getVariablesRange().empty() &&
payload->getDefinition().getVariableName(0) ==
"JetPt") {
291 if (
record.getVariablesRange()[0].is_inside(x_axis)) {
292 std::vector<double>
var = {x_axis};
293 std::vector<double> param;
294 for (
size_t i = 0;
i <
record.getParametersValues().size();
i++) {
295 double par =
record.getParametersValues()[
i];
296 param.push_back(par);
298 float res =
f.evaluate(
var, param);
299 resol_pt->SetBinContent(
idx + 1,
res);
307 gStyle->SetOptStat(0);
308 gStyle->SetLabelFont(42,
"XYZ");
309 gStyle->SetLabelSize(0.05,
"XYZ");
310 gStyle->SetFrameLineWidth(3);
313 TCanvas
canvas(
"Jet Resolution Summary",
title.c_str(), 800, 1200);
317 resol_eta->SetTitle(tag_res.c_str());
318 resol_eta->SetXTitle(
"#eta");
319 resol_eta->SetYTitle(
"Resolution");
320 resol_eta->SetLineWidth(3);
321 resol_eta->SetMaximum(resol_eta->GetMaximum() * 1.25);
324 leg_eta->AddEntry(resol_eta, (tag_ver +
'_' + tag_jet).c_str(),
"l");
325 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f; JetRho=%.2f", par_Pt, par_Rho),
"");
329 resol_pt->SetXTitle(
"p_{T} [GeV]");
330 resol_pt->SetYTitle(
"Resolution");
331 resol_pt->SetLineWidth(3);
332 resol_pt->Draw(
"][");
334 leg_pt->AddEntry(resol_pt, (tag_ver +
'_' + tag_jet).c_str(),
"l");
335 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f; JetRho=%.2f", par_Eta, par_Rho),
"");
338 canvas.SaveAs(m_imageFileName.c_str());
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),
"");
562 canvas.SaveAs(m_imageFileName.c_str());
582 double par_Pt = 100.;
586 auto ip = paramValues.find(
"Jet_Pt");
587 if (ip != paramValues.end()) {
588 par_Pt = std::stod(ip->second);
591 ip = paramValues.find(
"Jet_Eta");
592 if (ip != paramValues.end()) {
593 par_Eta = std::stod(ip->second);
597 auto tag = PlotBase::getTag<0>();
598 for (
auto const& iov :
tag.iovs) {
599 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
601 if (!
payload->getRecords().empty() &&
602 payload->getDefinition().getFormulaString().compare(
"") != 0)
606 if (!
record.getBinsRange().empty() &&
payload->getDefinition().getBinName(0) ==
"JetEta" &&
607 record.getParametersValues().size() == 3) {
609 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(1) ==
"JetPt" &&
610 !
record.getBinsRange()[1].is_inside(par_Pt))
613 for (
size_t it = 0; it <=
NBIN_ETA; it++) {
615 if (
record.getBinsRange()[0].is_inside(par_Eta)) {
617 sf =
record.getParametersValues()[
ii];
618 fillWithBinAndValue(it, sf);
646 double par_Pt = 100.;
650 auto ip = paramValues.find(
"Jet_Pt");
651 if (ip != paramValues.end()) {
652 par_Pt = std::stod(ip->second);
655 ip = paramValues.find(
"Jet_Eta");
656 if (ip != paramValues.end()) {
657 par_Eta = std::stod(ip->second);
661 auto tag = PlotBase::getTag<0>();
662 for (
auto const& iov :
tag.iovs) {
663 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
665 if (!
payload->getRecords().empty() &&
666 payload->getDefinition().getFormulaString().compare(
"") != 0)
670 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(0) ==
"JetEta" &&
671 record.getBinsRange()[0].is_inside(par_Eta) &&
672 payload->getDefinition().getBinName(1) ==
"JetPt" &&
673 record.getParametersValues().size() == 3) {
675 for (
size_t it = 0; it <=
NBIN_PT; it++) {
677 if (
record.getBinsRange()[1].is_inside(par_Pt)) {
679 sf =
record.getParametersValues()[
ii];
680 fillWithBinAndValue(it, sf);
706 double par_Pt = 100.;
710 auto ip = paramValues.find(
"Jet_Pt");
711 if (ip != paramValues.end()) {
712 par_Pt = std::stod(ip->second);
714 ip = paramValues.find(
"Jet_Eta");
715 if (ip != paramValues.end()) {
716 par_Eta = std::stod(ip->second);
726 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
727 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
729 leg_eta->SetBorderSize(0);
730 leg_eta->SetLineStyle(0);
731 leg_eta->SetFillStyle(0);
733 leg_eta->SetTextFont(42);
734 leg_pt->SetBorderSize(0);
735 leg_pt->SetLineStyle(0);
736 leg_pt->SetFillStyle(0);
738 auto tag = PlotBase::getTag<0>();
739 auto iov =
tag.iovs.front();
740 std::shared_ptr<JetResolutionObject>
payload = fetchPayload(std::get<1>(iov));
741 unsigned int run = std::get<0>(iov);
743 std::stringstream ss_tagname(
tag.name);
750 getline(ss_tagname, stmp,
'_');
751 getline(ss_tagname, stmp,
'_');
753 getline(ss_tagname, stmp,
'_');
754 tag_ver +=
'_' + stmp;
755 getline(ss_tagname, stmp,
'_');
756 tag_ver +=
'_' + stmp;
757 getline(ss_tagname, stmp,
'_');
758 tag_ver +=
'_' + stmp;
759 getline(ss_tagname, stmp,
'_');
761 getline(ss_tagname, stmp,
'_');
764 bool is_2bin =
false;
767 if (!
payload->getRecords().empty() &&
768 payload->getDefinition().getFormulaString().compare(
"") != 0)
773 if (
record.getBinsRange().size() > 1)
776 if (!
record.getBinsRange().empty() &&
payload->getDefinition().getBinName(0) ==
"JetEta" &&
777 record.getParametersValues().size() == 3) {
779 for (
size_t it = 0; it <=
NBIN_ETA; it++) {
781 if (((is_2bin ==
false) || (is_2bin ==
true &&
record.getBinsRange()[1].is_inside(par_Pt))) &&
782 record.getBinsRange()[0].is_inside(x_axis)) {
783 sf_eta_norm->SetBinContent(it + 1,
record.getParametersValues()[0]);
784 sf_eta_down->SetBinContent(it + 1,
record.getParametersValues()[1]);
785 sf_eta_up->SetBinContent(it + 1,
record.getParametersValues()[2]);
790 if (
record.getBinsRange().size() > 1 &&
payload->getDefinition().getBinName(0) ==
"JetEta" &&
791 record.getBinsRange()[0].is_inside(par_Eta) &&
792 payload->getDefinition().getBinName(1) ==
"JetPt" &&
793 record.getParametersValues().size() == 3) {
797 for (
size_t it = 0; it <=
NBIN_PT; it++) {
799 if (
record.getBinsRange()[1].is_inside(x_axis)) {
800 sf_pt_norm->SetBinContent(it + 1,
record.getParametersValues()[0]);
801 sf_pt_down->SetBinContent(it + 1,
record.getParametersValues()[1]);
802 sf_pt_up->SetBinContent(it + 1,
record.getParametersValues()[2]);
808 gStyle->SetOptStat(0);
809 gStyle->SetLabelFont(42,
"XYZ");
810 gStyle->SetLabelSize(0.05,
"XYZ");
811 gStyle->SetFrameLineWidth(3);
814 TCanvas
canvas(
"Jet ScaleFactor Summary",
title.c_str(), 800, 1200);
818 sf_eta_up->SetTitle(
"ScaleFactor vs. #eta");
819 sf_eta_up->SetXTitle(
"#eta");
820 sf_eta_up->SetYTitle(
"Scale Factor");
821 sf_eta_up->SetLineStyle(7);
822 sf_eta_up->SetLineWidth(3);
823 sf_eta_up->SetFillColorAlpha(kGray, 0.5);
824 sf_eta_up->SetMaximum(sf_eta_up->GetMaximum() * 1.25);
825 sf_eta_up->SetMinimum(0.);
826 sf_eta_up->Draw(
"][");
828 sf_eta_down->SetLineStyle(7);
829 sf_eta_down->SetLineWidth(3);
830 sf_eta_down->SetFillColorAlpha(kWhite, 1);
831 sf_eta_down->Draw(
"][ same");
833 sf_eta_norm->SetLineStyle(1);
834 sf_eta_norm->SetLineWidth(5);
835 sf_eta_norm->SetFillColor(0);
836 sf_eta_norm->Draw(
"][ same");
837 sf_eta_norm->Draw(
"axis same");
839 leg_eta->AddEntry(sf_eta_norm, (tag_ver +
'_' + tag_jet).c_str(),
"l");
840 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f", par_Pt),
"");
843 if (is_2bin ==
true) {
845 sf_pt_up->SetTitle(
"ScaleFactor vs. p_{T}");
846 sf_pt_up->SetXTitle(
"p_{T} [GeV]");
847 sf_pt_up->SetYTitle(
"Scale Factor");
848 sf_pt_up->SetLineStyle(7);
849 sf_pt_up->SetLineWidth(3);
850 sf_pt_up->SetFillColorAlpha(kGray, 0.5);
851 sf_pt_up->SetMaximum(sf_pt_up->GetMaximum() * 1.25);
852 sf_pt_up->SetMinimum(0.);
853 sf_pt_up->Draw(
"][");
855 sf_pt_down->SetLineStyle(7);
856 sf_pt_down->SetLineWidth(3);
857 sf_pt_down->SetFillColorAlpha(kWhite, 1);
858 sf_pt_down->Draw(
"][ same");
860 sf_pt_norm->SetLineStyle(1);
861 sf_pt_norm->SetLineWidth(5);
862 sf_pt_norm->SetFillColor(0);
863 sf_pt_norm->Draw(
"][ same");
864 sf_pt_norm->Draw(
"axis same");
866 leg_pt->AddEntry(sf_pt_norm, (tag_ver +
'_' + tag_jet).c_str(),
"l");
867 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f", par_Eta),
"");
871 canvas.SaveAs(m_imageFileName.c_str());
889 double par_Pt = 100.;
893 auto ip = paramValues.find(
"Jet_Pt");
894 if (ip != paramValues.end()) {
895 par_Pt = std::stod(ip->second);
897 ip = paramValues.find(
"Jet_Eta");
898 if (ip != paramValues.end()) {
899 par_Eta = std::stod(ip->second);
907 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
908 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
910 leg_eta->SetBorderSize(0);
911 leg_eta->SetLineStyle(0);
912 leg_eta->SetFillStyle(0);
914 leg_eta->SetTextFont(42);
915 leg_pt->SetBorderSize(0);
916 leg_pt->SetLineStyle(0);
917 leg_pt->SetFillStyle(0);
919 auto tag1 = PlotBase::getTag<0>();
920 auto iov1 = tag1.iovs.front();
921 std::shared_ptr<JetResolutionObject> payload1 = fetchPayload(std::get<1>(iov1));
923 auto tag2 = PlotBase::getTag<1>();
924 auto iov2 = tag2.iovs.front();
925 std::shared_ptr<JetResolutionObject> payload2 = fetchPayload(std::get<1>(iov2));
927 std::stringstream ss_tagname1(tag1.name);
928 std::stringstream ss_tagname2(tag2.name);
934 getline(ss_tagname1, stmp,
'_');
935 getline(ss_tagname1, stmp);
938 getline(ss_tagname2, stmp,
'_');
939 getline(ss_tagname2, stmp);
942 bool is_2bin =
false;
944 if (payload1.get() && payload2.get()) {
945 if (!payload1->getRecords().empty() &&
946 payload1->getDefinition().getFormulaString().compare(
"") != 0)
950 for (
const auto&
record : payload1->getRecords()) {
951 if (
record.getBinsRange().size() > 1)
954 if (!
record.getBinsRange().empty() && payload1->getDefinition().getBinName(0) ==
"JetEta" &&
955 record.getParametersValues().size() == 3) {
957 for (
size_t it = 0; it <=
NBIN_ETA; it++) {
959 if (((is_2bin ==
false) || (is_2bin ==
true &&
record.getBinsRange()[1].is_inside(par_Pt))) &&
960 record.getBinsRange()[0].is_inside(x_axis)) {
961 sf_eta_one->SetBinContent(it + 1,
record.getParametersValues()[0]);
966 if (
record.getBinsRange().size() > 1 && payload1->getDefinition().getBinName(0) ==
"JetEta" &&
967 record.getBinsRange()[0].is_inside(par_Eta) &&
968 payload1->getDefinition().getBinName(1) ==
"JetPt" &&
969 record.getParametersValues().size() == 3) {
973 for (
size_t it = 0; it <=
NBIN_PT; it++) {
975 if (
record.getBinsRange()[1].is_inside(x_axis)) {
976 sf_pt_one->SetBinContent(it + 1,
record.getParametersValues()[0]);
983 for (
const auto&
record : payload2->getRecords()) {
984 if (
record.getBinsRange().size() > 1)
987 if (!
record.getBinsRange().empty() && payload2->getDefinition().getBinName(0) ==
"JetEta" &&
988 record.getParametersValues().size() == 3) {
990 for (
size_t it = 0; it <=
NBIN_ETA; it++) {
992 if (((is_2bin ==
false) || (is_2bin ==
true &&
record.getBinsRange()[1].is_inside(par_Pt))) &&
993 record.getBinsRange()[0].is_inside(x_axis)) {
994 sf_eta_two->SetBinContent(it + 1,
record.getParametersValues()[0]);
999 if (
record.getBinsRange().size() > 1 && payload2->getDefinition().getBinName(0) ==
"JetEta" &&
1000 record.getBinsRange()[0].is_inside(par_Eta) &&
1001 payload2->getDefinition().getBinName(1) ==
"JetPt" &&
1002 record.getParametersValues().size() == 3) {
1006 for (
size_t it = 0; it <=
NBIN_PT; it++) {
1008 if (
record.getBinsRange()[1].is_inside(x_axis)) {
1009 sf_pt_two->SetBinContent(it + 1,
record.getParametersValues()[0]);
1015 gStyle->SetOptStat(0);
1016 gStyle->SetLabelFont(42,
"XYZ");
1017 gStyle->SetLabelSize(0.05,
"XYZ");
1018 gStyle->SetFrameLineWidth(3);
1021 TCanvas
canvas(
"Jet ScaleFactor",
title.c_str(), 800, 1200);
1025 sf_eta_one->SetTitle(
"Jet ScaleFactor vs. #eta");
1026 sf_eta_one->SetXTitle(
"#eta");
1027 sf_eta_one->SetYTitle(
"Scale Factor");
1028 sf_eta_one->SetLineWidth(3);
1029 sf_eta_one->SetMaximum(sf_eta_one->GetMaximum() * 1.25);
1030 sf_eta_one->SetMinimum(0.);
1031 sf_eta_one->Draw(
"][");
1033 sf_eta_two->SetLineColor(2);
1034 sf_eta_two->SetLineWidth(3);
1035 sf_eta_two->SetLineStyle(2);
1036 sf_eta_two->Draw(
"][ same");
1038 leg_eta->AddEntry(sf_eta_one, tag_ver1.c_str(),
"l");
1039 leg_eta->AddEntry(sf_eta_two, tag_ver2.c_str(),
"l");
1040 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f", par_Pt),
"");
1043 if (is_2bin ==
true) {
1045 sf_pt_one->SetTitle(
"Jet ScaleFactor vs. p_{T}");
1046 sf_pt_one->SetXTitle(
"p_{T} [GeV]");
1047 sf_pt_one->SetYTitle(
"Scale Factor");
1048 sf_pt_one->SetLineWidth(3);
1049 sf_pt_one->SetMaximum(sf_pt_one->GetMaximum() * 1.25);
1050 sf_pt_one->SetMinimum(0.);
1051 sf_pt_one->Draw(
"][");
1053 sf_pt_two->SetLineColor(2);
1054 sf_pt_two->SetLineWidth(3);
1055 sf_pt_two->SetLineStyle(2);
1056 sf_pt_two->Draw(
"][ same");
1058 leg_pt->AddEntry(sf_pt_one, tag_ver1.c_str(),
"l");
1059 leg_pt->AddEntry(sf_pt_two, tag_ver2.c_str(),
"l");
1060 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f", par_Eta),
"");
1064 canvas.SaveAs(m_imageFileName.c_str());
JetScaleFactorVsEta< NORM > JetScaleFactorVsEtaNORM
JetScaleFactorVsEta< UP > JetScaleFactorVsEtaUP
JetScaleFactorVsPt< NORM > JetScaleFactorVsPtNORM
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
JetScaleFactorVsPt< DOWN > JetScaleFactorVsPtDOWN
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Log< level::Warning, true > LogPrint
const std::map< std::string, std::string > & inputParamValues() const
void addInputParam(const std::string ¶mName)
JetScaleFactorVsPt< UP > JetScaleFactorVsPtUP
JetScaleFactorVsEta< DOWN > JetScaleFactorVsEtaDOWN