Skip to content

[tutorials] Get rid of experimental category #18153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gui/browserv7/inc/ROOT/RBrowser.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Authors: Bertrand Bellenot <[email protected]> Sergey Linev <[email protected]>
// Date: 2019-02-28
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

/*************************************************************************
* Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
Expand Down
1 change: 0 additions & 1 deletion gui/browserv7/inc/ROOT/RBrowserData.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Author: Sergey Linev <[email protected]>
// Date: 2019-10-14
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

/*************************************************************************
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
Expand Down
1 change: 0 additions & 1 deletion gui/browserv7/inc/ROOT/RBrowserReply.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Authors: Bertrand Bellenot <[email protected]> Sergey Linev <[email protected]>
// Date: 2019-02-28
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

/*************************************************************************
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
Expand Down
1 change: 0 additions & 1 deletion gui/browserv7/inc/ROOT/RBrowserRequest.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Authors: Bertrand Bellenot <[email protected]> Sergey Linev <[email protected]>
// Date: 2019-02-28
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

/*************************************************************************
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
Expand Down
1 change: 0 additions & 1 deletion gui/browserv7/inc/ROOT/RFileDialog.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Author: Sergey Linev <[email protected]>
// Date: 2019-10-31
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

/*************************************************************************
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
Expand Down
1 change: 0 additions & 1 deletion gui/browserv7/inc/ROOT/RWebBrowserImp.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Author: Sergey Linev <[email protected]>
// Date: 2021-02-11
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

/*************************************************************************
* Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
Expand Down
29 changes: 14 additions & 15 deletions tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ if(NOT xrootd)
analysis/dataframe/df106_HiggsToFourLeptons.py
analysis/dataframe/df107_SingleTopAnalysis.py
roofit/roofit/rf618_mixture_models.py # depends on df106_HiggsToFourLeptons.py
experimental/rcanvas/df104.py
experimental/rcanvas/df105.py
visualisation/rcanvas/df104.py
visualisation/rcanvas/df105.py
)
endif()

Expand Down Expand Up @@ -293,7 +293,7 @@ set(gui_veto math/fit/fitpanel_playback.C
visualisation/webgui/panel/webpanel.cxx
visualisation/webgui/webwindow/webwindow.cxx)
if (NOT webgui)
list(APPEND gui_veto visualisation/graphics/save_batch.C experimental/rcanvas/df104.py experimental/rcanvas/df105.py)
list(APPEND gui_veto visualisation/graphics/save_batch.C visualisation/rcanvas/df104.py visualisation/rcanvas/df105.py)
endif()

if (NOT ROOT_tmva_FOUND)
Expand Down Expand Up @@ -374,10 +374,9 @@ endif()

if(root7)
set(root7_veto analysis/dataframe/df013_InspectAnalysis.C
experimental/browser.cxx
experimental/filedialog.cxx
experimental/fitpanel.cxx
experimental/fitpanel6.cxx
tutorials/visualisation/webgui/browserv7/browser.cxx
tutorials/visualisation/webgui/browserv7/filedialog.cxx
tutorials/visualisation/webgui/fitpanelv7/fitpanel6.cxx
)
if(NOT davix)
list(APPEND root7_veto io/ntuple/ntpl004_dimuon.C)
Expand All @@ -388,20 +387,20 @@ if(root7)
list(APPEND root7_veto io/ntuple/ntpl011_global_temperatures.C)
list(APPEND root7_veto io/ntuple/ntpl004_dimuon.C)
list(APPEND root7_veto io/ntuple/ntpl008_import.C)
list(APPEND root7_veto experimental/rcanvas/df104.py)
list(APPEND root7_veto experimental/rcanvas/df105.py)
list(APPEND root7_veto visualisation/rcanvas/df104.py)
list(APPEND root7_veto visualisation/rcanvas/df105.py)
endif()
if(MSVC AND NOT win_broken_tests)
#---EOS is not supported on Windows
list(APPEND root7_veto experimental/rcanvas/df104.py)
list(APPEND root7_veto experimental/rcanvas/df105.py)
list(APPEND root7_veto experimental/rcanvas/rbox.py)
list(APPEND root7_veto visualisation/rcanvas/df104.py)
list(APPEND root7_veto visualisation/rcanvas/df105.py)
list(APPEND root7_veto visualisation/rcanvas/rbox.py)
endif()
else()
if(MSVC AND NOT win_broken_tests)
list(APPEND root7_veto analysis/dataframe/df013_InspectAnalysis.C)
endif()
file(GLOB v7_veto_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ experimental/*.py experimental/*.cxx experimental/*/*.cxx experimental/*.C experimental/*/*.C experimental/rcanvas/*.py experimental/rcanvas/*.cxx)
file(GLOB v7_veto_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ visualisation/webgui/browserv7/*.cxx visualisation/webgui/fitpanelv7/*.cxx visualisation/rcanvas/*.py visualisation/rcanvas/*.cxx)
list(APPEND root7_veto ${v7_veto_files})
# This depends on ntupleutil
list(APPEND root7_veto io/ntuple/ntpl008_import.C)
Expand Down Expand Up @@ -512,7 +511,7 @@ if(webgui)
list(APPEND tutorials ${visualisation/tutorials_webcanv})
endif()
if(root7 AND webgui)
file(GLOB_RECURSE tutorials_exp RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} experimental/*.cxx)
file(GLOB_RECURSE tutorials_exp RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} visualisation/rcanvas/*.cxx tutorials/visualisation/webgui/browserv7/*.cxx tutorials/visualisation/webgui/fitpanelv7/*.cxx)
list(APPEND tutorials ${tutorials_exp})
endif()
file(GLOB tutorials_veto RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${all_veto})
Expand Down Expand Up @@ -640,7 +639,7 @@ file(GLOB long_running RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${long_running})
set(NProcessors 4)
set (multithreaded_all_cores
analysis/dataframe/df10[2-7]*
experimental/rcanvas/df10*
visualisation/rcanvas/df10*
)
set (multithreaded
${multithreaded_all_cores}
Expand Down
11 changes: 0 additions & 11 deletions tutorials/experimental/index.md

This file was deleted.

4 changes: 4 additions & 0 deletions tutorials/visualisation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
\ingroup tutorial_visualisation
\brief Various examples showing the OpenGL graphics in ROOT.

\defgroup tutorial_rcanvas RCanvas examples
\ingroup tutorial_visualisation
\brief These are RCanvas examples.

\defgroup tutorial_cocoa Tutorials specific to Mac/Cocoa
\ingroup tutorial_visualisation
\brief Various examples showing graphics done with the Mac graphics system Cocoa.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,37 @@
## \date 2021-06-15
## \authors Stefan Wunsch (KIT, CERN) Sergey Linev (GSI)

import ROOT
import os
from ROOT.Experimental import RCanvas, RText, RAttrText, RAttrFont, RAttrFill, RAttrLine, RLegend, RPadPos, RPadExtent, TObjectDrawable
from ROOT.Experimental import (
RCanvas,
RText,
RAttrText,
RAttrFont,
RAttrFill,
RAttrLine,
RLegend,
RPadPos,
RPadExtent,
TObjectDrawable,
)

Check failure on line 35 in tutorials/visualisation/rcanvas/df104.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

tutorials/visualisation/rcanvas/df104.py:22:1: I001 Import block is un-sorted or un-formatted

# Enable multi-threading
ROOT.ROOT.EnableImplicitMT()

# Create a ROOT dataframe for each dataset
path = "root://eospublic.cern.ch//eos/opendata/atlas/OutreachDatasets/2020-01-22"
df = {}
df["data"] = ROOT.RDataFrame("mini", (os.path.join(path, "GamGam/Data/data_{}.GamGam.root".format(x)) for x in ("A", "B", "C", "D")))
df["data"] = ROOT.RDataFrame(
"mini", (os.path.join(path, "GamGam/Data/data_{}.GamGam.root".format(x)) for x in ("A", "B", "C", "D"))
)
df["ggH"] = ROOT.RDataFrame("mini", os.path.join(path, "GamGam/MC/mc_343981.ggH125_gamgam.GamGam.root"))
df["VBF"] = ROOT.RDataFrame("mini", os.path.join(path, "GamGam/MC/mc_345041.VBFH125_gamgam.GamGam.root"))
processes = list(df.keys())

# Apply scale factors and MC weight for simulated events and a weight of 1 for the data
for p in ["ggH", "VBF"]:
df[p] = df[p].Define("weight",
"scaleFactor_PHOTON * scaleFactor_PhotonTRIGGER * scaleFactor_PILEUP * mcWeight");
df[p] = df[p].Define("weight", "scaleFactor_PHOTON * scaleFactor_PhotonTRIGGER * scaleFactor_PILEUP * mcWeight")
df["data"] = df["data"].Define("weight", "1.0")

# Select the events for the analysis
Expand All @@ -46,39 +58,55 @@
df[p] = df[p].Filter("trigP")

# Find two good muons with tight ID, pt > 25 GeV and not in the transition region between barrel and encap
df[p] = df[p].Define("goodphotons", "photon_isTightID && (photon_pt > 25000) && (abs(photon_eta) < 2.37) && ((abs(photon_eta) < 1.37) || (abs(photon_eta) > 1.52))")\
.Filter("Sum(goodphotons) == 2")
df[p] = (
df[p]
.Define(
"goodphotons",
"photon_isTightID && (photon_pt > 25000) && (abs(photon_eta) < 2.37) && ((abs(photon_eta) < 1.37) || (abs(photon_eta) > 1.52))",
)
.Filter("Sum(goodphotons) == 2")
)

# Take only isolated photons
df[p] = df[p].Filter("Sum(photon_ptcone30[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")\
.Filter("Sum(photon_etcone20[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
df[p] = (
df[p]
.Filter("Sum(photon_ptcone30[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
.Filter("Sum(photon_etcone20[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
)

# Compile a function to compute the invariant mass of the diphoton system
ROOT.gInterpreter.Declare(
"""
"""
using Vec_t = const ROOT::VecOps::RVec<float>;
float ComputeInvariantMass(Vec_t& pt, Vec_t& eta, Vec_t& phi, Vec_t& e) {
ROOT::Math::PtEtaPhiEVector p1(pt[0], eta[0], phi[0], e[0]);
ROOT::Math::PtEtaPhiEVector p2(pt[1], eta[1], phi[1], e[1]);
return (p1 + p2).mass() / 1000.0;
}
""")
"""
)

# Define a new column with the invariant mass and perform final event selection
hists = {}
for p in processes:
# Make four vectors and compute invariant mass
df[p] = df[p].Define("m_yy", "ComputeInvariantMass(photon_pt[goodphotons], photon_eta[goodphotons], photon_phi[goodphotons], photon_E[goodphotons])")
df[p] = df[p].Define(
"m_yy",
"ComputeInvariantMass(photon_pt[goodphotons], photon_eta[goodphotons], photon_phi[goodphotons], photon_E[goodphotons])",
)

# Make additional kinematic cuts and select mass window
df[p] = df[p].Filter("photon_pt[goodphotons][0] / 1000.0 / m_yy > 0.35")\
.Filter("photon_pt[goodphotons][1] / 1000.0 / m_yy > 0.25")\
.Filter("m_yy > 105 && m_yy < 160")
df[p] = (
df[p]
.Filter("photon_pt[goodphotons][0] / 1000.0 / m_yy > 0.35")
.Filter("photon_pt[goodphotons][1] / 1000.0 / m_yy > 0.25")
.Filter("m_yy > 105 && m_yy < 160")
)

# Book histogram of the invariant mass with this selection
hists[p] = df[p].Histo1D(
ROOT.RDF.TH1DModel(p, "Diphoton invariant mass; m_{#gamma#gamma} [GeV];Events", 30, 105, 160),
"m_yy", "weight")
ROOT.RDF.TH1DModel(p, "Diphoton invariant mass; m_{#gamma#gamma} [GeV];Events", 30, 105, 160), "m_yy", "weight"
)

# Run the event loop

Expand All @@ -100,8 +128,8 @@
# Create canvas with pads for main plot and data/MC ratio
c = RCanvas.Create("df104_HiggsToTwoPhotons")

lower_pad = c.AddPad(RPadPos(0,0.65), RPadExtent(1, 0.35))
upper_pad = c.AddPad(RPadPos(0,0), RPadExtent(1, 0.65))
lower_pad = c.AddPad(RPadPos(0, 0.65), RPadExtent(1, 0.35))
upper_pad = c.AddPad(RPadPos(0, 0), RPadExtent(1, 0.65))

upper_frame = upper_pad.AddFrame()
upper_frame.margins.bottom = 0
Expand Down Expand Up @@ -239,5 +267,5 @@
c.Show()

# Save plot in PNG file
if c.SaveAs("df104.png") :
print("Saved figure to df104.png")
if c.SaveAs("df104.png"):
print("Saved figure to df104.png")
Loading
Loading