Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
fcea5be
[TO REVERT] Add verbose printouts to df103_NanoAODHiggsAnalysis.C
eguiraud Aug 27, 2020
43e723a
[ntuple] add RNTupleDescriptor::GetQualifiedFieldName()
jblomer Aug 27, 2020
4b16494
[ntuple] Add RFieldFuse::ConnectRecursively()
jblomer Aug 27, 2020
3decc84
[ntuple] use low-level read API in RDF source
jblomer Aug 27, 2020
2130a87
[ntuple] Improve code comment (NFC)
jblomer Aug 28, 2020
a9d9eb1
[ntuple] Improve code comment (NFC)
jblomer Aug 28, 2020
668e044
[Tutorials] Run df10* tutorials serially in ctest.
hageboeck Aug 28, 2020
24717db
Convert pcm header duplication check script from bash to Python
reikdas Aug 26, 2020
6d1f2a0
[geom] fix pcon/pgon TBuffer3D filling (ROOT-11015)
linev Aug 27, 2020
e0a6d9f
[webgui] use const std::string& in several methods
linev Aug 27, 2020
ebf3218
[cef] let run batch job without creating temporary HTML file
linev Aug 28, 2020
b2c8943
[qt5web] let run batch job without creating temporary HTML file
linev Aug 28, 2020
b685d5b
[cef] correctly close headless browser at the end of batch job
linev Aug 28, 2020
2c18a65
[qt5web] let store page content as PDF in batch mode
linev Aug 28, 2020
12dde72
[cef] support PDF file generations
linev Aug 28, 2020
f9f67c2
[cef] use CefResourceRequestHandler to handle HTTP requests
linev Aug 28, 2020
c464388
[jsroot] dev 26/08/2020
linev Aug 28, 2020
dbd2414
Revert "[TO REVERT] Add verbose printouts to df103_NanoAODHiggsAnalys…
eguiraud Aug 28, 2020
80a8fbf
When normalizing template names, don't split inside parenthesis.
pcanal Aug 25, 2020
3fe6b82
[PyROOT] Add TTree pythonization docs
etejedor Aug 31, 2020
a8bee4e
[cmake] fix file copy rules in CEF
linev Aug 31, 2020
a310e53
[cmake] adjust CEF build files for Mac
linev Aug 31, 2020
4ad3fe7
Improve TH1::GetCumulative to take into account axis ranges.
lmoneta Aug 31, 2020
923445d
fix compilation warnings
lmoneta Aug 31, 2020
8b7ba03
[PyROOT] Add deprecation warning for TTree.AsMatrix
stwunsch Sep 1, 2020
7bc9fad
[PyROOT] Mention deprecation of TTree.AsMatrix in release notes
stwunsch Sep 1, 2020
ceb9bcc
[cling] Remove statement about "policy restrictions" wrt repos (NFC);
Axel-Naumann Sep 1, 2020
71dba00
fix atlas style (#6291)
couet Sep 2, 2020
4915ce4
[DF] Do not copy Display arguments
eguiraud Sep 1, 2020
dd43c3c
[DF] Add test for move-only type in Display
eguiraud Sep 1, 2020
013c000
[roofitcore] Add missing (minimal) include.
Axel-Naumann Sep 2, 2020
43a5d12
[rcanvas] add missing include (#6290)
linev Sep 2, 2020
67b0f53
[PyROOT][Doc] Document TDirectory pythonizations
etejedor Sep 2, 2020
3402c40
[PyROOT][Doc] Document TDirectoryFile pythonizations
etejedor Sep 2, 2020
a137211
[PyROOT][Doc] Document TFile pythonizations
etejedor Sep 2, 2020
bc231d0
[cmake] Build xrootd in release mode with warnings enabled
stwunsch Sep 2, 2020
908d6b2
Shorten long paths and display number of duplicating modules.
vgvassilev Sep 2, 2020
e537fd9
Fix TF2,3::Moment2 for compiled function
lmoneta Aug 28, 2020
b201150
Add test for TF1,TF2 and TF3 functions computing the moments
lmoneta Aug 28, 2020
d198237
Do not use gRandom in multi-threads. Use a random generator for each …
lmoneta Aug 27, 2020
ebdbd58
Fix TH1::merge in case of multi-dimensional histograms when only one…
lmoneta Aug 18, 2020
9939311
Fix 2d and 3D labels diff merge tests in stressHistogram.
lmoneta Aug 18, 2020
383eef4
Improve stressHistogram by adding the command line option to run a si…
lmoneta Aug 19, 2020
0953dc5
Fix Alphabetically ordering of labels in case label list does not fol…
lmoneta Aug 21, 2020
b813009
Fix ordering of labels in increasing/decreasing order for 2d histograms
lmoneta Aug 24, 2020
fca2211
- Add support for underflow overflows when ordering 2d label histograms
lmoneta Aug 24, 2020
ddf450a
-Implement Sorting of histogram according to labels also for 3D histo…
lmoneta Aug 25, 2020
490da59
Add error message when invalid option is passed in TH1::LabelsOption
lmoneta Aug 25, 2020
a76dbe9
- Add corrections as suggested by Axel's review
lmoneta Sep 3, 2020
b5bc5d4
[PyROOT] Use GetScopedFinalName to support TTree subclasses in namesp…
scott-snyder Sep 4, 2020
63aeb0d
[PyROOT] Add test for getattr of TTree subclasses in namespaces
etejedor Sep 4, 2020
6fc9f57
[modules] Correctly parse LateParsedTemplates in case of dependent mo…
gargvaibhav64 Sep 4, 2020
c1054ec
Switch back to llvm::make_unique to support C++11
gargvaibhav64 Sep 4, 2020
b18c390
[cmake] adjust windows cmake file for CEF, provide short docu
linev Sep 1, 2020
9baa21a
[cef] add missing includes, fix windows handler
linev Sep 4, 2020
91bbe7f
[cmake] on Linux copy some CEF files into bin/ sub-directory
linev Sep 4, 2020
0a65afd
[cef] set different file paths in CefSettings
linev Sep 4, 2020
860df98
fixed code to load JupyROOT in python2
omazapa Sep 4, 2020
705a611
[JupyROOT] Support installation of JupyROOT lib on Python directories
etejedor Sep 7, 2020
cb12fe4
[RF] Warn in RooRealBinding when users pass copies of parameters.
hageboeck Aug 27, 2020
696c0ee
Only install the xproofd script and man page if xproofd option is on
ellert Aug 30, 2020
9ef8b75
Example showing how to produce a perceptual palette (#6314)
couet Sep 7, 2020
f1a2b8c
remove unused variable
couet Sep 7, 2020
43bf7de
[DF] Reduce amount of templates used for column readers
eguiraud Sep 6, 2020
cfa946d
[DF][NFC] RDFValueTuple_t is now a misnomer, remove it
eguiraud Sep 6, 2020
10f8e0a
[DF][NFC] RDefineReader does not need the template parameter
eguiraud Sep 6, 2020
3b623b2
[DF] Use dtors to perform clean-up tasks in column readers
eguiraud Sep 6, 2020
e7b11be
[DF][NFC] Rename RFilter::{ClearTask => FinaliseSlot}
eguiraud Sep 6, 2020
9cdd812
[DF][NFC] Rename RDefine::{CLearValueReaders => FinaliseSlot}
eguiraud Sep 6, 2020
3f06eae
[DF][NFC] Add more docstrings
eguiraud Sep 7, 2020
b4b7bb3
[DF][NFC] Return a value instead of using an output parameter
eguiraud Sep 7, 2020
0e4d168
Add possibility to pass an external generator in TF1,2,3::GetRandom a…
lmoneta Aug 26, 2020
d36e496
Update doxygen comments as Suggested by Stephan's review
lmoneta Sep 7, 2020
4d29e99
Formatting and help editing (#6318)
couet Sep 8, 2020
02057e3
[RF][NFC] Simplify code in RooGenProdProj.
hageboeck Sep 7, 2020
48d7515
[RF] Add test for ROOT-7720, RooProdPdf.
hageboeck Sep 7, 2020
8eb0309
[RF] Fix ROOT-7720.
hageboeck Sep 7, 2020
ce1aa8a
[RF][Docs] Update docs for RooGenProdProj.
hageboeck Sep 7, 2020
7a7ae80
Remove double definition of a static variable.
lmoneta Sep 3, 2020
976a682
Make static variable DecisionTreeNode::fgIsTraining protected and add…
lmoneta Sep 7, 2020
23fbba2
[PyROOT][ROOT-11027] Revert activation of batch mode made by cppyy
etejedor Sep 8, 2020
afe74e3
Correctly handle an non-dependent noexcept expr in function template
Oct 12, 2017
290b29c
[clang] Apply parts of llvm svn 318570 (clang-tidy):
Axel-Naumann Sep 2, 2020
776492d
[clang] Backport llvm svn 331428:
Axel-Naumann Sep 2, 2020
30bebf8
[cling] Adjust to changed clang::ExceptionSpecificationType.
Axel-Naumann Sep 3, 2020
ba8b202
Revert "[cling] Set exceptSpecType to be updated:"
Axel-Naumann Sep 7, 2020
81a1221
Revert "[cxxmodules] Delay constexpr evaluation of exception spec whe…
Axel-Naumann Sep 7, 2020
423fa66
Revert "[cling] Make sure declchain is deserialized:"
Axel-Naumann Sep 7, 2020
fab49d8
Adding a forgotten closing bracket in a warning
YuryYury Sep 5, 2020
42e2a07
[cling] Add missing windows-include.
SylvainCorlay Aug 27, 2020
cdffd55
[NFC] Fix formatting of TTreeReaderValue::Get
eguiraud Sep 8, 2020
f9cd25a
[NFC] Mention TTreeReader::Next in error message
eguiraud Sep 8, 2020
d0ae8c1
[DF] Use std::array for column readers
eguiraud Sep 8, 2020
c234c70
[DF][NFC] Add extra set of braces to silence warnings on gcc4.8.5
eguiraud Sep 9, 2020
48c5bf3
[PYMVA] Add Pytorch cmake
AnirudhDagar May 31, 2020
3dce411
[PYMVA] Add MethodPyTorch header
AnirudhDagar May 31, 2020
38e06e4
[PyMVA] Add MethodPyTorch Constructors
AnirudhDagar Jul 17, 2020
79a6299
[PyMVA] Add MethodPyTorch::DeclareOptions
AnirudhDagar Jul 17, 2020
3374edc
[PyMVA] Add MethodPyTorch::GetNumValidationSamples
AnirudhDagar Jul 17, 2020
87df308
[PyMVA] Add MethodPyTorch::ProcessOptions
AnirudhDagar Jul 17, 2020
9318047
[PyMVA] Add MethodPyTorch::SetupTorchModel
AnirudhDagar Jul 17, 2020
649a34b
[PyMVA] Add UserCode & MethodPyTorch::Init
AnirudhDagar Jul 17, 2020
abe135e
[PyMVA] Add MethodPyTorch::Train
AnirudhDagar Jul 17, 2020
b7de854
[PYMVA] Add MethodPyTorch::GetMVAValue & UserCode option
AnirudhDagar Jul 23, 2020
7773c4f
[PYMVA] Add LinkDef
AnirudhDagar Jul 23, 2020
40ae39f
[PYMVA] Load Optimizer, Loss, Train functions
AnirudhDagar Jul 24, 2020
d0f12b0
[PYMVA] Add Classification Test
AnirudhDagar Jul 24, 2020
a3b882b
[PyMVA] Add Predict Func & Fix PyTorch Tests
AnirudhDagar Aug 25, 2020
ca663de
[PyMVA] Add PyTorch Dataloaders & Optional Optimizer
AnirudhDagar Aug 25, 2020
a149a30
[PyMVA] Add lr scheduler & SaveBestOnly Options
AnirudhDagar Aug 25, 2020
9cac392
[PyMVA] Add complete test suite (classification, multiclass, regression)
AnirudhDagar Aug 25, 2020
9254294
[PyMVA] Add PyTorch tests to CMakelists
AnirudhDagar Aug 26, 2020
dcfa93e
[PyMVA] Fix PyTorch model setup
AnirudhDagar Aug 28, 2020
4f9904a
[PyMVA] Use .py file to load model in test
AnirudhDagar Aug 28, 2020
67cd94f
[PyMVA] CMake: Apply Patch
AnirudhDagar Sep 9, 2020
49b773d
[metacling] Remove test dependency on llvm:
Axel-Naumann Aug 24, 2020
8586fc2
[cmake] Enable forgotten metacling tests; remove now unused llvm libs.
Axel-Naumann Aug 24, 2020
eeeec28
[metacling] Expose using decls; reimplement iteration (ROOT-10789):
Axel-Naumann Aug 24, 2020
4644e61
[metacling] In GetFunctionOverloads, also look in unnamed nested name…
Axel-Naumann Aug 31, 2020
9f5806e
[metacling] On Windows, suppress failing &cout test, too.
Axel-Naumann Sep 4, 2020
0fbfb2e
[metacling] Fix using-ctor constructing base object (ROOT-11010):
Axel-Naumann Sep 7, 2020
64dbf2c
[metacling] Cache with usingdecl as key (ROOT-10789, part 2):
Axel-Naumann Sep 8, 2020
206496d
[metacling] Disable part of the test on Windows.
Axel-Naumann Sep 9, 2020
de48dee
[fastcgi] Adjust code for Apache 2.4
linev Sep 11, 2020
f2e8d6a
[http] update docu about Apache FastCGI
linev Sep 11, 2020
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
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,12 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_INSTALL_PREFIX)
if(webgui)
install(DIRECTORY ui5/ DESTINATION ${CMAKE_INSTALL_OPENUI5DIR})
endif()
install(DIRECTORY man/ DESTINATION ${CMAKE_INSTALL_MANDIR})
if(xproofd AND xrootd AND ssl)
set(MAN_PATT_EXCL)
else()
set(MAN_PATT_EXCL PATTERN xproofd.1 EXCLUDE)
endif()
install(DIRECTORY man/ DESTINATION ${CMAKE_INSTALL_MANDIR} ${MAN_PATT_EXCL})
install(DIRECTORY tutorials/ DESTINATION ${CMAKE_INSTALL_TUTDIR} COMPONENT tests)
install(FILES
cmake/modules/RootMacros.cmake
Expand Down
4 changes: 4 additions & 0 deletions README/ReleaseNotes/v624/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,7 @@ The following people have contributed to this new version:
## Build, Configuration and Testing Infrastructure

- a new cmake variable, `CMAKE_INSTALL_PYTHONDIR`, has been added: it allows customization of the installation directory of ROOT's python modules

## PyROOT

- Deprecate `TTree.AsMatrix` in this release and mark for removal in v6.26. Please use instead `RDataFrame.AsNumpy`.
4 changes: 2 additions & 2 deletions bindings/jupyroot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ foreach(val RANGE ${how_many_pythons})
# Install library
install(TARGETS ${libname} EXPORT ${CMAKE_PROJECT_NAME}Exports
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)

endforeach()

Expand Down
10 changes: 7 additions & 3 deletions bindings/pyroot/pythonizations/python/ROOT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
environ['CPPYY_NO_ROOT_FILTER'] = '1'

import cppyy
if not 'ROOTSYS' in environ:
# Revert setting made by cppyy
cppyy.gbl.gROOT.SetBatch(False)

# import libROOTPythonizations with Python version number
import sys, importlib
Expand Down Expand Up @@ -72,10 +75,11 @@ def pythonization_impl(fn):
module = importlib.import_module(pyz.__name__ + '.' + module_name)

# Check if we are in the IPython shell
try:
if major == 3:
import builtins
except ImportError:
import __builtin__ as builtins # Py2
else:
import __builtin__ as builtins

_is_ipython = hasattr(builtins, '__IPYTHON__')

# Configure ROOT facade module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,48 @@
# For the list of contributors see $ROOTSYS/README/CREDITS. #
################################################################################

r'''
/**
\class TDirectory
\brief \parblock \endparblock
\htmlonly
<div class="pyrootbox">
\endhtmlonly
## PyROOT

From Python, it is possible to inspect the content of a TDirectory object
as if the subdirectories and objects it contains were its attributes.
Moreover, once a subdirectory or object is accessed for the first time,
it is cached for later use.
For example, assuming `d` is a TDirectory instance:
\code{.py}
# Access a subdirectory
d.subdir

# We can go further down in the hierarchy of directories
d.subdir.subsubdir

# Access an object (e.g. a histogram) in the directory
d.obj

# ... or in a subdirectory
d.subdir.obj

# Wrong attribute: raises AttributeError
d.wrongAttr
\endcode

Furthermore, TDirectory implements a `WriteObject` Python method which relies
on TDirectory::WriteObjectAny. This method is a no-op for TDirectory objects,
but it is useful for objects of TDirectory subclasses such as TDirectoryFile
and TFile, which inherit it. Please refer to the documentation of those classes
for more information.
\htmlonly
</div>
\endhtmlonly
*/
'''

from libROOTPythonizations import AddDirectoryGetAttrPyz, AddDirectoryWritePyz
from ROOT import pythonization
import cppyy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,64 @@
# For the list of contributors see $ROOTSYS/README/CREDITS. #
################################################################################

r'''
/**
\class TDirectoryFile
\brief \parblock \endparblock
\htmlonly
<div class="pyrootbox">
\endhtmlonly
## PyROOT

In the same way as for TDirectory, it is possible to inspect the content of a
TDirectoryFile object from Python as if the subdirectories and objects it
contains were its attributes. For more information, please refer to the
TDirectory documentation.

In addition to the attribute syntax, one can inspect a TDirectoryFile in Python
via the `Get` method. In this case, the subdirectory/object name is specified
as a string:
\code{.py}
# Access a subdirectory
d.Get('subdir')

# We can go further down in the hierarchy of directories
d.Get('subdir/subsubdir')

# Access an object (e.g. a histogram) in the directory
d.Get('obj')

# ... or in a subdirectory
d.Get('subdir/obj')

# Wrong attribute: returns null
x = d.Get('wrongAttr') # x points to null
\endcode

Furthermore, TDirectoryFile inherits a `WriteObject` Python method from
TDirectory. Such method allows to write an object into a TDirectoryFile
with the following syntax:
\code{.py}
# Write object obj with identifier 'keyName'
d.WriteObject(obj, 'keyName')
\endcode
\htmlonly
</div>
\endhtmlonly
*/
'''

from libROOTPythonizations import AddTDirectoryFileGetPyz
from ROOT import pythonization

"""
TDirectoryFile inherits from TDirectory the pythonized attr syntax (__getattr__)
and WriteObject method.
On the other side, the Get() method is pythonised only in TDirectoryFile.
Thus, the situation is now the following:
# Pythonizor function
@pythonization()
def pythonize_tdirectoryfile(klass, name):
"""
TDirectoryFile inherits from TDirectory the pythonized attr syntax (__getattr__)
and WriteObject method.
On the other side, the Get() method is pythonised only in TDirectoryFile.
Thus, the situation is now the following:

1) __getattr__ : TDirectory --> TDirectoryFile --> TFile
1.1) caches the returned object for future attempts
Expand All @@ -24,12 +74,7 @@
2) Get() : TDirectoryFile --> TFile
2.1) does not cache the returned object
2.2 returns nullptr if object not found

