Last active
February 26, 2022 08:17
-
-
Save MohamedElashri/dab00a84ba6a65f99fb2694504ecc39e to your computer and use it in GitHub Desktop.
This is the way to install ROOT CERN in Google Colab,.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is for installing ROOT on Google Colab to be able to install root_numpy and root_pandas package later | |
# for version of this code which work with python3 visit | |
#https://gist.github.com/MohamedElashri/1b0367992988f053a02dbfd5797fb59e | |
!mkdir -p APPS | |
!pwd | |
!cd APPS && wget https://root.cern.ch/download/root_v6.13.08.Linux-ubuntu18-x86_64-gcc7.3.tar.gz | |
!cd APPS && tar -xf root_v6.13.08.Linux-ubuntu18-x86_64-gcc7.3.tar.gz | |
import sys | |
sys.path.append("/content/APPS/root/lib") | |
import ctypes | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMultiProc.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libCore.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libThread.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libImt.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libRIO.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libNet.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libGraf3d.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libTreePlayer.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMultiProc.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libTree.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMathCore.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMatrix.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libHist.so') | |
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libGraf.so') | |
import ROOT | |
h = ROOT.TH1F("gauss","Example histogram",100,-4,4) | |
h.FillRandom("gaus") | |
c = ROOT.TCanvas("myCanvasName","The Canvas Title",800,600) | |
h.Draw() | |
c.Draw() |
Hi Mohamed,
Thank you so much for this! It worked great for me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is an the example working on colab with py2.
https://github.com/gmazzitelli/studenti/blob/master/read_image_root_py2.ipynb
actually reading the root file https://s3.cloud.infn.it/v1/AUTH_2ebf769785574195bde2ff418deac08a/cygnus/Data/LAB/histograms_Run04020.root