{"cells":[{"cell_type":"markdown","metadata":{},"source":["
\n"," \n","
"]},{"cell_type":"markdown","metadata":{},"source":["

Notebook example: simple two-samples comparison

\n","\n","##### The following analysis is comparing the kinematics between events coming for the SM Higgs boson decaying to 2 W-bosons to those coming from the SM WW-diboson background production.\n","\n","SM Higgs to WW Feynman diagram:\n","
\n","\n","SM WW-diboson Feynman diagram:\n","
"]},{"cell_type":"code","execution_count":1,"metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":["cling::DynamicLibraryManager::loadLibrary(): libGL.so.1: cannot open shared object file: No such file or directory\n","Error in : Failed to load library /srv/conda/envs/notebook/lib/libEve.so.6.28.00cling JIT session error: Failed to materialize symbols: { (main, { _ZeqRK7TStringRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE }) }\n"]},{"name":"stdout","output_type":"stream","text":["Welcome to JupyROOT 6.28/00\n"]}],"source":["import ROOT"]},{"cell_type":"code","execution_count":2,"metadata":{"trusted":true},"outputs":[],"source":["%jsroot on"]},{"cell_type":"code","execution_count":13,"metadata":{"trusted":true},"outputs":[],"source":["## reading the input files via internet (URL to the file)\n","\n","## WW\n","bkg = ROOT.TFile.Open(\"https://cernbox.cern.ch/remote.php/dav/public-files/K2mu3vA7dxpYHtz/run_ttbar_allhad.root\")\n","t_bkg = bkg.Get(\"analysis;1\")\n","t_bkg.GetEntries()\n"]},{"cell_type":"code","execution_count":17,"metadata":{"trusted":true},"outputs":[{"data":{"text/plain":["3492"]},"execution_count":17,"metadata":{},"output_type":"execute_result"}],"source":["## SM H->WW\n","sig = ROOT.TFile.Open(\"https://cernbox.cern.ch/remote.php/dav/public-files/SEJREymTFAb2igN/run_WWbb_allhad.root\")\n","t_sig = sig.Get(\"analysis;1\")\n","t_sig.GetEntries()\n"]},{"cell_type":"code","execution_count":18,"metadata":{"trusted":true},"outputs":[],"source":["c = ROOT.TCanvas(\"testCanvas\",\"a first way to plot a variable\",800,600)"]},{"cell_type":"code","execution_count":19,"metadata":{"trusted":true},"outputs":[],"source":["h_bgs = ROOT.TH1F(\"h_bgs\",\"Example plot: Missing transverse energey\",20,0,200)\n","h2_bgs = ROOT.TH1F(\"h2_bgs\",\"Example plot: Number of Jets\",10,0,10)\n","\n","h_sig = ROOT.TH1F(\"h_sig\",\"Example plot: Missing transverse energey\",20,0,200)\n","h2_sig = ROOT.TH1F(\"h2_sig\",\"Example plot: Number of Jets\",10,0,10)"]},{"cell_type":"code","execution_count":21,"metadata":{"scrolled":true,"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":["10000\n","20000\n","30000\n","Done!\n"]}],"source":["n=0\n","for event in t_bkg:\n"," n += 1\n"," ## printing the evolution in number of events\n"," if(n%10000==0):\n"," print(n)\n"," h_bgs.Fill((t_bkg.DR_qq_max1)/1000.)\n"," h2_bgs.Fill(t_bkg.DR_qq_max2)\n","\n","m=0 \n","for event in t_sig:\n"," m += 1\n"," ## printing the evolution in number of events\n"," if(m%10000==0):\n"," print(m)\n"," h_sig.Fill((t_sig.DR_qq_max1)/1000.)\n"," h2_sig.Fill(t_sig.DR_qq_max2)\n"," \n","print(\"Done!\")"]},{"cell_type":"code","execution_count":22,"metadata":{"trusted":true},"outputs":[{"data":{"text/html":["\n","\n","
\n","
\n","\n"],"text/plain":[""]},"metadata":{},"output_type":"display_data"}],"source":["scale_bgs = h_bgs.Integral()\n","h_bgs.Scale(1/scale_bgs)\n","\n","scale_sig = h_sig.Integral()\n","h_sig.Scale(1/scale_sig)\n","\n","\n","h_bgs.SetFillStyle(3001)\n","h_bgs.SetFillColor(4)\n","h_bgs.SetLineColor(4)\n","\n","h_sig.SetFillStyle(3003)\n","h_sig.SetFillColor(2)\n","h_sig.SetLineColor(2)\n","\n","legend=ROOT.TLegend(0.5,0.7,0.9,0.9)\n","legend.AddEntry(h_bgs,\"Background (WW) \",\"l\")\n","legend.AddEntry(h_sig,\"Signal (H #rightarrow WW)\",\"l\")\n","\n","h_sig.SetStats(0)\n","h_bgs.SetStats(0)\n","\n","h_sig.Draw(\"hist\")\n","h_bgs.Draw(\"histsame\")\n","legend.Draw()\n","c.Draw()\n"]},{"cell_type":"code","execution_count":23,"metadata":{"trusted":true},"outputs":[{"data":{"text/html":["\n","\n","
\n","
\n","\n"],"text/plain":[""]},"metadata":{},"output_type":"display_data"}],"source":["scale2_bgs = h2_bgs.Integral()\n","h2_bgs.Scale(1/scale2_bgs)\n","\n","scale2_sig = h2_sig.Integral()\n","h2_sig.Scale(1/scale2_sig)\n","\n","\n","\n","h2_bgs.SetFillStyle(3001)\n","h2_bgs.SetFillColor(4)\n","h2_bgs.SetLineColor(4)\n","\n","h2_sig.SetFillStyle(3003)\n","h2_sig.SetFillColor(2)\n","h2_sig.SetLineColor(2)\n","\n","legend=ROOT.TLegend(0.5,0.7,0.9,0.9)\n","legend.AddEntry(h2_bgs,\"Background (WW) \",\"l\")\n","legend.AddEntry(h2_sig,\"Signal (H #rightarrow WW)\",\"l\")\n","\n","\n","h2_sig.SetStats(0)\n","h2_bgs.SetStats(0)\n","h2_sig.Draw(\"hist\")\n","h2_bgs.Draw(\"histsame\")\n","legend.Draw()\n","c.Draw()\n"]},{"cell_type":"markdown","metadata":{},"source":["**Done**"]}],"metadata":{"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.10.11"}},"nbformat":4,"nbformat_minor":1}