Skip to content

Commit 683036c

Browse files
authored
[tutorials] Get rid of experimental category (#18153)
* [tutorial] Change path * Remove ROOT7 warning * [tutorial] Move RCanvas tutorials to Visualization * Apply formatting
1 parent 36a7a7e commit 683036c

34 files changed

+254
-188
lines changed

gui/browserv7/inc/ROOT/RBrowser.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Authors: Bertrand Bellenot <[email protected]> Sergey Linev <[email protected]>
22
// Date: 2019-02-28
3-
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
43

54
/*************************************************************************
65
* Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *

gui/browserv7/inc/ROOT/RBrowserData.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Author: Sergey Linev <[email protected]>
22
// Date: 2019-10-14
3-
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
43

54
/*************************************************************************
65
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *

gui/browserv7/inc/ROOT/RBrowserReply.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Authors: Bertrand Bellenot <[email protected]> Sergey Linev <[email protected]>
22
// Date: 2019-02-28
3-
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
43

54
/*************************************************************************
65
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *

gui/browserv7/inc/ROOT/RBrowserRequest.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Authors: Bertrand Bellenot <[email protected]> Sergey Linev <[email protected]>
22
// Date: 2019-02-28
3-
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
43

54
/*************************************************************************
65
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *

gui/browserv7/inc/ROOT/RFileDialog.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Author: Sergey Linev <[email protected]>
22
// Date: 2019-10-31
3-
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
43

54
/*************************************************************************
65
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *

gui/browserv7/inc/ROOT/RWebBrowserImp.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Author: Sergey Linev <[email protected]>
22
// Date: 2021-02-11
3-
// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
43

54
/*************************************************************************
65
* Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *

tutorials/CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ if(NOT xrootd)
193193
analysis/dataframe/df106_HiggsToFourLeptons.py
194194
analysis/dataframe/df107_SingleTopAnalysis.py
195195
roofit/roofit/rf618_mixture_models.py # depends on df106_HiggsToFourLeptons.py
196-
experimental/rcanvas/df104.py
197-
experimental/rcanvas/df105.py
196+
visualisation/rcanvas/df104.py
197+
visualisation/rcanvas/df105.py
198198
)
199199
endif()
200200

@@ -293,7 +293,7 @@ set(gui_veto math/fit/fitpanel_playback.C
293293
visualisation/webgui/panel/webpanel.cxx
294294
visualisation/webgui/webwindow/webwindow.cxx)
295295
if (NOT webgui)
296-
list(APPEND gui_veto visualisation/graphics/save_batch.C experimental/rcanvas/df104.py experimental/rcanvas/df105.py)
296+
list(APPEND gui_veto visualisation/graphics/save_batch.C visualisation/rcanvas/df104.py visualisation/rcanvas/df105.py)
297297
endif()
298298

299299
if (NOT ROOT_tmva_FOUND)
@@ -374,10 +374,9 @@ endif()
374374

375375
if(root7)
376376
set(root7_veto analysis/dataframe/df013_InspectAnalysis.C
377-
experimental/browser.cxx
378-
experimental/filedialog.cxx
379-
experimental/fitpanel.cxx
380-
experimental/fitpanel6.cxx
377+
tutorials/visualisation/webgui/browserv7/browser.cxx
378+
tutorials/visualisation/webgui/browserv7/filedialog.cxx
379+
tutorials/visualisation/webgui/fitpanelv7/fitpanel6.cxx
381380
)
382381
if(NOT davix)
383382
list(APPEND root7_veto io/ntuple/ntpl004_dimuon.C)
@@ -388,20 +387,20 @@ if(root7)
388387
list(APPEND root7_veto io/ntuple/ntpl011_global_temperatures.C)
389388
list(APPEND root7_veto io/ntuple/ntpl004_dimuon.C)
390389
list(APPEND root7_veto io/ntuple/ntpl008_import.C)
391-
list(APPEND root7_veto experimental/rcanvas/df104.py)
392-
list(APPEND root7_veto experimental/rcanvas/df105.py)
390+
list(APPEND root7_veto visualisation/rcanvas/df104.py)
391+
list(APPEND root7_veto visualisation/rcanvas/df105.py)
393392
endif()
394393
if(MSVC AND NOT win_broken_tests)
395394
#---EOS is not supported on Windows
396-
list(APPEND root7_veto experimental/rcanvas/df104.py)
397-
list(APPEND root7_veto experimental/rcanvas/df105.py)
398-
list(APPEND root7_veto experimental/rcanvas/rbox.py)
395+
list(APPEND root7_veto visualisation/rcanvas/df104.py)
396+
list(APPEND root7_veto visualisation/rcanvas/df105.py)
397+
list(APPEND root7_veto visualisation/rcanvas/rbox.py)
399398
endif()
400399
else()
401400
if(MSVC AND NOT win_broken_tests)
402401
list(APPEND root7_veto analysis/dataframe/df013_InspectAnalysis.C)
403402
endif()
404-
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)
403+
file(GLOB v7_veto_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ visualisation/webgui/browserv7/*.cxx visualisation/webgui/fitpanelv7/*.cxx visualisation/rcanvas/*.py visualisation/rcanvas/*.cxx)
405404
list(APPEND root7_veto ${v7_veto_files})
406405
# This depends on ntupleutil
407406
list(APPEND root7_veto io/ntuple/ntpl008_import.C)
@@ -512,7 +511,7 @@ if(webgui)
512511
list(APPEND tutorials ${visualisation/tutorials_webcanv})
513512
endif()
514513
if(root7 AND webgui)
515-
file(GLOB_RECURSE tutorials_exp RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} experimental/*.cxx)
514+
file(GLOB_RECURSE tutorials_exp RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} visualisation/rcanvas/*.cxx tutorials/visualisation/webgui/browserv7/*.cxx tutorials/visualisation/webgui/fitpanelv7/*.cxx)
516515
list(APPEND tutorials ${tutorials_exp})
517516
endif()
518517
file(GLOB tutorials_veto RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${all_veto})
@@ -640,7 +639,7 @@ file(GLOB long_running RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${long_running})
640639
set(NProcessors 4)
641640
set (multithreaded_all_cores
642641
analysis/dataframe/df10[2-7]*
643-
experimental/rcanvas/df10*
642+
visualisation/rcanvas/df10*
644643
)
645644
set (multithreaded
646645
${multithreaded_all_cores}

tutorials/experimental/index.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

tutorials/visualisation/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
\ingroup tutorial_visualisation
3333
\brief Various examples showing the OpenGL graphics in ROOT.
3434

35+
\defgroup tutorial_rcanvas RCanvas examples
36+
\ingroup tutorial_visualisation
37+
\brief These are RCanvas examples.
38+
3539
\defgroup tutorial_cocoa Tutorials specific to Mac/Cocoa
3640
\ingroup tutorial_visualisation
3741
\brief Various examples showing graphics done with the Mac graphics system Cocoa.

tutorials/experimental/rcanvas/df104.py renamed to tutorials/visualisation/rcanvas/df104.py

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,35 @@
2121

2222
import ROOT
2323
import os
24-
from ROOT.Experimental import RCanvas, RText, RAttrText, RAttrFont, RAttrFill, RAttrLine, RLegend, RPadPos, RPadExtent, TObjectDrawable
24+
from ROOT.Experimental import (
25+
RCanvas,
26+
RText,
27+
RAttrText,
28+
RAttrFont,
29+
RAttrFill,
30+
RAttrLine,
31+
RLegend,
32+
RPadPos,
33+
RPadExtent,
34+
TObjectDrawable,
35+
)
2536

2637
# Enable multi-threading
2738
ROOT.ROOT.EnableImplicitMT()
2839

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

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

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

4860
# Find two good muons with tight ID, pt > 25 GeV and not in the transition region between barrel and encap
49-
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))")\
50-
.Filter("Sum(goodphotons) == 2")
61+
df[p] = (
62+
df[p]
63+
.Define(
64+
"goodphotons",
65+
"photon_isTightID && (photon_pt > 25000) && (abs(photon_eta) < 2.37) && ((abs(photon_eta) < 1.37) || (abs(photon_eta) > 1.52))",
66+
)
67+
.Filter("Sum(goodphotons) == 2")
68+
)
5169

5270
# Take only isolated photons
53-
df[p] = df[p].Filter("Sum(photon_ptcone30[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")\
54-
.Filter("Sum(photon_etcone20[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
71+
df[p] = (
72+
df[p]
73+
.Filter("Sum(photon_ptcone30[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
74+
.Filter("Sum(photon_etcone20[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
75+
)
5576

5677
# Compile a function to compute the invariant mass of the diphoton system
5778
ROOT.gInterpreter.Declare(
58-
"""
79+
"""
5980
using Vec_t = const ROOT::VecOps::RVec<float>;
6081
float ComputeInvariantMass(Vec_t& pt, Vec_t& eta, Vec_t& phi, Vec_t& e) {
6182
ROOT::Math::PtEtaPhiEVector p1(pt[0], eta[0], phi[0], e[0]);
6283
ROOT::Math::PtEtaPhiEVector p2(pt[1], eta[1], phi[1], e[1]);
6384
return (p1 + p2).mass() / 1000.0;
6485
}
65-
""")
86+
"""
87+
)
6688

6789
# Define a new column with the invariant mass and perform final event selection
6890
hists = {}
6991
for p in processes:
7092
# Make four vectors and compute invariant mass
71-
df[p] = df[p].Define("m_yy", "ComputeInvariantMass(photon_pt[goodphotons], photon_eta[goodphotons], photon_phi[goodphotons], photon_E[goodphotons])")
93+
df[p] = df[p].Define(
94+
"m_yy",
95+
"ComputeInvariantMass(photon_pt[goodphotons], photon_eta[goodphotons], photon_phi[goodphotons], photon_E[goodphotons])",
96+
)
7297

7398
# Make additional kinematic cuts and select mass window
74-
df[p] = df[p].Filter("photon_pt[goodphotons][0] / 1000.0 / m_yy > 0.35")\
75-
.Filter("photon_pt[goodphotons][1] / 1000.0 / m_yy > 0.25")\
76-
.Filter("m_yy > 105 && m_yy < 160")
99+
df[p] = (
100+
df[p]
101+
.Filter("photon_pt[goodphotons][0] / 1000.0 / m_yy > 0.35")
102+
.Filter("photon_pt[goodphotons][1] / 1000.0 / m_yy > 0.25")
103+
.Filter("m_yy > 105 && m_yy < 160")
104+
)
77105

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

83111
# Run the event loop
84112

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

103-
lower_pad = c.AddPad(RPadPos(0,0.65), RPadExtent(1, 0.35))
104-
upper_pad = c.AddPad(RPadPos(0,0), RPadExtent(1, 0.65))
131+
lower_pad = c.AddPad(RPadPos(0, 0.65), RPadExtent(1, 0.35))
132+
upper_pad = c.AddPad(RPadPos(0, 0), RPadExtent(1, 0.65))
105133

106134
upper_frame = upper_pad.AddFrame()
107135
upper_frame.margins.bottom = 0
@@ -239,5 +267,5 @@
239267
c.Show()
240268

241269
# Save plot in PNG file
242-
if c.SaveAs("df104.png") :
243-
print("Saved figure to df104.png")
270+
if c.SaveAs("df104.png"):
271+
print("Saved figure to df104.png")

0 commit comments

Comments
 (0)