ROOT.jl: ROOT bindings for julia
Provides basic access to the CERN ROOT Framework for the Julia language.
- Julia v0.5
- The current master branch of CXX.jl (until Cxx.jl v0.1.1 or so is released).
- ROOT-6 (ROOT-5 may work, but is no longer recommended)
Enable RTTI for Cxx.jl:
ROOT.jl will install a special Julia executable that initializes ROOT
before starting Julia. This avoids conflicts between Cling's LLVM instance
and Julia's LLVM instance. The ROOT-compatible Julia binary resides at:
joinpath(Pkg.dir("ROOT"), "deps", "usr", "bin", "julia").
You can directly use the standard ROOT API via Cxx.jl:
using ROOT, Cxx cxxinclude("TCanvas.h") cxxinclude("TH1D.h") canvas = icxx"new TCanvas();" hist = icxx"""new TH1D("hist", "Hist", 20, -4, 4);""" for i in 1:100000 @cxx hist->Fill(randn()) end @cxx hist->Draw() @cxx canvas->SaveAs(pointer("myhist.png"))
Julia API wrappers for specific ROOT functionalities are left to more specialized packages.
During startup, ROOT.jl will also enable basic thread-safety for ROOT
It is possible to run certain ROOT operations in multi-threaded Julia code
(e.g. TTree I/O, provided each thread uses a separate
TChain instance.). However, certain operations (e.g. creating and deleting
TChain) are not thread-safe. Use
lock(gROOTMutex()) do # ... non thread-safe code ... end
for non-thread-safe code blocks within multi-threaded code.