"""

# Pythonizor function
@pythonization()
def pythonize_tdirectoryfile(klass, name):
"""

if name == 'TDirectoryFile':
AddTDirectoryFileGetPyz(klass)
Expand Down
38 changes: 34 additions & 4 deletions bindings/pyroot/pythonizations/python/ROOT/pythonization/_tfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,35 @@
# For the list of contributors see $ROOTSYS/README/CREDITS. #
################################################################################

# TFile inherits from
# - TDirectory the pythonized attr syntax (__getattr__) and WriteObject method.
# - TDirectoryFile the pythonized Get method (pythonized only in Python)
# what is left to add is the pythonization of TFile::Open.
r'''
/**
\class TFile
\brief \parblock \endparblock
\htmlonly
<div class="pyrootbox">
\endhtmlonly
## PyROOT

In the same way as for TDirectory, it is possible to inspect the content of a
TFile object from Python as if the directories and objects it contains were its
attributes. For more information, please refer to the TDirectory documentation.

In addition, TFile instances can be inspected via the `Get` method, a feature
that is inherited from TDirectoryFile (please see the documentation of
TDirectoryFile for examples on how to use it).

In order to write objects into a TFile, the `WriteObject` Python method can
be used (more information in the documentation of TDirectoryFile).

Finally, PyROOT modifies the TFile constructor and the TFile::Open
method to make them behave in a more pythonic way. In particular,
they both throw an `OSError` if there was a problem accessing the
file (e.g. non-existent or corrupted file).
\htmlonly
</div>
\endhtmlonly
*/
'''

