diff --git a/TPCQCVis/reports/TPC_AQC_period_template.ipynb b/TPCQCVis/reports/TPC_AQC_period_template.ipynb
index f069ec6..aeefdf6 100644
--- a/TPCQCVis/reports/TPC_AQC_period_template.ipynb
+++ b/TPCQCVis/reports/TPC_AQC_period_template.ipynb
@@ -29,7 +29,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "7afb8d37",
+ "id": "0f0e02f1",
"metadata": {},
"outputs": [],
"source": [
@@ -220,18 +220,6 @@
"+ [2022](https://docs.google.com/spreadsheets/d/14vXFYVx3oVE8wgJKmIBhjvAt6NpGp7D6H4AmBM9E0Cw/edit#gid=0), [2023](https://docs.google.com/spreadsheets/d/1YBQLXWwwc3aC3B_PYVpFkTgEP0n6u1ovtYfiCOMWnTc/edit?pli=1#gid=0), [2023_PbPb](https://docs.google.com/spreadsheets/d/1vsl-pkLdUoNXZm6muPyMENWdDSKM7UDtQLcXc2B9QhE/edit#gid=492527515)"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "69b3818a",
- "metadata": {},
- "outputs": [],
- "source": [
- "import datetime\n",
- "now = datetime.datetime.now()\n",
- "display(Markdown(\"+ Report automatically created on \"+now.strftime(\"%d.%m.%Y at %H:%M:%S\")))"
- ]
- },
{
"cell_type": "markdown",
"id": "897badfe",
@@ -295,7 +283,7 @@
" [qualities,pad] = checkTrending(trend,canvas=pad,thresholds={\"GOOD\":1.5,\"MEDIUM\":3,\"BAD\":6})\n",
" qualityDFClusters[names[iPad]] = qualities\n",
" canvas.Update()\n",
- "#canvas.Draw()"
+ "canvas.Draw()"
]
},
{
@@ -347,7 +335,37 @@
"qualityHistClusters.GetZaxis().SetRangeUser(-0.5,3.5);\n",
"qualityHistClusters.GetZaxis().SetTitle(\"Quality\")\n",
"qualityHistClusters.LabelsOption(\"v\")\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "\n",
+ "data = [] # List to store the row data\n",
+ "\n",
+ "for x in range(1, qualityHistClusters.GetNbinsX() + 1): # x-axis bins\n",
+ " for y in range(1, qualityHistClusters.GetNbinsY() + 1): # y-axis bins\n",
+ " binContent = qualityHistClusters.GetBinContent(x, y)\n",
+ " if binContent > 1.5:\n",
+ " # Getting the labels for x and y axis\n",
+ " xLabel = qualityHistClusters.GetXaxis().GetBinLabel(x)\n",
+ " yLabel = qualityHistClusters.GetYaxis().GetBinLabel(y)\n",
+ "\n",
+ " # Determine the quality status\n",
+ " if 1.5 < binContent <= 2.5:\n",
+ " qualityStatus = \"medium\"\n",
+ " elif binContent > 2.5:\n",
+ " qualityStatus = \"bad\"\n",
+ " else:\n",
+ " continue # Skip if the value is not in the specified range\n",
+ "\n",
+ " # Append the data to the list\n",
+ " data.append({\n",
+ " \"X label\": xLabel,\n",
+ " \"Y label\": yLabel,\n",
+ " \"Quality\": qualityStatus\n",
+ " })\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "clustersquality = pd.DataFrame(data)\n",
+ "\n"
]
},
{
@@ -384,7 +402,9 @@
"cell_type": "code",
"execution_count": null,
"id": "3ac8fbbd",
- "metadata": {},
+ "metadata": {
+ "scrolled": true
+ },
"outputs": [],
"source": [
"canvas = ROOT.TCanvas(\"QualityMatrixTracks\",\"\",1000,500)\n",
@@ -413,7 +433,37 @@
"\n",
"# Update the canvas\n",
"canvas.Update()\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "\n",
+ "data = [] # List to store the row data\n",
+ "\n",
+ "for x in range(1, qualityHist.GetNbinsX() + 1): # x-axis bins\n",
+ " for y in range(1, qualityHist.GetNbinsY() + 1): # y-axis bins\n",
+ " binContent = qualityHist.GetBinContent(x, y)\n",
+ " if binContent > 1.5:\n",
+ " # Getting the labels for x and y axis\n",
+ " xLabel = qualityHist.GetXaxis().GetBinLabel(x)\n",
+ " yLabel = qualityHist.GetYaxis().GetBinLabel(y)\n",
+ "\n",
+ " # Determine the quality status\n",
+ " if 1.5 < binContent <= 2.5:\n",
+ " qualityStatus = \"medium\"\n",
+ " elif binContent > 2.5:\n",
+ " qualityStatus = \"bad\"\n",
+ " else:\n",
+ " continue # Skip if the value is not in the specified range\n",
+ "\n",
+ " # Append the data to the list\n",
+ " data.append({\n",
+ " \"X label\": xLabel,\n",
+ " \"Y label\": yLabel,\n",
+ " \"Quality\": qualityStatus\n",
+ " })\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "tracksquality = pd.DataFrame(data)\n",
+ "\n"
]
},
{
@@ -443,7 +493,19 @@
"[qualities,canvas] = checkTrending(trend,canvas=canvas,thresholds={\"GOOD\":1.5,\"MEDIUM\":3,\"BAD\":6})\n",
"canvas.SetCanvasSize(1000,400)\n",
"qualityDF[objectName] = qualities\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hPhiAsideTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -463,14 +525,30 @@
"[qualities,canvas] = checkTrending(trend,canvas=canvas,thresholds={\"GOOD\":1.5,\"MEDIUM\":3,\"BAD\":6})\n",
"qualityDF[objectName] = qualities\n",
"canvas.SetCanvasSize(1000,400)\n",
- "#trend.SetTitle(\"Number of tracks - Trend\")\n",
- "canvas.Draw()"
+ "trend.SetTitle(\"Number of tracks - Trend\")\n",
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "numberofTracksTrendingQuality = pd.DataFrame(data)"
]
},
{
"cell_type": "markdown",
"id": "e0c37372",
- "metadata": {},
+ "metadata": {
+ "slideshow": {
+ "slide_type": "fragment"
+ }
+ },
"source": [
"### Mean eta of tracks"
]
@@ -493,7 +571,19 @@
"qualityDF[objectName] = qualities\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hEtaTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -522,7 +612,19 @@
"qualityDF[objectName] = qualities\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hPtTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -551,7 +653,19 @@
"qualityDF[objectName] = qualities\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hSignTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -583,7 +697,19 @@
"#trend.GetYaxis().SetRangeUser(45,55)\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hdEdxTotMIP_TPCTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -612,7 +738,19 @@
"qualityDF[objectName] = qualities\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hNClustersAfterCutsTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -641,7 +779,19 @@
"qualityDF[objectName] = qualities\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hdEdxVsTglTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -670,7 +820,19 @@
"qualityDF[objectName] = qualities\n",
"#trend.SetTitle(\"Number of tracks - Trend\")\n",
"canvas.SetCanvasSize(1000,400)\n",
- "canvas.Draw()"
+ "canvas.Draw()\n",
+ "\n",
+ "data = [] # List to store the data\n",
+ "\n",
+ "# Iterate over the elements in qualities\n",
+ "for bin_index, quality_status in enumerate(qualities, start=1): # Assuming bin indexing starts at 1\n",
+ " if quality_status in [\"MEDIUM\", \"BAD\"]:\n",
+ " # Retrieve the X label for the bin\n",
+ " x_label = trend.GetXaxis().GetBinLabel(bin_index)\n",
+ " data.append({\"Run\": x_label, \"Quality\": quality_status})\n",
+ "\n",
+ "# Convert the list of dictionaries to a DataFrame\n",
+ "hdEdxTotMIPVsSnp_TPCTrendingQuality = pd.DataFrame(data)"
]
},
{
@@ -703,6 +865,14 @@
"**Number of clusters per pad, A-side:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "9de1092e",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -727,6 +897,14 @@
"**Number of clusters per pad, C-side:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "65c00534",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -751,6 +929,14 @@
"**Cluster total charge per pad, A-side:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "398fc290",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -774,6 +960,14 @@
"**Cluster total charge per pad, C-side:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "f861b5e9",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -800,6 +994,14 @@
"**Phi distribution A-side tracks:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "abb86f1d",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -837,6 +1039,14 @@
"**Phi distribution C-side tracks:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "c30523c3",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -874,6 +1084,14 @@
"**Eta distribution:**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "66c949a2",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -923,6 +1141,14 @@
" canvas.Draw()"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "03ffcc21",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -947,6 +1173,14 @@
"**Transverse momentum**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "5365a42b",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -974,6 +1208,14 @@
"**Track sign**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "c1253070",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1000,6 +1242,14 @@
"**Charge / transverse momentum**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "c7825a38",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1026,6 +1276,14 @@
"**Number of clusters per track**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "27b056d7",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1053,12 +1311,12 @@
]
},
{
- "cell_type": "code",
- "execution_count": null,
- "id": "a5d008df-abd1-4ed0-a220-8c72289e25d2",
+ "cell_type": "markdown",
+ "id": "81f7cbb2",
"metadata": {},
- "outputs": [],
- "source": []
+ "source": [
+ "\n"
+ ]
},
{
"cell_type": "code",
@@ -1091,6 +1349,14 @@
"canvas.Draw()"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "be7e248b",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1130,6 +1396,14 @@
"**nClusters vs eta**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "edaf185a",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1159,6 +1433,14 @@
"**nClusters vs transverse momentum**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "fb31cb26",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1321,6 +1603,18 @@
"#### dEdxTot of MIP"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "74f05922",
+ "metadata": {},
+ "source": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1374,6 +1668,14 @@
"**dEdx of MIP vs sector**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "67812972",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1404,6 +1706,14 @@
"**dEdx of Mip vs nClusters**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "8170a75c",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1439,6 +1749,14 @@
"**dEdx of Mip vs tan(lambda)**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "f080c7ff",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1473,6 +1791,14 @@
"**dEdx of Mip vs sin(phi)**"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "80e80f03",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1507,6 +1833,14 @@
"#### dEdx vs p"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "86dde2b1",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1527,7 +1861,143 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "f7620fc3-74bd-4cbf-971d-7ce9c756e313",
+ "id": "b08ea383",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from ipywidgets import VBox, Button, Dropdown, HTML, Layout, ButtonStyle\n",
+ "from IPython.display import FileLink\n",
+ "\n",
+ "def append_histogram_if_needed(hNClustersAfterCutsTrendingQuality, hNClustersAfterCuts):\n",
+ " global run, histogram_names # Reference global or previously defined variables\n",
+ "\n",
+ " # Filter the DataFrame for the current run\n",
+ " filtered_df = hNClustersAfterCutsTrendingQuality[hNClustersAfterCutsTrendingQuality['Run'] == str(run)]\n",
+ "\n",
+ " # Check if there are any rows after filtering\n",
+ " if not filtered_df.empty:\n",
+ " # Get the quality for the current run\n",
+ " specific_run_quality = filtered_df['Quality'].iloc[0]\n",
+ "\n",
+ " # Add 'hNClustersAfterCuts' only if the quality is 'MEDIUM' or 'BAD'\n",
+ " if specific_run_quality == 'MEDIUM' or specific_run_quality == 'BAD':\n",
+ " histogram_names.append(hNClustersAfterCuts)\n",
+ "\n",
+ " return histogram_names\n",
+ "\n",
+ "\n",
+ "def create_run_widget(run, histogram_names, worst_quality):\n",
+ " # Set button color based on the worst quality\n",
+ " button_style = ButtonStyle()\n",
+ " if worst_quality == \"BAD\":\n",
+ " button_style.button_color = 'red'\n",
+ " elif worst_quality == \"MEDIUM\":\n",
+ " button_style.button_color = 'yellow'\n",
+ " elif worst_quality == \"GOOD\":\n",
+ " button_style.button_color = 'green'\n",
+ "\n",
+ " dropdown = Dropdown(options=histogram_names, description=f'Run {run}:')\n",
+ " button = Button(description=f\"Run {run}\", style=button_style)\n",
+ " link_output = HTML() # Placeholder for the link\n",
+ " \n",
+ " # Initialize link output if there's only one histogram\n",
+ " if len(histogram_names) == 1:\n",
+ " link_output.value = f\"Go to histogram {histogram_names[0]}\"\n",
+ "\n",
+ "\n",
+ " def on_button_clicked(b):\n",
+ " dropdown.layout.display = 'flex' # Show the dropdown\n",
+ " # Display the link immediately if there's only one histogram\n",
+ " if len(histogram_names) == 1:\n",
+ " link_output.value = f\"Go to histogram {histogram_names[0]}\"\n",
+ " def on_dropdown_change(change):\n",
+ " if change['type'] == 'change' and change['name'] == 'value':\n",
+ " # Directly create a link to the anchor\n",
+ " link_output.value = f\"Go to histogram {change['new']}\"\n",
+ "\n",
+ " button.on_click(on_button_clicked)\n",
+ " dropdown.observe(on_dropdown_change, names='value')\n",
+ "\n",
+ " return VBox([button, dropdown, link_output])\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Base list of histogram names\n",
+ "#all_histogram_names = ['hPhiCside','h2DRPhinClustersAside','h2DRPhinClustersCside','h2DRPhiqTotAside','h2DRPhiqTotCside','h2DEtaPhi','hQOverPt','h2DNClustersPhiAside','h2DNClustersPhiCside','h2DNClustersEta','h2DNClustersPt','hdEdxTotMIP_OROC3','hdEdxTotMIP_OROC2','hdEdxTotMIP_OROC1','hdEdxTotMIP_IROC','hdEdxTotMIPVsSec_TPC','hdEdxTotMIPVsNcl_TPC','hdEdxTotMIPVsSnp_TPC','hdEdxTotVsP_TPC'] # Add all histograms here\n",
+ "all_histogram_names = []\n",
+ "# List to store the widgets\n",
+ "widgets_list = []\n",
+ "run_summary = []\n",
+ "\n",
+ "for run in runList:\n",
+ " # Start with a copy of the base list of histogram names for each run\n",
+ " histogram_names = all_histogram_names.copy()\n",
+ " worst_quality = \"GOOD\"\n",
+ "\n",
+ "# Define a list of DataFrame and histogram name pairs\n",
+ " df_histogram_pairs = [\n",
+ " (hEtaTrendingQuality, 'hEta'),\n",
+ " (hPhiAsideTrendingQuality, 'hPhiAside'),\n",
+ " (numberofTracksTrendingQuality, 'hPhiCside'),\n",
+ " (hNClustersAfterCutsTrendingQuality, 'hNClustersAfterCuts'),\n",
+ " (hdEdxTotMIP_TPCTrendingQuality, 'hdEdxTotMIP_TPC'),\n",
+ " (hSignTrendingQuality, 'hSign'), \n",
+ " (hPtTrendingQuality, 'hPt'),\n",
+ " (hdEdxVsTglTrendingQuality, 'hdEdxVsTgl'),\n",
+ " (hdEdxTotMIPVsSnp_TPCTrendingQuality, 'hdEdxTotMIPVsSnp_TPC')\n",
+ "\n",
+ " ] \n",
+ " \n",
+ " \n",
+ "\n",
+ "\n",
+ " # Iterate over each pair to check and append histogram names and determine worst quality\n",
+ " for df, histogram_name in df_histogram_pairs:\n",
+ " if not df.empty:\n",
+ " filtered_df = df[df['Run'] == str(run)]\n",
+ " if not filtered_df.empty:\n",
+ " specific_run_quality = filtered_df['Quality'].iloc[0]\n",
+ " if specific_run_quality == 'MEDIUM' or specific_run_quality == 'BAD':\n",
+ " histogram_names.append(histogram_name)\n",
+ " # Update the worst quality if needed\n",
+ " if specific_run_quality == \"BAD\":\n",
+ " worst_quality = \"BAD\"\n",
+ " break # Stop checking if any histogram is BAD\n",
+ " elif specific_run_quality == \"MEDIUM\" and worst_quality != \"BAD\":\n",
+ " worst_quality = \"MEDIUM\"\n",
+ "\n",
+ " # Create and add the widget for this run to the list\n",
+ " widgets_list.append(create_run_widget(run, histogram_names, worst_quality))\n",
+ " \n",
+ " run_summary.append((run, worst_quality, histogram_names))\n",
+ "\n",
+ "with open(\"run_quality_summary.txt\", \"w\") as file:\n",
+ " for run, quality, histograms in run_summary:\n",
+ " file.write(f\"Run {run}, Worst Quality: {quality}, Histograms: {', '.join(histograms)}\\n\")\n",
+ " \n",
+ "# Create a link to download the file\n",
+ "download_link = FileLink('run_quality_summary.txt', result_html_prefix=\"Click here to download: \")\n",
+ "\n",
+ "# Display the link\n",
+ "display(download_link)\n",
+ "\n",
+ "\n",
+ "# Display all widgets\n",
+ "display(VBox(widgets_list))\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "03cd7c70",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "da740a3b",
"metadata": {},
"outputs": [],
"source": []
@@ -1549,7 +2019,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.16"
+ "version": "3.9.6"
},
"toc": {
"base_numbering": 1,