{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Simple CMS Open Data Plot\n", "\n", "Demonstrates a simple plot of Muon Track pT from the [CMS OpenData Higgs to 4 lepton dataset](http://opendata.cern.ch/record/1507), size of 58.2 GB with 22 files and http://opendata.cern.ch/record/16 size of 6.7 TB with 1697 files.\n", "\n", "For coffea-casa AF add in `.servicex` configuration file the next endpoint:\n", "```\n", "api_endpoints:\n", " - name: cms_run1_aod\n", " endpoint: http://opendataaf-servicex-aod-servicex-app:8000\n", " type: cms_run1_aod\n", "```" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from func_adl_servicex import ServiceXSourceCMSRun1AOD\n", "from hist import Hist\n", "import mplhep as mpl\n", "\n", "# This is CMS data...\n", "# mpl.style.use(mpl.style.CMS)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [] }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "abf78f6e8b42494baca4e3259d874bec", "version_major": 2, "version_minor": 0 }, "text/plain": [ "cernopendata://16: 0%| | 0/9000000000.0 [00:00]" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "1e172dec1d0b43f5a47651a6f3afb0d6", "version_major": 2, "version_minor": 0 }, "text/plain": [ " cernopendata://16 Downloaded: 0%| | 0/9000000000.0 [00:00]" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "data = ServiceXSourceCMSRun1AOD(\"cernopendata://16\") \\\n", " .SelectMany(lambda e: e.TrackMuons(\"globalMuons\")) \\\n", " .Select(lambda m: m.pt()) \\\n", " .AsAwkwardArray(['mu_pt']) \\\n", " .value()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "h = (Hist.new\n", " .Reg(50, 0, 200, name='mu_pt', label='Muon Track $p_T$')\n", " .Int64()\n", " )\n", "h.fill(data['mu_pt'])\n", "_ = h.plot()" ] } ], "metadata": { "interpreter": { "hash": "69b1ce9c2822bb5c42c029c04f0802c937e4616e5137ab418b481ca65f7727f9" }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.8.13" } }, "nbformat": 4, "nbformat_minor": 4 }