from libROOTPythonizations import AddFileOpenPyz
from ROOT import pythonization
Expand Down Expand Up @@ -45,6 +70,11 @@ def _TFileOpen(klass, *args):
# Pythonizor function
@pythonization()
def pythonize_tfile(klass, name):
"""
TFile inherits from
- TDirectory the pythonized attr syntax (__getattr__) and WriteObject method.
- TDirectoryFile the pythonized Get method (pythonized only in Python)
"""

if name == 'TFile':
# Pythonizations for TFile::Open
Expand Down
125 changes: 125 additions & 0 deletions bindings/pyroot/pythonizations/python/ROOT/pythonization/_ttree.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,128 @@
# For the list of contributors see $ROOTSYS/README/CREDITS. #
################################################################################

r'''
/**
\class TTree
\brief \parblock \endparblock
\htmlonly
<div class="pyrootbox">
\endhtmlonly
## PyROOT

The TTree class has several additions for its use from Python, which are also
available in its subclasses e.g. TChain and TNtuple.

First, TTree instances are iterable in Python. Therefore, assuming `t` is
a TTree instance, we can do:
\code{.py}
for entry in t:
x = entry.branch_name
...
\endcode

At each iteration, a new entry of the tree will be read. In the code above,
`entry` allows to access the branch values for the current entry. This can be
done with the syntax `entry.branch_name` or, if the branch name is incompatible
with Python naming rules, with e.g. "getattr(entry, '1_branch_name')".

<em>Please note</em> that iterating in Python can be slow, so only iterate over
a tree as described above if performance is not an issue or when dealing with
a small dataset. To read and process the entries of a tree in a much faster
way, please use ROOT::RDataFrame.

Second, a couple of TTree methods have been modified to facilitate their use
from Python: TTree::Branch and TTree::SetBranchAddress.

Regarding TTree::Branch, the following example shows how we can create
different types of branches of a TTree. Note that `Branch` will just link
the new branch with a given Python object, so it is still necessary to fill
such object with the desired content before calling TTree::Fill.
\code{.py}
from array import array
import numpy as np
import ROOT
from ROOT import addressof

# Basic type branch (float) - use array of length 1
n = array('f', [ 1.5 ])
t.Branch('floatb', n, 'floatb/F')

# Array branch - use array of length N
N = 10
a = array('d', N*[ 0. ])
t.Branch('arrayb', a, 'arrayb[' + str(N) + ']/D')

# Array branch - use NumPy array of length N
npa = np.array(N*[ 0. ])
t.Branch('nparrayb', npa, 'nparrayb[' + str(N) + ']/D')

# std::vector branch
v = ROOT.std.vector('double')(N*[ 0. ])
t.Branch('vectorb0', v)

# Class branch / struct in single branch
cb = ROOT.MyClass()
t.Branch('classb', cb)

# Struct as leaflist
# Assuming:
# struct MyStruct {
# int myint;
# float myfloat;
# };
ms = ROOT.MyStruct()
t.Branch('structll', ms, 'myint/I:myfloat/F')

# Store struct members individually
ms = ROOT.MyStruct()
# Use `addressof` to get the address of the struct members
t.Branch('myintb', addressof(ms, 'myint'), 'myint/I')
t.Branch('myfloatb', addressof(ms, 'myfloat'), 'myfloat/F')
\endcode

Concerning TTree::SetBranchAddress, below is an example of prepare
the reading of different types of branches of a TTree. Note that
`SetBranchAddress` will just link a given branch with a certain
Python object; after that, in order to read the content of such
branch for a given TTree entry `x`, TTree::GetEntry(x) must be
invoked.
\code{.py}
from array import array
import numpy as np
import ROOT

# Basic type branch (float) - use array of length 1
n = array('f', [ 0. ])
t.SetBranchAddress('floatb', n)

# Array branch - use array of length N
N = 10
a = array('d', N*[ 0. ])
t.SetBranchAddress('arrayb', a)

# Array branch - use NumPy array of length N
npa = np.array(N*[ 0. ])
t.SetBranchAddress('nparrayb', a)

# std::vector branch
v = ROOT.std.vector('double')()
t.SetBranchAddress('vectorb', v)

# Class branch
cb = ROOT.MyClass()
t.SetBranchAddress('classb', cb)

# Struct branch (both single-branch and leaf list)
ms = ROOT.MyStruct()
ds.SetBranchAddress('structb', ms)
\endcode
\htmlonly
</div>
\endhtmlonly
*/
'''

from libROOTPythonizations import AddBranchAttrSyntax, SetBranchAddressPyz, BranchPyz

import cppyy
Expand Down Expand Up @@ -65,6 +187,9 @@ def _TTreeAsMatrix(self, columns=None, exclude=None, dtype="double", return_labe
array(, labels): Numpy array(, labels of columns)
"""

import warnings
warnings.warn("TTree.AsMatrix is deprecated since v6.24 and will be removed in v6.26. Please use instead RDataFrame.AsNumpy.", FutureWarning)

# Import numpy lazily
try:
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion bindings/pyroot/pythonizations/src/PyzCppHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ PyObject *BoolNot(PyObject *value)
// Get the TClass of the C++ object proxied by pyobj
TClass *GetTClass(const CPyCppyy::CPPInstance *pyobj)
{
return TClass::GetClass(Cppyy::GetFinalName(pyobj->ObjectIsA()).c_str());
return TClass::GetClass(Cppyy::GetScopedFinalName(pyobj->ObjectIsA()).c_str());
}

////////////////////////////////////////////////////////////////////////////
Expand Down
Loading