{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction\n", "\n", "QA plots for the single particle in calorimeters and reconstructed as calorimetric jet objects" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:44.771645Z", "iopub.status.busy": "2025-03-24T22:25:44.770936Z", "iopub.status.idle": "2025-03-24T22:25:44.776873Z", "shell.execute_reply": "2025-03-24T22:25:44.775780Z" } }, "outputs": [], "source": [ "# imports to write dynamic markdown contents\n", "import os\n", "from IPython.display import display, Markdown, Latex\n", "from IPython.display import HTML" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:44.780763Z", "iopub.status.busy": "2025-03-24T22:25:44.779970Z", "iopub.status.idle": "2025-03-24T22:25:44.793731Z", "shell.execute_reply": "2025-03-24T22:25:44.792699Z" } }, "outputs": [ { "data": { "text/markdown": [ "*For the result HTML page:* " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# turn off/on code for the result HTML page\n", "\n", "display(Markdown('*For the result HTML page:* '))\n", " \n", "HTML('''\n", "
''')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:44.837490Z", "iopub.status.busy": "2025-03-24T22:25:44.836826Z", "iopub.status.idle": "2025-03-24T22:25:53.732320Z", "shell.execute_reply": "2025-03-24T22:25:53.730474Z" } }, "outputs": [ { "data": { "text/markdown": [ "pyROOT env check:" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "via sPHENIX software distribution at `/var/lib/jenkins/workspace/sPHENIX/Build-Master-gcc14/build/new/install.1`" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# initialization\n", "\n", "display(Markdown('pyROOT env check:'))\n", "\n", "import ROOT\n", "\n", "OFFLINE_MAIN = os.getenv(\"OFFLINE_MAIN\")\n", "if OFFLINE_MAIN is not None:\n", " display(Markdown(f\"via sPHENIX software distribution at `{OFFLINE_MAIN}`\"))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:53.736300Z", "iopub.status.busy": "2025-03-24T22:25:53.735977Z", "iopub.status.idle": "2025-03-24T22:25:53.863563Z", "shell.execute_reply": "2025-03-24T22:25:53.862314Z" } }, "outputs": [ { "data": { "text/markdown": [ "View the source code repository at https://github.com/sPHENIX-Collaboration/QA-gallery.git" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import subprocess\n", "\n", "try:\n", " git_url = \\\n", " subprocess.run(['git','remote','get-url','origin'], stdout=subprocess.PIPE)\\\n", " .stdout.decode('utf-8').strip()\\\n", " .replace('git@github.com:','https://github.com/')\n", "\n", " display(Markdown(f\"View the source code repository at {git_url}\"))\n", "except: # catch *all* exceptions\n", " # well do nothing\n", " pass\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:53.867579Z", "iopub.status.busy": "2025-03-24T22:25:53.867164Z", "iopub.status.idle": "2025-03-24T22:25:53.990312Z", "shell.execute_reply": "2025-03-24T22:25:53.989370Z" } }, "outputs": [ { "data": { "text/markdown": [ "Some further details about the QA run, if executed under the Jenkins CI:" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "* The commit being checked is sPHENIX-Collaboration/coresoftware/a31efaeddc6c0746d9d331f2948fb8ec821d73ac" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "* Link to the pull request: https://github.com/sPHENIX-Collaboration/coresoftware/pull/3493" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "* Link to the build: https://web.sdcc.bnl.gov/jenkins-sphenix/job/sPHENIX/job/test-calo-single-qa/8112/" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "* Download the QA ROOT files: https://web.sdcc.bnl.gov/jenkins-sphenix/job/sPHENIX/job/test-calo-single-qa/8112/display/redirect?page=artifacts" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "Automatically generated by [sPHENIX Jenkins continuous integration](https://web.sdcc.bnl.gov/jenkins-sphenix/) [![sPHENIX](https://raw.githubusercontent.com/sPHENIX-Collaboration/utilities/master/jenkins/material/sphenix-logo-white-bg-72p.png)](https://www.sphenix.bnl.gov/web/)             [![jenkins.io](https://raw.githubusercontent.com/sPHENIX-Collaboration/utilities/master/jenkins/material/jenkins_logo_title-72p.png)](https://jenkins.io/)" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "display(Markdown('Some further details about the QA run, if executed under the Jenkins CI:'))\n", "\n", "checkrun_repo_commit = os.getenv(\"checkrun_repo_commit\")\n", "if checkrun_repo_commit is not None:\n", " display(Markdown(f\"* The commit being checked is {checkrun_repo_commit}\"))\n", " \n", "ghprbPullLink = os.getenv(\"ghprbPullLink\")\n", "if ghprbPullLink is not None:\n", " display(Markdown(f\"* Link to the pull request: {ghprbPullLink}\"))\n", "\n", "BUILD_URL = os.getenv(\"BUILD_URL\")\n", "if BUILD_URL is not None:\n", " display(Markdown(f\"* Link to the build: {BUILD_URL}\"))\n", "\n", "RUN_ARTIFACTS_DISPLAY_URL = os.getenv(\"RUN_ARTIFACTS_DISPLAY_URL\")\n", "if RUN_ARTIFACTS_DISPLAY_URL is not None:\n", " display(Markdown(f\"* Download the QA ROOT files: {RUN_ARTIFACTS_DISPLAY_URL}\"))\n", "\n", "JENKINS_URL = os.getenv(\"JENKINS_URL\")\n", "if JENKINS_URL is not None:\n", " display(Markdown(f\"Automatically generated by [sPHENIX Jenkins continuous integration]({JENKINS_URL}) [![sPHENIX](https://raw.githubusercontent.com/sPHENIX-Collaboration/utilities/master/jenkins/material/sphenix-logo-white-bg-72p.png)](https://www.sphenix.bnl.gov/web/)             [![jenkins.io](https://raw.githubusercontent.com/sPHENIX-Collaboration/utilities/master/jenkins/material/jenkins_logo_title-72p.png)](https://jenkins.io/)\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Initialization" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:53.994056Z", "iopub.status.busy": "2025-03-24T22:25:53.993678Z", "iopub.status.idle": "2025-03-24T22:25:54.601348Z", "shell.execute_reply": "2025-03-24T22:25:54.600080Z" }, "scrolled": true }, "outputs": [], "source": [ "%%cpp -d\n", "\n", "#include \"QA_Draw_Utility.C\"\n", "\n", "#include \n", "\n", "#include \n", "#include \n", "#include \n", "#include \n", "#include \n", "#include " ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:54.605347Z", "iopub.status.busy": "2025-03-24T22:25:54.604957Z", "iopub.status.idle": "2025-03-24T22:25:55.481699Z", "shell.execute_reply": "2025-03-24T22:25:55.480438Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "sPhenixStyle: Applying nominal settings.\n", "sPhenixStyle: ROOT6 mode\n" ] } ], "source": [ "%%cpp\n", "\n", "SetsPhenixStyle();\n", "TVirtualFitter::SetDefaultFitter(\"Minuit2\");\n", "\n", "// test sPHENIX lib load\n", "// gSystem->Load(\"libg4eval.so\");\n", "\n", "// test libs\n", "// gSystem->ListLibraries();" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:55.485298Z", "iopub.status.busy": "2025-03-24T22:25:55.485075Z", "iopub.status.idle": "2025-03-24T22:25:55.633191Z", "shell.execute_reply": "2025-03-24T22:25:55.632091Z" } }, "outputs": [], "source": [ "%jsroot on" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Inputs and file checks" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:55.637510Z", "iopub.status.busy": "2025-03-24T22:25:55.637153Z", "iopub.status.idle": "2025-03-24T22:25:55.748347Z", "shell.execute_reply": "2025-03-24T22:25:55.747158Z" } }, "outputs": [], "source": [ "\n", "qa_file_name_new = os.getenv(\"qa_file_name_new\")\n", "if qa_file_name_new is None:\n", " qa_file_name_new = \"G4sPHENIX_pi+_pT30_Sum15_qa.root\"\n", " display(Markdown(f\"`qa_file_name_new` env not set. use the default `qa_file_name_new={qa_file_name_new}`\"))\n", "\n", "qa_file_name_ref = os.getenv(\"qa_file_name_ref\")\n", "if qa_file_name_ref is None:\n", " qa_file_name_ref = \"reference/G4sPHENIX_pi+_pT30_Sum15_qa.root\"\n", " display(Markdown(f\"`qa_file_name_ref` env not set. use the default `qa_file_name_ref={qa_file_name_ref}`\"))\n", "elif qa_file_name_ref == 'None':\n", " qa_file_name_ref = None\n", " display(Markdown(f\"`qa_file_name_ref` = None and we are set to not to use the reference histograms\"))\n", " \n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:55.752208Z", "iopub.status.busy": "2025-03-24T22:25:55.751334Z", "iopub.status.idle": "2025-03-24T22:25:55.933702Z", "shell.execute_reply": "2025-03-24T22:25:55.932513Z" } }, "outputs": [ { "data": { "text/markdown": [ "Openning QA file at `G4sPHENIX_e-_pT4_Sum10_qa.root`" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "Openning QA reference file at `reference/G4sPHENIX_e-_pT4_Sum10_qa.root`" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# qa_file_new = ROOT.TFile.Open(qa_file_name_new);\n", "\n", "# assert qa_file_new.IsOpen()\n", "# qa_file_new.ls()\n", "display(Markdown(f\"Openning QA file at `{qa_file_name_new}`\"))\n", "ROOT.gInterpreter.ProcessLine(f\"TFile *qa_file_new = new TFile(\\\"{qa_file_name_new}\\\");\")\n", "ROOT.gInterpreter.ProcessLine(f\"const char * qa_file_name_new = \\\"{qa_file_name_new}\\\";\")\n", "\n", "if qa_file_name_ref is not None:\n", "# qa_file_ref = ROOT.TFile.Open(qa_file_name_ref);\n", "\n", "# assert qa_file_ref.IsOpen()\n", " display(Markdown(f\"Openning QA reference file at `{qa_file_name_ref}`\"))\n", " ROOT.gInterpreter.ProcessLine(f\"TFile *qa_file_ref = new TFile(\\\"{qa_file_name_ref}\\\");\")\n", " ROOT.gInterpreter.ProcessLine(f\"const char * qa_file_name_ref = \\\"{qa_file_name_ref}\\\";\")\n", "else:\n", " ROOT.gInterpreter.ProcessLine(f\"TFile *qa_file_ref = nullptr;\")\n", " ROOT.gInterpreter.ProcessLine(f\"const char * qa_file_name_ref = nullptr;\")\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:55.937645Z", "iopub.status.busy": "2025-03-24T22:25:55.937427Z", "iopub.status.idle": "2025-03-24T22:25:56.061306Z", "shell.execute_reply": "2025-03-24T22:25:56.060032Z" }, "scrolled": true }, "outputs": [], "source": [ "%%cpp\n", "\n", "if (qa_file_new == nullptr) \n", "{\n", " cout <<\"Error, can not open QA root file\"<ls();\n", "\n", "//TFile *qa_file_ref = NULL;\n", "//if (qa_file_name_ref)\n", "//{\n", "// qa_file_ref = new TFile(qa_file_name_ref);\n", "// \n", "// if (qa_file_ref == nullptr) \n", "// {\n", "// cout <<\"Error, can not open QA root file\"<GetObjectChecked(\n", " TString(jet) + TString(\"_Normalization\"), \"TH1D\");\n", " assert(h_norm);\n", "\n", " Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(\"Event\"));\n", " }\n", " if (qa_file_ref)\n", " {\n", " TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Normalization\"), \"TH1D\");\n", " assert(h_norm);\n", "\n", " Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(\"Event\"));\n", " }\n", "\n", " TCanvas *c1 = new TCanvas(TString(\"QA_Draw_Jet_Spectrum_\") + TString(jet),\n", " TString(\"QA_Draw_Jet_Spectrum_\") + TString(jet), 950, 600);\n", " c1->Divide(4, 2);\n", " int idx = 1;\n", " TPad *p;\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_eta\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_eta\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_phi\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_phi\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_Et\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_Et\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_Mass\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_Mass\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogx();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_CompSize\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_CompSize\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_CEMC_Ratio\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_CEMC_Ratio\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_CEMC_HCalIN_Ratio\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_CEMC_HCalIN_Ratio\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", "\n", " if (TString(jet).Contains(\"Truth\"))\n", " {\n", " // truth jets\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " p->SetLogy();\n", "\n", " {\n", " TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_Leakage_Ratio\"), \"TH1F\");\n", " assert(h_new);\n", "\n", " h_new->Rebin(2);\n", " // h_new->Sumw2();\n", " h_new->Scale(1. / Nevent_new);\n", "\n", " TH1F *h_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " h_ref = (TH1F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + TString(\"_Leading_Leakage_Ratio\"), \"TH1F\");\n", " assert(h_ref);\n", "\n", " h_ref->Rebin(2);\n", " h_ref->Scale(1. / Nevent_ref);\n", " }\n", "\n", " h_new->GetYaxis()->SetTitleOffset(1.5);\n", " h_new->GetYaxis()->SetTitle(\"Count / event / bin\");\n", " // h_new->GetXaxis()->SetRangeUser(-0, .1);\n", "\n", " DrawReference(h_new, h_ref);\n", " }\n", " }\n", "\n", "// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref);\n", " c1->Draw();\n", " \n", " // SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), false);\n", " \n", "}\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# $R=0.7$ Jets spectrums\n", "\n", "Check the particular set of jets with $R=0.7$ parameters" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Truth jet spectrum\n", "\n", "Jet the details of the truth jet. Since only one particle is used in this simulation, the number of component is 1 and jet mass is 0." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:56.225854Z", "iopub.status.busy": "2025-03-24T22:25:56.225506Z", "iopub.status.idle": "2025-03-24T22:25:56.608525Z", "shell.execute_reply": "2025-03-24T22:25:56.607430Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%cpp\n", "\n", "QA_Draw_Jet_Spectrum(\"h_QAG4SimJet_AntiKt_Truth_r07\");\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reco tower jet spectrum\n", "\n", "Jet the details of the reco tower jet in response to this single particle" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:56.614337Z", "iopub.status.busy": "2025-03-24T22:25:56.613852Z", "iopub.status.idle": "2025-03-24T22:25:56.764619Z", "shell.execute_reply": "2025-03-24T22:25:56.763368Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%cpp\n", "\n", "QA_Draw_Jet_Spectrum(\"h_QAG4SimJet_AntiKt_Tower_r07\");\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Jet-Truth matching\n", "\n", "Bunch of plots matching reco jet to truth jet" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:56.768928Z", "iopub.status.busy": "2025-03-24T22:25:56.768251Z", "iopub.status.idle": "2025-03-24T22:25:56.886647Z", "shell.execute_reply": "2025-03-24T22:25:56.885418Z" } }, "outputs": [], "source": [ "%%cpp\n", "\n", "//! jet family, tower, cluster or track jets \n", "const char *jet_family = \"AntiKt_Tower\";\n", "\n", "//! drawing energy range\n", "const double min_Et = 10;\n", "const double max_Et = 80;\n" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:56.891095Z", "iopub.status.busy": "2025-03-24T22:25:56.890445Z", "iopub.status.idle": "2025-03-24T22:25:57.115533Z", "shell.execute_reply": "2025-03-24T22:25:57.114419Z" } }, "outputs": [], "source": [ "%%cpp -d\n", "\n", "// utility of drawing a matching pair\n", "\n", "vector\n", "QA_Draw_Jet_TruthMatching(const char *jet =\n", " \"h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07\")\n", "{\n", "\n", " vector resolution_collections;\n", "\n", " TCanvas *c1 = new TCanvas(\n", " TString(\"QA_Draw_Jet_TruthMatching_\") + TString(jet),\n", " TString(\"QA_Draw_Jet_TruthMatching_\") + TString(jet), 950, 600);\n", " c1->Divide(3, 2);\n", " int idx = 1;\n", " TPad *p;\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " {\n", " TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + \"_Matching_dPhi\", \"TH2F\");\n", "\n", " assert(proj_new);\n", "\n", " proj_new->Rebin2D(1, 5);\n", "\n", " TGraphErrors *ge = FitProfile(proj_new);\n", "\n", " proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et);\n", " proj_new->GetYaxis()->SetTitleOffset(1.5);\n", " proj_new->Draw(\"COLZ\");\n", "\n", " TGraphErrors *ge_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + \"_Matching_dPhi\", \"TH2F\");\n", " assert(proj_ref);\n", " proj_ref->Rebin2D(1, 5);\n", " TGraphErrors *ge_ref = FitProfile(proj_ref);\n", " }\n", " DrawReference(ge, ge_ref);\n", "\n", " resolution_collections.push_back(ge);\n", " }\n", " TLine *l = new TLine(min_Et, 0, max_Et, 00);\n", " l->Draw();\n", " \n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " {\n", " TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + \"_Matching_dEta\", \"TH2F\");\n", "\n", " assert(proj_new);\n", "\n", " proj_new->Rebin2D(1, 5);\n", " TGraphErrors *ge = FitProfile(proj_new);\n", "\n", " proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et);\n", " proj_new->GetYaxis()->SetTitleOffset(1.5);\n", " proj_new->Draw(\"COLZ\");\n", " proj_new->SetTitle(jet);\n", "\n", " TGraphErrors *ge_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + \"_Matching_dEta\", \"TH2F\");\n", " assert(proj_ref);\n", " proj_ref->Rebin2D(1, 5);\n", " TGraphErrors *ge_ref = FitProfile(proj_ref);\n", " }\n", " DrawReference(ge, ge_ref);\n", "\n", " resolution_collections.push_back(ge);\n", " }\n", " l = new TLine(min_Et, 0, max_Et, 00);\n", " l->Draw();\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " {\n", " TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + \"_Matching_dE\", \"TH2F\");\n", "\n", " assert(proj_new);\n", "\n", " // proj_new->Rebin2D(1,5);\n", "\n", " TGraphErrors *ge = FitProfile(proj_new);\n", "\n", " proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et);\n", " proj_new->GetYaxis()->SetTitleOffset(1.5);\n", " proj_new->Draw(\"COLZ\");\n", " proj_new->SetTitle(jet);\n", "\n", " TGraphErrors *ge_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + \"_Matching_dE\", \"TH2F\");\n", " assert(proj_ref);\n", " proj_ref->Rebin2D(1, 5);\n", " TGraphErrors *ge_ref = FitProfile(proj_ref);\n", " }\n", " DrawReference(ge, ge_ref);\n", "\n", " resolution_collections.push_back(ge);\n", " }\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " {\n", " TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + \"_Matching_dEt\", \"TH2F\");\n", "\n", " assert(proj_new);\n", "\n", " // proj_new->Rebin2D(1,5);\n", " TGraphErrors *ge = FitProfile(proj_new);\n", "\n", " proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et);\n", " proj_new->GetYaxis()->SetTitleOffset(1.5);\n", " proj_new->Draw(\"COLZ\");\n", " proj_new->SetTitle(jet);\n", "\n", " TGraphErrors *ge_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + \"_Matching_dEt\", \"TH2F\");\n", " assert(proj_ref);\n", " proj_ref->Rebin2D(1, 5);\n", " TGraphErrors *ge_ref = FitProfile(proj_ref);\n", " }\n", " DrawReference(ge, ge_ref);\n", "\n", " resolution_collections.push_back(ge);\n", " }\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " {\n", " TH2F *h2 = (TH2F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + \"_Matching_Count_Truth_Et\", \"TH2F\");\n", " assert(h2);\n", "\n", " TH1 *h_norm = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Truth_Et\" + \"_All\", 1, 1);\n", " // TH1 * h_pass = h2->ProjectionX(\n", " // TString(jet) + \"_Matching_Count_Truth_Et\" + \"_Matched\", 2, 2);// inclusive match\n", " TH1 *h_pass = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Truth_Et\" + \"_Matched\", 3, 3); // unique match\n", " assert(h_norm);\n", " assert(h_pass);\n", " TH1 *h_ratio = GetBinominalRatio(h_pass, h_norm);\n", "\n", " h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et);\n", " h_ratio->GetYaxis()->SetTitle(\"Reco efficiency\");\n", " h_ratio->GetYaxis()->SetRangeUser(-0, 1.2);\n", "\n", " TH1 *h_ratio_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " TH2F *h2 = (TH2F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + \"_Matching_Count_Truth_Et\", \"TH2F\");\n", " assert(h2);\n", " TH1 *h_norm = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Truth_Et\" + \"_All\", 1, 1);\n", " // TH1 * h_pass = h2->ProjectionX(\n", " // TString(jet) + \"_Matching_Count_Truth_Et\" + \"_Matched\", 2, 2);// inclusive match\n", " TH1 *h_pass = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Truth_Et\" + \"_Matched\", 3, 3); // unique match\n", " assert(h_norm);\n", " assert(h_pass);\n", " h_ratio_ref = GetBinominalRatio(h_pass, h_norm);\n", " }\n", "\n", " DrawReference(h_ratio, h_ratio_ref, true);\n", "\n", " resolution_collections.push_back(new TGraphErrors(h_ratio));\n", " }\n", "\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", "\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " {\n", " TH2F *h2 = (TH2F *) qa_file_new->GetObjectChecked(\n", " TString(jet) + \"_Matching_Count_Reco_Et\", \"TH2F\");\n", " assert(h2);\n", "\n", " TH1 *h_norm = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Reco_Et\" + \"_All\", 1, 1);\n", " // TH1 * h_pass = h2->ProjectionX(\n", " // TString(jet) + \"_Matching_Count_Reco_Et\" + \"_Matched\", 2, 2); // inclusive match\n", " TH1 *h_pass = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Reco_Et\" + \"_Matched\", 3, 3); // unique match\n", " assert(h_norm);\n", " assert(h_pass);\n", " TH1 *h_ratio = GetBinominalRatio(h_pass, h_norm);\n", "\n", " h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et);\n", " h_ratio->GetYaxis()->SetTitle(\"Reconstruction Purity\");\n", " h_ratio->GetYaxis()->SetRangeUser(-0, 1.2);\n", "\n", " TH1 *h_ratio_ref = NULL;\n", " if (qa_file_ref)\n", " {\n", " TH2F *h2 = (TH2F *) qa_file_ref->GetObjectChecked(\n", " TString(jet) + \"_Matching_Count_Reco_Et\", \"TH2F\");\n", " assert(h2);\n", "\n", " TH1 *h_norm = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Reco_Et\" + \"_All\", 1, 1);\n", " // TH1 * h_pass = h2->ProjectionX(\n", " // TString(jet) + \"_Matching_Count_Reco_Et\" + \"_Matched\", 2, 2); // inclusive match\n", " TH1 *h_pass = h2->ProjectionX(\n", " TString(jet) + \"_Matching_Count_Reco_Et\" + \"_Matched\", 3, 3); // unique match\n", " assert(h_norm);\n", " assert(h_pass);\n", " h_ratio_ref = GetBinominalRatio(h_pass, h_norm);\n", " }\n", "\n", " DrawReference(h_ratio, h_ratio_ref, true);\n", "\n", " resolution_collections.push_back(new TGraphErrors(h_ratio));\n", " }\n", "\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", "\n", "// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref);\n", " c1->Draw();\n", " //SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), false);\n", " \n", " return resolution_collections;\n", "}" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:57.119118Z", "iopub.status.busy": "2025-03-24T22:25:57.118749Z", "iopub.status.idle": "2025-03-24T22:25:57.235022Z", "shell.execute_reply": "2025-03-24T22:25:57.233818Z" } }, "outputs": [], "source": [ "%%cpp\n", "{\n", "// qa_file_new->GetListOfKeys().Print()\n", "// qa_file_new->ls();\n", "// QA_Draw_Jet_TruthMatching(\"h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07\");\n", "\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Kinematic dependent Jet matching plots for various radius" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:57.238984Z", "iopub.status.busy": "2025-03-24T22:25:57.238602Z", "iopub.status.idle": "2025-03-24T22:25:57.702803Z", "shell.execute_reply": "2025-03-24T22:25:57.701597Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Seraching for jet pairs in 419 QA histograms with pattern h_QAG4SimJet_.*_r[0-9]*_AntiKt_Tower_r[0-9]*_Matching_Count_Truth_Et\n", "QA_Draw_Jet_Summary - process jet pair h_QAG4SimJet_AntiKt_Truth_r02_AntiKt_Tower_r02 with radius = 0.2\n", "QA_Draw_Jet_Summary - process jet pair h_QAG4SimJet_AntiKt_Truth_r04_AntiKt_Tower_r04 with radius = 0.4\n", "QA_Draw_Jet_Summary - process jet pair h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07 with radius = 0.7\n" ] }, { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%cpp\n", "\n", "// buffer for results\n", "vector vec_radius;\n", "vector vec_phi_res;\n", "vector vec_eta_res;\n", "vector vec_e_res;\n", "vector vec_et_res;\n", "vector vec_reco_eff;\n", "vector vec_purity;\n", "\n", "{\n", " \n", " // list and process all jets\n", " TList *hist_key_list = qa_file_new->GetListOfKeys();\n", " TString s_re_fullname = Form(\n", " \"h_QAG4SimJet_.*_r[0-9]*_%s_r[0-9]*_Matching_Count_Truth_Et\",\n", " jet_family); // regular expression for search\n", " TRegexp re_fullname(s_re_fullname, false);\n", " \n", " cout <<\"Seraching for jet pairs in \"<GetSize()<<\" QA histograms with pattern \"<GetSize(); ++i)\n", " {\n", " TString key_name = hist_key_list->At(i)->GetName();\n", "\n", " if (key_name.Index(re_fullname) == kNPOS)\n", " continue;\n", "\n", " // cout << \" key_name = \" << key_name << endl;\n", " TString jet_pair_name = key_name(0,\n", " key_name.Length() - TString(\"_Matching_Count_Truth_Et\").Length()); // remove suffix\n", "\n", " // cout << \"Processing jet_pair_name = \" << jet_pair_name << endl;\n", "\n", " //get jet radius\n", " TRegexp re_jetradius(\"_r[0-9]*\", false);\n", " Ssiz_t index_radius = key_name.Index(re_jetradius); // first radius\n", " index_radius = key_name.Index(re_jetradius, index_radius + 1); // second radius\n", " assert(index_radius != kNPOS);\n", " float radius = 0;\n", " sscanf(key_name(index_radius, 100).Data(), \"_r%f\", &radius);\n", " // cout << \" index_radius = \" << index_radius << endl;\n", " assert(radius != 0);\n", " radius /= 10; // jet radius convention in DST names\n", "\n", " cout << \"QA_Draw_Jet_Summary - process jet pair \" << jet_pair_name\n", " << \" with radius = \" << radius << endl;\n", "\n", " vector resolution_efficiency_summary(\n", " QA_Draw_Jet_TruthMatching(jet_pair_name));\n", "\n", " //save results\n", " vec_radius.push_back(radius);\n", " vec_phi_res.push_back(resolution_efficiency_summary[0]);\n", " vec_eta_res.push_back(resolution_efficiency_summary[1]);\n", " vec_e_res.push_back(resolution_efficiency_summary[2]);\n", " vec_et_res.push_back(resolution_efficiency_summary[3]);\n", " vec_reco_eff.push_back(resolution_efficiency_summary[4]);\n", " vec_purity.push_back(resolution_efficiency_summary[5]);\n", "\n", " }\n", " \n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Summary plot as function of jet parameter" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:57.706531Z", "iopub.status.busy": "2025-03-24T22:25:57.706239Z", "iopub.status.idle": "2025-03-24T22:25:57.923924Z", "shell.execute_reply": "2025-03-24T22:25:57.922717Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%cpp\n", "\n", "{\n", " \n", " // plot\n", " TCanvas *c1 = new TCanvas(\n", " TString(\"QA_Draw_Jet_Summary_\") + TString(jet_family),\n", " TString(\"QA_Draw_Jet_Summary_\") + TString(jet_family), 950, 600);\n", " c1->Divide(3, 2);\n", " int idx = 1;\n", " TPad *p;\n", "\n", " // ------------------------------------\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " TH1 *h_frame =\n", " p->DrawFrame(min_Et, -.1, max_Et, .1,\n", " TString(jet_family) + \" #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)\");\n", " // h_frame->GetYaxis()->SetTitleOffset(1.01);\n", " TLine *l = new TLine(min_Et, 0, max_Et, 0);\n", " l->Draw();\n", " p->SetGridx(0);\n", " p->SetGridy(0);\n", " TLegend *legend = new TLegend(0.7, 0.2, .95, 0.5);\n", " legend->SetFillColor(kWhite);\n", " legend->SetFillStyle(1001);\n", " legend->SetLineWidth(2);\n", " legend->SetLineColor(kBlack);\n", " legend->SetLineStyle(kSolid);\n", " for (int i = 0; i < vec_radius.size(); ++i)\n", " {\n", " const float radius = vec_radius[i];\n", "\n", " TGraphErrors *ge = vec_phi_res[i];\n", " assert(ge);\n", " ge = new TGraphErrors(*ge); // make a copy\n", "\n", " ge->SetLineColor(i + 2); // automatic color scheme from ROOT\n", " ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT\n", " for (int idata = 0; idata < ge->GetN(); ++idata)\n", " {\n", " (ge->GetX())[idata] += i * 0.5; // shift x a little bit\n", " (ge->GetEX())[idata] = 0; // no x error bar\n", " }\n", " ge->Draw(\"p E l\");\n", " legend->AddEntry(ge, Form(\"r = %.1f\", radius), \"elp\");\n", " }\n", " legend->Draw();\n", "\n", " // ------------------------------------\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " h_frame =\n", " p->DrawFrame(min_Et, -.1, max_Et, .1,\n", " TString(jet_family) + \" #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}\");\n", " // h_frame->GetYaxis()->SetTitleOffset(1.01);\n", " l = new TLine(min_Et, 0, max_Et, 0);\n", " l->Draw();\n", " p->SetGridx(0);\n", " p->SetGridy(0);\n", " legend = new TLegend(0.7, 0.2, .95, 0.5);\n", " legend->SetFillColor(kWhite);\n", " legend->SetFillStyle(1001);\n", " legend->SetLineWidth(2);\n", " legend->SetLineColor(kBlack);\n", " legend->SetLineStyle(kSolid);\n", " for (int i = 0; i < vec_radius.size(); ++i)\n", " {\n", " const float radius = vec_radius[i];\n", "\n", " TGraphErrors *ge = vec_eta_res[i];\n", " assert(ge);\n", " ge = new TGraphErrors(*ge); // make a copy\n", "\n", " ge->SetLineColor(i + 2); // automatic color scheme from ROOT\n", " ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT\n", " for (int idata = 0; idata < ge->GetN(); ++idata)\n", " {\n", " (ge->GetX())[idata] += i * 0.5; // shift x a little bit\n", " (ge->GetEX())[idata] = 0; // no x error bar\n", " }\n", " ge->Draw(\"p E l\");\n", " legend->AddEntry(ge, Form(\"r = %.1f\", radius), \"elp\");\n", " }\n", " legend->Draw();\n", "\n", " // ------------------------------------\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " h_frame = p->DrawFrame(min_Et, 0, max_Et, 2,\n", " TString(jet_family) + \" Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}\");\n", " // h_frame->GetYaxis()->SetTitleOffset(1.01);\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", " p->SetGridx(0);\n", " p->SetGridy(0);\n", " legend = new TLegend(0.7, 0.2, .95, 0.5);\n", " legend->SetFillColor(kWhite);\n", " legend->SetFillStyle(1001);\n", " legend->SetLineWidth(2);\n", " legend->SetLineColor(kBlack);\n", " legend->SetLineStyle(kSolid);\n", " for (int i = 0; i < vec_radius.size(); ++i)\n", " {\n", " const float radius = vec_radius[i];\n", "\n", " TGraphErrors *ge = vec_e_res[i];\n", " assert(ge);\n", " ge = new TGraphErrors(*ge); // make a copy\n", "\n", " ge->SetLineColor(i + 2); // automatic color scheme from ROOT\n", " ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT\n", " for (int idata = 0; idata < ge->GetN(); ++idata)\n", " {\n", " (ge->GetX())[idata] += i * 0.5; // shift x a little bit\n", " (ge->GetEX())[idata] = 0; // no x error bar\n", " }\n", " ge->Draw(\"p E l\");\n", " legend->AddEntry(ge, Form(\"r = %.1f\", radius), \"elp\");\n", " }\n", " legend->Draw();\n", "\n", " // ------------------------------------\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " h_frame =\n", " p->DrawFrame(min_Et, 0, max_Et, 2,\n", " TString(jet_family) + \" Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}\");\n", " // h_frame->GetYaxis()->SetTitleOffset(1.01);\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", " p->SetGridx(0);\n", " p->SetGridy(0);\n", " legend = new TLegend(0.7, 0.2, .95, 0.5);\n", " legend->SetFillColor(kWhite);\n", " legend->SetFillStyle(1001);\n", " legend->SetLineWidth(2);\n", " legend->SetLineColor(kBlack);\n", " legend->SetLineStyle(kSolid);\n", " for (int i = 0; i < vec_radius.size(); ++i)\n", " {\n", " const float radius = vec_radius[i];\n", "\n", " TGraphErrors *ge = vec_et_res[i];\n", " assert(ge);\n", " ge = new TGraphErrors(*ge); // make a copy\n", "\n", " ge->SetLineColor(i + 2); // automatic color scheme from ROOT\n", " ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT\n", " for (int idata = 0; idata < ge->GetN(); ++idata)\n", " {\n", " (ge->GetX())[idata] += i * 0.5; // shift x a little bit\n", " (ge->GetEX())[idata] = 0; // no x error bar\n", " }\n", " ge->Draw(\"p E l\");\n", " legend->AddEntry(ge, Form(\"r = %.1f\", radius), \"elp\");\n", " }\n", " legend->Draw();\n", "\n", " // ------------------------------------\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2,\n", " TString(jet_family) + \" Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency\");\n", " // h_frame->GetYaxis()->SetTitleOffset(1.01);\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", " p->SetGridx(0);\n", " p->SetGridy(0);\n", " legend = new TLegend(0.7, 0.2, .95, 0.5);\n", " legend->SetFillColor(kWhite);\n", " legend->SetFillStyle(1001);\n", " legend->SetLineWidth(2);\n", " legend->SetLineColor(kBlack);\n", " legend->SetLineStyle(kSolid);\n", " for (int i = 0; i < vec_radius.size(); ++i)\n", " {\n", " const float radius = vec_radius[i];\n", "\n", " TGraphErrors *ge = vec_reco_eff[i];\n", " assert(ge);\n", " ge = new TGraphErrors(*ge); // make a copy\n", "\n", " ge->SetLineColor(i + 2); // automatic color scheme from ROOT\n", " ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT\n", " for (int idata = 0; idata < ge->GetN(); ++idata)\n", " {\n", " (ge->GetX())[idata] += i * 0.5; // shift x a little bit\n", " (ge->GetEX())[idata] = 0; // no x error bar\n", " }\n", " ge->Draw(\"p E l\");\n", " legend->AddEntry(ge, Form(\"r = %.1f\", radius), \"elp\");\n", " }\n", " legend->Draw();\n", "\n", " // ------------------------------------\n", " p = (TPad *) c1->cd(idx++);\n", " c1->Update();\n", " // p->SetLogz();\n", "\n", " h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2,\n", " TString(jet_family) + \" Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity\");\n", " // h_frame->GetYaxis()->SetTitleOffset(1.01);\n", " l = new TLine(min_Et, 1, max_Et, 1);\n", " l->Draw();\n", " p->SetGridx(0);\n", " p->SetGridy(0);\n", " legend = new TLegend(0.7, 0.2, .95, 0.5);\n", " legend->SetFillColor(kWhite);\n", " legend->SetFillStyle(1001);\n", " legend->SetLineWidth(2);\n", " legend->SetLineColor(kBlack);\n", " legend->SetLineStyle(kSolid);\n", " for (int i = 0; i < vec_radius.size(); ++i)\n", " {\n", " const float radius = vec_radius[i];\n", "\n", " TGraphErrors *ge = vec_purity[i];\n", " assert(ge);\n", " ge = new TGraphErrors(*ge); // make a copy\n", "\n", " ge->SetLineColor(i + 2); // automatic color scheme from ROOT\n", " ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT\n", " for (int idata = 0; idata < ge->GetN(); ++idata)\n", " {\n", " (ge->GetX())[idata] += i * 0.5; // shift x a little bit\n", " (ge->GetEX())[idata] = 0; // no x error bar\n", " }\n", " ge->Draw(\"p E l\");\n", " legend->AddEntry(ge, Form(\"r = %.1f\", radius), \"elp\");\n", " }\n", " legend->Draw();\n", "\n", " // PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref);\n", " c1->Draw();\n", " //SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true);\n", "\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Summary statistics" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:57.928745Z", "iopub.status.busy": "2025-03-24T22:25:57.928248Z", "iopub.status.idle": "2025-03-24T22:25:58.074944Z", "shell.execute_reply": "2025-03-24T22:25:58.073697Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook contains 21 KSTets: combined Chi2/nDoF = 28.6655 / 42, and combined __p-Value = 0.941883__\n" ] } ], "source": [ "%%cpp\n", "\n", "KSTestSummary::getInstance()->make_summary_txt(\"QA-calorimetric-jet.txt\");" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "execution": { "iopub.execute_input": "2025-03-24T22:25:58.077741Z", "iopub.status.busy": "2025-03-24T22:25:58.077079Z", "iopub.status.idle": "2025-03-24T22:25:58.207809Z", "shell.execute_reply": "2025-03-24T22:25:58.206512Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%cpp\n", "\n", "KSTestSummary::getInstance()->make_summary_TCanvas() -> Draw();" ] } ], "metadata": { "kernelspec": { "display_name": "Python (sPHENIX)", "language": "python", "name": "sphenix-env" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" } }, "nbformat": 4, "nbformat_minor": 4 }