Skip to content

Instantly share code, notes, and snippets.

@jpata
Created July 18, 2016 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpata/398fa8ab8eb741b649baca40cde9cd9f to your computer and use it in GitHub Desktop.
Save jpata/398fa8ab8eb741b649baca40cde9cd9f to your computer and use it in GitHub Desktop.
using Cxx
const ROOT_PATH = "/Users/joosep/Documents/root-build/"
addHeaderDir(joinpath(ROOT_PATH, "include"), kind=C_System)
for lib in ["Core", "RIO", "Hist"]
Libdl.dlopen("$ROOT_PATH/lib$lib.so", Libdl.RTLD_GLOBAL)
end
cxx"""#include <TFile.h> """
cxx"""#include <TH1D.h> """
tf = @cxxnew TFile(pointer("asd.root"), pointer("RECREATE"))
th = @cxxnew TH1D(pointer("h"), pointer("h"), 100, -1.0, 1.0)
for i=1:100000
@cxx th->Fill(randn())
end
@cxx tf->Write()
@cxx tf->Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment