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)
91 if (
payload->getRecord(j_param) ==
nullptr) {
97 fillWithBinAndValue(
idx,
res);
116 double par_Pt = 100.;
118 double par_Rho = 20.;
121 auto ip = paramValues.find(
"Jet_Eta");
122 if (ip != paramValues.end()) {
123 par_Eta = std::stod(ip->second);
126 ip = paramValues.find(
"Jet_Rho");
127 if (ip != paramValues.end()) {
128 par_Rho = std::stod(ip->second);
132 auto tag = PlotBase::getTag<0>();
133 for (
auto const& iov :
tag.iovs) {
134 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
136 if (!
payload->getRecords().empty() &&
137 payload->getDefinition().getFormulaString().compare(
"") == 0)
148 if (
payload->getRecord(j_param) ==
nullptr) {
154 fillWithBinAndValue(
idx + 1,
res);
173 double par_Pt = 100.;
175 double par_Rho = 20.;
178 auto ip = paramValues.find(
"Jet_Pt");
179 if (ip != paramValues.end()) {
180 par_Pt = std::stod(ip->second);
182 ip = paramValues.find(
"Jet_Eta");
183 if (ip != paramValues.end()) {
184 par_Eta = std::stod(ip->second);
186 ip = paramValues.find(
"Jet_Rho");
187 if (ip != paramValues.end()) {
188 par_Rho = std::stod(ip->second);
193 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
194 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
196 leg_eta->SetBorderSize(0);
197 leg_eta->SetLineStyle(0);
198 leg_eta->SetFillStyle(0);
200 leg_eta->SetTextFont(42);
201 leg_pt->SetBorderSize(0);
202 leg_pt->SetLineStyle(0);
203 leg_pt->SetFillStyle(0);
205 auto tag = PlotBase::getTag<0>();
206 auto iov =
tag.iovs.front();
207 std::shared_ptr<JetResolutionObject>
payload = fetchPayload(std::get<1>(iov));
208 unsigned int run = std::get<0>(iov);
210 std::stringstream ss_tagname(
tag.name);
217 getline(ss_tagname, stmp,
'_');
218 getline(ss_tagname, stmp,
'_');
220 getline(ss_tagname, stmp,
'_');
221 tag_ver +=
'_' + stmp;
222 getline(ss_tagname, stmp,
'_');
223 tag_ver +=
'_' + stmp;
224 getline(ss_tagname, stmp,
'_');
225 tag_ver +=
'_' + stmp;
226 getline(ss_tagname, stmp,
'_');
228 getline(ss_tagname, stmp,
'_');
232 if (!
payload->getRecords().empty() &&
233 payload->getDefinition().getFormulaString().compare(
"") == 0)
244 if (
payload->getRecord(j_param) ==
nullptr) {
250 resol_eta->SetBinContent(
idx + 1,
res);
261 if (
payload->getRecord(j_param) ==
nullptr) {
267 resol_pt->SetBinContent(
idx + 1,
res);
270 gStyle->SetOptStat(0);
271 gStyle->SetLabelFont(42,
"XYZ");
272 gStyle->SetLabelSize(0.05,
"XYZ");
273 gStyle->SetFrameLineWidth(3);
276 TCanvas
canvas(
"Jet Resolution Summary",
title.c_str(), 800, 1200);
280 resol_eta->SetTitle(
"Jet Resolution vs. #eta");
281 resol_eta->SetXTitle(
"#eta");
282 resol_eta->SetYTitle(
"Resolution");
283 resol_eta->SetLineWidth(3);
284 resol_eta->SetMaximum(resol_eta->GetMaximum() * 1.25);
287 leg_eta->AddEntry(resol_eta, (tag_ver +
'_' + tag_jet).c_str(),
"l");
288 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f; JetRho=%.2f", par_Pt, par_Rho),
"");
292 resol_pt->SetTitle(
"Jet Resolution vs. p_{T}");
293 resol_pt->SetXTitle(
"p_{T} [GeV]");
294 resol_pt->SetYTitle(
"Resolution");
295 resol_pt->SetLineWidth(3);
296 resol_pt->Draw(
"][");
298 leg_pt->AddEntry(resol_pt, (tag_ver +
'_' + tag_jet).c_str(),
"l");
299 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f; JetRho=%.2f", par_Eta, par_Rho),
"");
302 canvas.SaveAs(m_imageFileName.c_str());
321 double par_Pt = 100.;
323 double par_Rho = 20.;
326 auto ip = paramValues.find(
"Jet_Pt");
327 if (ip != paramValues.end()) {
328 par_Pt = std::stod(ip->second);
330 ip = paramValues.find(
"Jet_Eta");
331 if (ip != paramValues.end()) {
332 par_Eta = std::stod(ip->second);
334 ip = paramValues.find(
"Jet_Rho");
335 if (ip != paramValues.end()) {
336 par_Rho = std::stod(ip->second);
343 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
344 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
346 leg_eta->SetBorderSize(0);
347 leg_eta->SetLineStyle(0);
348 leg_eta->SetFillStyle(0);
350 leg_eta->SetTextFont(42);
351 leg_pt->SetBorderSize(0);
352 leg_pt->SetLineStyle(0);
353 leg_pt->SetFillStyle(0);
355 auto tag1 = PlotBase::getTag<0>();
356 auto iov1 = tag1.iovs.front();
357 std::shared_ptr<JetResolutionObject> payload1 = fetchPayload(std::get<1>(iov1));
358 auto tag2 = PlotBase::getTag<1>();
359 auto iov2 = tag2.iovs.front();
360 std::shared_ptr<JetResolutionObject> payload2 = fetchPayload(std::get<1>(iov2));
362 std::stringstream ss_tagname1(tag1.name);
363 std::stringstream ss_tagname2(tag2.name);
369 getline(ss_tagname1, stmp,
'_');
370 getline(ss_tagname1, stmp);
373 getline(ss_tagname2, stmp,
'_');
374 getline(ss_tagname2, stmp);
377 if (payload1.get() && payload2.get()) {
378 if (!payload1->getRecords().empty() &&
379 payload1->getDefinition().getFormulaString().compare(
"") == 0)
390 if (payload1->getRecord(j_param) ==
nullptr || payload2->getRecord(j_param) ==
nullptr) {
396 float res1 = payload1->evaluateFormula(record1, j_param);
397 resol_eta1->SetBinContent(
idx + 1, res1);
398 float res2 = payload2->evaluateFormula(record2, j_param);
399 resol_eta2->SetBinContent(
idx + 1, res2);
410 if (payload1->getRecord(j_param) ==
nullptr || payload2->getRecord(j_param) ==
nullptr) {
416 float res1 = payload1->evaluateFormula(record1, j_param);
417 resol_pt1->SetBinContent(
idx + 1, res1);
418 float res2 = payload2->evaluateFormula(record2, j_param);
419 resol_pt2->SetBinContent(
idx + 1, res2);
422 gStyle->SetOptStat(0);
423 gStyle->SetLabelFont(42,
"XYZ");
424 gStyle->SetLabelSize(0.05,
"XYZ");
425 gStyle->SetFrameLineWidth(3);
427 std::string title = Form(
"Comparison between %s and %s", tag1.name.c_str(), tag2.name.c_str());
428 TCanvas
canvas(
"Jet Resolution Comparison",
title.c_str(), 800, 1200);
432 resol_eta1->SetTitle(
"Jet Resolution Comparison vs. #eta");
433 resol_eta1->SetXTitle(
"#eta");
434 resol_eta1->SetYTitle(
"Resolution");
435 resol_eta1->SetLineWidth(3);
436 resol_eta1->SetMaximum(resol_eta1->GetMaximum() * 1.25);
437 resol_eta1->Draw(
"][");
439 resol_eta2->SetLineColor(2);
440 resol_eta2->SetLineWidth(3);
441 resol_eta2->SetLineStyle(2);
442 resol_eta2->Draw(
"][same");
444 leg_eta->AddEntry(resol_eta1, tag_ver1.c_str(),
"l");
445 leg_eta->AddEntry(resol_eta2, tag_ver2.c_str(),
"l");
446 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f; JetRho=%.2f", par_Pt, par_Rho),
"");
450 resol_pt1->SetTitle(
"Jet Resolution Comparison vs. p_{T}");
451 resol_pt1->SetXTitle(
"p_{T} [GeV]");
452 resol_pt1->SetYTitle(
"Resolution");
453 resol_pt1->SetLineWidth(3);
454 resol_pt1->Draw(
"][");
456 resol_pt2->SetLineColor(2);
457 resol_pt2->SetLineWidth(3);
458 resol_pt2->SetLineStyle(2);
459 resol_pt2->Draw(
"][same");
461 leg_pt->AddEntry(resol_pt1, tag_ver1.c_str(),
"l");
462 leg_pt->AddEntry(resol_pt2, tag_ver2.c_str(),
"l");
463 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f; JetRho=%.2f", par_Eta, par_Rho),
"");
466 canvas.SaveAs(m_imageFileName.c_str());
486 double par_Pt = 100.;
490 auto ip = paramValues.find(
"Jet_Pt");
491 if (ip != paramValues.end()) {
492 par_Pt = std::stod(ip->second);
495 ip = paramValues.find(
"Jet_Eta");
496 if (ip != paramValues.end()) {
497 par_Eta = std::stod(ip->second);
501 auto tag = PlotBase::getTag<0>();
502 for (
auto const& iov :
tag.iovs) {
503 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
505 if (!
payload->getRecords().empty() &&
506 payload->getDefinition().getFormulaString().compare(
"") != 0)
516 if (
payload->getRecord(j_param) ==
nullptr) {
521 if (
record.getParametersValues().size() == 3) {
522 double sf =
record.getParametersValues()[
ii];
523 fillWithBinAndValue(
idx + 1, sf);
548 double par_Pt = 100.;
552 auto ip = paramValues.find(
"Jet_Pt");
553 if (ip != paramValues.end()) {
554 par_Pt = std::stod(ip->second);
557 ip = paramValues.find(
"Jet_Eta");
558 if (ip != paramValues.end()) {
559 par_Eta = std::stod(ip->second);
563 auto tag = PlotBase::getTag<0>();
564 for (
auto const& iov :
tag.iovs) {
565 std::shared_ptr<JetResolutionObject>
payload = Base::fetchPayload(std::get<1>(iov));
567 if (!
payload->getRecords().empty() &&
568 payload->getDefinition().getFormulaString().compare(
"") != 0)
578 if (
payload->getRecord(j_param) ==
nullptr) {
583 if (
record.getParametersValues().size() == 3) {
584 double sf =
record.getParametersValues()[
ii];
585 fillWithBinAndValue(
idx + 1, sf);
608 double par_Pt = 100.;
612 auto ip = paramValues.find(
"Jet_Pt");
613 if (ip != paramValues.end()) {
614 par_Pt = std::stod(ip->second);
616 ip = paramValues.find(
"Jet_Eta");
617 if (ip != paramValues.end()) {
618 par_Eta = std::stod(ip->second);
628 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
629 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
631 leg_eta->SetBorderSize(0);
632 leg_eta->SetLineStyle(0);
633 leg_eta->SetFillStyle(0);
635 leg_eta->SetTextFont(42);
636 leg_pt->SetBorderSize(0);
637 leg_pt->SetLineStyle(0);
638 leg_pt->SetFillStyle(0);
640 auto tag = PlotBase::getTag<0>();
641 auto iov =
tag.iovs.front();
642 std::shared_ptr<JetResolutionObject>
payload = fetchPayload(std::get<1>(iov));
643 unsigned int run = std::get<0>(iov);
645 std::stringstream ss_tagname(
tag.name);
652 getline(ss_tagname, stmp,
'_');
653 getline(ss_tagname, stmp,
'_');
655 getline(ss_tagname, stmp,
'_');
656 tag_ver +=
'_' + stmp;
657 getline(ss_tagname, stmp,
'_');
658 tag_ver +=
'_' + stmp;
659 getline(ss_tagname, stmp,
'_');
660 tag_ver +=
'_' + stmp;
661 getline(ss_tagname, stmp,
'_');
663 getline(ss_tagname, stmp,
'_');
666 bool is_2bin =
false;
669 if (!
payload->getRecords().empty() &&
670 payload->getDefinition().getFormulaString().compare(
"") != 0)
681 if (
payload->getRecord(j_param) ==
nullptr) {
686 if (
record.getBinsRange().size() > 1)
689 if (
record.getParametersValues().size() == 3) {
690 sf_eta_norm->SetBinContent(
idx + 1,
record.getParametersValues()[0]);
691 sf_eta_down->SetBinContent(
idx + 1,
record.getParametersValues()[1]);
692 sf_eta_up->SetBinContent(
idx + 1,
record.getParametersValues()[2]);
703 if (
payload->getRecord(j_param) ==
nullptr) {
708 if (
record.getParametersValues().size() == 3) {
709 sf_pt_norm->SetBinContent(
idx + 1,
record.getParametersValues()[0]);
710 sf_pt_down->SetBinContent(
idx + 1,
record.getParametersValues()[1]);
711 sf_pt_up->SetBinContent(
idx + 1,
record.getParametersValues()[2]);
715 gStyle->SetOptStat(0);
716 gStyle->SetLabelFont(42,
"XYZ");
717 gStyle->SetLabelSize(0.05,
"XYZ");
718 gStyle->SetFrameLineWidth(3);
721 TCanvas
canvas(
"Jet ScaleFactor Summary",
title.c_str(), 800, 1200);
725 sf_eta_up->SetTitle(
"ScaleFactor vs. #eta");
726 sf_eta_up->SetXTitle(
"#eta");
727 sf_eta_up->SetYTitle(
"Scale Factor");
728 sf_eta_up->SetLineStyle(7);
729 sf_eta_up->SetLineWidth(3);
730 sf_eta_up->SetFillColorAlpha(kGray, 0.5);
731 sf_eta_up->SetMaximum(sf_eta_up->GetMaximum() * 1.25);
732 sf_eta_up->SetMinimum(0.);
733 sf_eta_up->Draw(
"][");
735 sf_eta_down->SetLineStyle(7);
736 sf_eta_down->SetLineWidth(3);
737 sf_eta_down->SetFillColorAlpha(kWhite, 1);
738 sf_eta_down->Draw(
"][ same");
740 sf_eta_norm->SetLineStyle(1);
741 sf_eta_norm->SetLineWidth(5);
742 sf_eta_norm->SetFillColor(0);
743 sf_eta_norm->Draw(
"][ same");
744 sf_eta_norm->Draw(
"axis same");
746 leg_eta->AddEntry(sf_eta_norm, (tag_ver +
'_' + tag_jet).c_str(),
"l");
747 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f", par_Pt),
"");
750 if (is_2bin ==
true) {
752 sf_pt_up->SetTitle(
"ScaleFactor vs. p_{T}");
753 sf_pt_up->SetXTitle(
"p_{T} [GeV]");
754 sf_pt_up->SetYTitle(
"Scale Factor");
755 sf_pt_up->SetLineStyle(7);
756 sf_pt_up->SetLineWidth(3);
757 sf_pt_up->SetFillColorAlpha(kGray, 0.5);
758 sf_pt_up->SetMaximum(sf_pt_up->GetMaximum() * 1.25);
759 sf_pt_up->SetMinimum(0.);
760 sf_pt_up->Draw(
"][");
762 sf_pt_down->SetLineStyle(7);
763 sf_pt_down->SetLineWidth(3);
764 sf_pt_down->SetFillColorAlpha(kWhite, 1);
765 sf_pt_down->Draw(
"][ same");
767 sf_pt_norm->SetLineStyle(1);
768 sf_pt_norm->SetLineWidth(5);
769 sf_pt_norm->SetFillColor(0);
770 sf_pt_norm->Draw(
"][ same");
771 sf_pt_norm->Draw(
"axis same");
773 leg_pt->AddEntry(sf_pt_norm, (tag_ver +
'_' + tag_jet).c_str(),
"l");
774 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f", par_Eta),
"");
778 canvas.SaveAs(m_imageFileName.c_str());
796 double par_Pt = 100.;
800 auto ip = paramValues.find(
"Jet_Pt");
801 if (ip != paramValues.end()) {
802 par_Pt = std::stod(ip->second);
804 ip = paramValues.find(
"Jet_Eta");
805 if (ip != paramValues.end()) {
806 par_Eta = std::stod(ip->second);
814 TLegend* leg_eta =
new TLegend(0.26, 0.73, 0.935, 0.90);
815 TLegend* leg_pt =
new TLegend(0.26, 0.73, 0.935, 0.90);
817 leg_eta->SetBorderSize(0);
818 leg_eta->SetLineStyle(0);
819 leg_eta->SetFillStyle(0);
821 leg_eta->SetTextFont(42);
822 leg_pt->SetBorderSize(0);
823 leg_pt->SetLineStyle(0);
824 leg_pt->SetFillStyle(0);
826 auto tag1 = PlotBase::getTag<0>();
827 auto iov1 = tag1.iovs.front();
828 std::shared_ptr<JetResolutionObject> payload1 = fetchPayload(std::get<1>(iov1));
830 auto tag2 = PlotBase::getTag<1>();
831 auto iov2 = tag2.iovs.front();
832 std::shared_ptr<JetResolutionObject> payload2 = fetchPayload(std::get<1>(iov2));
834 std::stringstream ss_tagname1(tag1.name);
835 std::stringstream ss_tagname2(tag2.name);
841 getline(ss_tagname1, stmp,
'_');
842 getline(ss_tagname1, stmp);
845 getline(ss_tagname2, stmp,
'_');
846 getline(ss_tagname2, stmp);
849 bool is_2bin =
false;
851 if (payload1.get() && payload2.get()) {
852 if (!payload1->getRecords().empty() &&
853 payload1->getDefinition().getFormulaString().compare(
"") != 0)
866 if (rcd_p1 ==
nullptr || rcd_p2 ==
nullptr) {
893 if (rcd_p1 ==
nullptr || rcd_p2 ==
nullptr) {
908 gStyle->SetOptStat(0);
909 gStyle->SetLabelFont(42,
"XYZ");
910 gStyle->SetLabelSize(0.05,
"XYZ");
911 gStyle->SetFrameLineWidth(3);
914 TCanvas
canvas(
"Jet ScaleFactor",
title.c_str(), 800, 1200);
918 sf_eta_one->SetTitle(
"Jet ScaleFactor Comparison vs. #eta");
919 sf_eta_one->SetXTitle(
"#eta");
920 sf_eta_one->SetYTitle(
"Scale Factor");
921 sf_eta_one->SetLineWidth(3);
922 sf_eta_one->SetMaximum(sf_eta_one->GetMaximum() * 1.25);
923 sf_eta_one->SetMinimum(0.);
924 sf_eta_one->Draw(
"][");
926 sf_eta_two->SetLineColor(2);
927 sf_eta_two->SetLineWidth(3);
928 sf_eta_two->SetLineStyle(2);
929 sf_eta_two->Draw(
"][ same");
931 leg_eta->AddEntry(sf_eta_one, tag_ver1.c_str(),
"l");
932 leg_eta->AddEntry(sf_eta_two, tag_ver2.c_str(),
"l");
933 leg_eta->AddEntry((TObject*)
nullptr, Form(
"JetPt=%.2f", par_Pt),
"");
936 if (is_2bin ==
true) {
938 sf_pt_one->SetTitle(
"Jet ScaleFactor Comparison vs. p_{T}");
939 sf_pt_one->SetXTitle(
"p_{T} [GeV]");
940 sf_pt_one->SetYTitle(
"Scale Factor");
941 sf_pt_one->SetLineWidth(3);
942 sf_pt_one->SetMaximum(sf_pt_one->GetMaximum() * 1.25);
943 sf_pt_one->SetMinimum(0.);
944 sf_pt_one->Draw(
"][");
946 sf_pt_two->SetLineColor(2);
947 sf_pt_two->SetLineWidth(3);
948 sf_pt_two->SetLineStyle(2);
949 sf_pt_two->Draw(
"][ same");
951 leg_pt->AddEntry(sf_pt_one, tag_ver1.c_str(),
"l");
952 leg_pt->AddEntry(sf_pt_two, tag_ver2.c_str(),
"l");
953 leg_pt->AddEntry((TObject*)
nullptr, Form(
"JetEta=%.2f", par_Eta),
"");
957 canvas.SaveAs(m_imageFileName.c_str());
const std::vector< Range > & getBinsRange() const
JetParameters & setJetEta(float eta)
JetParameters & setRho(float rho)
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::vector< float > & getParametersValues() const
const std::map< std::string, std::string > & inputParamValues() const
void addInputParam(const std::string ¶mName)
JetScaleFactorVsPt< UP > JetScaleFactorVsPtUP
JetParameters & setJetPt(float pt)
JetScaleFactorVsEta< DOWN > JetScaleFactorVsEtaDOWN