{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "92423e93",
   "metadata": {},
   "source": [
    "# rf504_simwstool\n",
    "Organization and simultaneous fits: using RooSimWSTool to construct a simultaneous pdf\n",
    "that is built of variations of an input pdf\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "**Author:**  Clemens Lange, Wouter Verkerke (C++ version)  \n",
    "<i><small>This notebook tutorial was automatically generated with <a href= \"https://github.com/root-project/root/blob/master/documentation/doxygen/converttonotebook.py\">ROOTBOOK-izer</a> from the macro found in the ROOT repository  on Tuesday, May 19, 2026 at 08:32 PM.</small></i>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "351b3c16",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:14.503816Z",
     "iopub.status.busy": "2026-05-19T20:32:14.503702Z",
     "iopub.status.idle": "2026-05-19T20:32:15.489316Z",
     "shell.execute_reply": "2026-05-19T20:32:15.488666Z"
    }
   },
   "outputs": [],
   "source": [
    "import ROOT"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8d9e3ffc",
   "metadata": {},
   "source": [
    "Create master pdf\n",
    "---------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "20e548a0",
   "metadata": {},
   "source": [
    "Construct gauss(x,m,s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3750f12d",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:15.491934Z",
     "iopub.status.busy": "2026-05-19T20:32:15.491797Z",
     "iopub.status.idle": "2026-05-19T20:32:15.671715Z",
     "shell.execute_reply": "2026-05-19T20:32:15.671210Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[#0] WARNING:InputArguments -- The parameter 's' with range [-10, 10] of the RooGaussian 'g' exceeds the safe range of (0, inf). Advise to limit its range.\n"
     ]
    }
   ],
   "source": [
    "x = ROOT.RooRealVar(\"x\", \"x\", -10, 10)\n",
    "m = ROOT.RooRealVar(\"m\", \"m\", 0, -10, 10)\n",
    "s = ROOT.RooRealVar(\"s\", \"s\", 1, -10, 10)\n",
    "gauss = ROOT.RooGaussian(\"g\", \"g\", x, m, s)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "acf35e1d",
   "metadata": {},
   "source": [
    "Construct poly(x,p0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0902b436",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:15.673436Z",
     "iopub.status.busy": "2026-05-19T20:32:15.673311Z",
     "iopub.status.idle": "2026-05-19T20:32:15.848971Z",
     "shell.execute_reply": "2026-05-19T20:32:15.848349Z"
    }
   },
   "outputs": [],
   "source": [
    "p0 = ROOT.RooRealVar(\"p0\", \"p0\", 0.01, 0.0, 1.0)\n",
    "poly = ROOT.RooPolynomial(\"p\", \"p\", x, [p0])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "721bb7f7",
   "metadata": {},
   "source": [
    "model = f*gauss(x) + (1-f)*poly(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "c32d5e84",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:15.850466Z",
     "iopub.status.busy": "2026-05-19T20:32:15.850341Z",
     "iopub.status.idle": "2026-05-19T20:32:15.962865Z",
     "shell.execute_reply": "2026-05-19T20:32:15.962489Z"
    }
   },
   "outputs": [],
   "source": [
    "f = ROOT.RooRealVar(\"f\", \"f\", 0.5, 0.0, 1.0)\n",
    "model = ROOT.RooAddPdf(\"model\", \"model\", [gauss, poly], [f])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "88d5fd5f",
   "metadata": {},
   "source": [
    "Create category observables for splitting\n",
    "----------------------------------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f579677a",
   "metadata": {},
   "source": [
    "Define two categories that can be used for splitting"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "de913542",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:15.965084Z",
     "iopub.status.busy": "2026-05-19T20:32:15.964966Z",
     "iopub.status.idle": "2026-05-19T20:32:16.085316Z",
     "shell.execute_reply": "2026-05-19T20:32:16.084703Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = ROOT.RooCategory(\"c\", \"c\")\n",
    "c.defineType(\"run1\")\n",
    "c.defineType(\"run2\")\n",
    "\n",
    "d = ROOT.RooCategory(\"d\", \"d\")\n",
    "d.defineType(\"foo\")\n",
    "d.defineType(\"bar\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0f7a279f",
   "metadata": {},
   "source": [
    "Set up SimWSTool\n",
    "-----------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c012c72",
   "metadata": {},
   "source": [
    "Import ingredients in a workspace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "23a38375",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.086892Z",
     "iopub.status.busy": "2026-05-19T20:32:16.086773Z",
     "iopub.status.idle": "2026-05-19T20:32:16.239407Z",
     "shell.execute_reply": "2026-05-19T20:32:16.238815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooGaussian::g\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::x\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::m\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::s\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::f\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooCategory::c\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooCategory::d\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w = ROOT.RooWorkspace(\"w\", \"w\")\n",
    "w.Import({model, c, d})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "189c077d",
   "metadata": {},
   "source": [
    "Make Sim builder tool"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "3a3e7697",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.241123Z",
     "iopub.status.busy": "2026-05-19T20:32:16.241005Z",
     "iopub.status.idle": "2026-05-19T20:32:16.350518Z",
     "shell.execute_reply": "2026-05-19T20:32:16.349926Z"
    }
   },
   "outputs": [],
   "source": [
    "sct = ROOT.RooSimWSTool(w)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7c3f0441",
   "metadata": {},
   "source": [
    "Build a simultaneous model with one split\n",
    "---------------------------------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04a1205b",
   "metadata": {},
   "source": [
    "Construct a simultaneous pdf with the following form\n",
    "\n",
    "model_run1(x) = f*gauss_run1(x,m_run1,s) + (1-f)*poly\n",
    "model_run2(x) = f*gauss_run2(x,m_run2,s) + (1-f)*poly\n",
    "simpdf(x,c) = model_run1(x) if c==\"run1\"\n",
    "            = model_run2(x) if c==\"run2\"\n",
    "\n",
    "Returned pdf is owned by the workspace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "295fdc68",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.352269Z",
     "iopub.status.busy": "2026-05-19T20:32:16.352148Z",
     "iopub.status.idle": "2026-05-19T20:32:16.490985Z",
     "shell.execute_reply": "2026-05-19T20:32:16.490380Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Splitrule for p.d.f model with state list \n",
      " parameter m is split with constraint in categories (c)\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of prototype pdfs (model)\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of splitting categories (c)\n",
      "[#1] INFO:ObjectHandling -- RooSimPdfBuilder::executeBuild: processing prototype pdf model\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: configured customizers for all prototype pdfs\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode run1\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode run2\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooSimultaneous::model_sim\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_run1\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooGaussian::g_run1\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::m_run1\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_run2\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooGaussian::g_run2\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::m_run2\n"
     ]
    }
   ],
   "source": [
    "model_sim = sct.build(\"model_sim\", \"model\", SplitParam=(\"m\", \"c\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c951aa1f",
   "metadata": {},
   "source": [
    "Print tree structure of model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "01e4ef39",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.493350Z",
     "iopub.status.busy": "2026-05-19T20:32:16.493235Z",
     "iopub.status.idle": "2026-05-19T20:32:16.602547Z",
     "shell.execute_reply": "2026-05-19T20:32:16.601961Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0x55b383f232a0 RooSimultaneous::model_sim = 1 [Auto,Dirty] \n",
      "  0x55b383ad8e40/V- RooCategory::c = run2(idx = 1)\n",
      "\n",
      "  0x55b383e92990/V- RooAddPdf::model_run1 = 1/1 [Auto,Clean] \n",
      "    0x55b383f0d550/V- RooGaussian::g_run1 = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383d60640/V- RooRealVar::m_run1 = 0\n",
      "      0x55b383bcc1a0/V- RooRealVar::s = 1\n",
      "    0x55b383af7fe0/V- RooRealVar::f = 0.5\n",
      "    0x55b382112af0/V- RooPolynomial::p = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383bcd530/V- RooRealVar::p0 = 0.01\n",
      "  0x55b383d642e0/V- RooAddPdf::model_run2 = 1/1 [Auto,Clean] \n",
      "    0x55b383f1fc80/V- RooGaussian::g_run2 = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383d53ae0/V- RooRealVar::m_run2 = 0\n",
      "      0x55b383bcc1a0/V- RooRealVar::s = 1\n",
      "    0x55b383af7fe0/V- RooRealVar::f = 0.5\n",
      "    0x55b382112af0/V- RooPolynomial::p = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383bcd530/V- RooRealVar::p0 = 0.01\n"
     ]
    }
   ],
   "source": [
    "model_sim.Print(\"t\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "da71f1eb",
   "metadata": {},
   "source": [
    "Adjust model_sim parameters in workspace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "3998afbd",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.603822Z",
     "iopub.status.busy": "2026-05-19T20:32:16.603703Z",
     "iopub.status.idle": "2026-05-19T20:32:16.746105Z",
     "shell.execute_reply": "2026-05-19T20:32:16.745633Z"
    }
   },
   "outputs": [],
   "source": [
    "w.var(\"m_run1\").setVal(-3)\n",
    "w.var(\"m_run2\").setVal(+3)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e63b63cd",
   "metadata": {},
   "source": [
    "Print contents of workspace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e7e04e37",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.747633Z",
     "iopub.status.busy": "2026-05-19T20:32:16.747504Z",
     "iopub.status.idle": "2026-05-19T20:32:16.856723Z",
     "shell.execute_reply": "2026-05-19T20:32:16.856114Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "RooWorkspace(w) w contents\n",
      "\n",
      "variables\n",
      "---------\n",
      "(c,d,f,m,m_run1,m_run2,p0,s,x)\n",
      "\n",
      "p.d.f.s\n",
      "-------\n",
      "RooGaussian::g[ x=x mean=m sigma=s ] = 1\n",
      "RooGaussian::g_run1[ x=x mean=m_run1 sigma=s ] = 0.011109\n",
      "RooGaussian::g_run2[ x=x mean=m_run2 sigma=s ] = 0.011109\n",
      "RooAddPdf::model[ f * g + [%] * p ] = 1/1\n",
      "RooAddPdf::model_run1[ f * g_run1 + [%] * p ] = 0.505554/1\n",
      "RooAddPdf::model_run2[ f * g_run2 + [%] * p ] = 0.505554/1\n",
      "RooSimultaneous::model_sim[ indexCat=c run1=model_run1 run2=model_run2 ] = 0.505554\n",
      "RooPolynomial::p[ x=x coefList=(p0) ] = 1\n",
      "\n"
     ]
    }
   ],
   "source": [
    "w.Print(\"v\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a9c23be1",
   "metadata": {},
   "source": [
    "Build a simultaneous model with product split\n",
    "-----------------------------------------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1c2731a0",
   "metadata": {},
   "source": [
    "Build another simultaneous pdf using a composite split in states c X d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "985dc864",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.857992Z",
     "iopub.status.busy": "2026-05-19T20:32:16.857874Z",
     "iopub.status.idle": "2026-05-19T20:32:16.966181Z",
     "shell.execute_reply": "2026-05-19T20:32:16.965562Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Splitrule for p.d.f model with state list \n",
      " parameter p0 is split with constraint in categories (c,d)\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of prototype pdfs (model)\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of splitting categories (c,d)\n",
      "[#1] INFO:ObjectHandling -- RooSimPdfBuilder::executeBuild: processing prototype pdf model\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooMultiCategory::c,d\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: configured customizers for all prototype pdfs\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run1;bar}\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run1;foo}\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run2;bar}\n",
      "[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run2;foo}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooSimultaneous::model_sim2\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooSuperCategory::model_sim2_index\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooMultiCategory::model_sim2_index_internalMultiCat\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run1;bar}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run1;bar}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run1;bar}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run1;foo}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run1;foo}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run1;foo}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run2;bar}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run2;bar}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run2;bar}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run2;foo}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run2;foo}\n",
      "[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run2;foo}\n"
     ]
    }
   ],
   "source": [
    "model_sim2 = sct.build(\"model_sim2\", \"model\", SplitParam=(\"p0\", \"c,d\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9ac3f099",
   "metadata": {},
   "source": [
    "Print tree structure of self model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "28c69739",
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2026-05-19T20:32:16.967401Z",
     "iopub.status.busy": "2026-05-19T20:32:16.967283Z",
     "iopub.status.idle": "2026-05-19T20:32:17.072954Z",
     "shell.execute_reply": "2026-05-19T20:32:17.072381Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0x55b383fed3f0 RooSimultaneous::model_sim2 = 1 [Auto,Dirty] \n",
      "  0x55b383ff19e0/V- RooSuperCategory::model_sim2_index = {run2;foo}(idx = 1)\n",
      " [Auto,Clean] \n",
      "    0x55b383ff1de0/VS RooMultiCategory::model_sim2_index_internalMultiCat = {run2;foo}(idx = 1)\n",
      " [Auto,Clean] \n",
      "      0x55b383ad8e40/VS RooCategory::c = run2(idx = 1)\n",
      "\n",
      "      0x55b3827ac740/VS RooCategory::d = foo(idx = 0)\n",
      "\n",
      "  0x55b383ff2210/V- RooAddPdf::model_{run1;bar} = 1/1 [Auto,Clean] \n",
      "    0x55b383b372c0/V- RooGaussian::g = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b37a983780/V- RooRealVar::m = 0\n",
      "      0x55b383bcc1a0/V- RooRealVar::s = 1\n",
      "    0x55b383af7fe0/V- RooRealVar::f = 0.5\n",
      "    0x55b383fa3a60/V- RooPolynomial::p_{run1;bar} = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383fa5fd0/V- RooRealVar::p0_{run1;bar} = 0.01\n",
      "  0x55b383fa6650/V- RooAddPdf::model_{run1;foo} = 1/1 [Auto,Clean] \n",
      "    0x55b383b372c0/V- RooGaussian::g = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b37a983780/V- RooRealVar::m = 0\n",
      "      0x55b383bcc1a0/V- RooRealVar::s = 1\n",
      "    0x55b383af7fe0/V- RooRealVar::f = 0.5\n",
      "    0x55b383fab550/V- RooPolynomial::p_{run1;foo} = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383fadcf0/V- RooRealVar::p0_{run1;foo} = 0.01\n",
      "  0x55b383fae370/V- RooAddPdf::model_{run2;bar} = 1/1 [Auto,Clean] \n",
      "    0x55b383b372c0/V- RooGaussian::g = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b37a983780/V- RooRealVar::m = 0\n",
      "      0x55b383bcc1a0/V- RooRealVar::s = 1\n",
      "    0x55b383af7fe0/V- RooRealVar::f = 0.5\n",
      "    0x55b383fb3300/V- RooPolynomial::p_{run2;bar} = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383fb5b80/V- RooRealVar::p0_{run2;bar} = 0.01\n",
      "  0x55b383fb6200/V- RooAddPdf::model_{run2;foo} = 1/1 [Auto,Clean] \n",
      "    0x55b383b372c0/V- RooGaussian::g = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b37a983780/V- RooRealVar::m = 0\n",
      "      0x55b383bcc1a0/V- RooRealVar::s = 1\n",
      "    0x55b383af7fe0/V- RooRealVar::f = 0.5\n",
      "    0x55b383fbb270/V- RooPolynomial::p_{run2;foo} = 1 [Auto,Dirty] \n",
      "      0x55b37a98af40/V- RooRealVar::x = 0\n",
      "      0x55b383fbd9d0/V- RooRealVar::p0_{run2;foo} = 0.01\n"
     ]
    }
   ],
   "source": [
    "model_sim2.Print(\"t\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.12.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
