root-framework

Installing CERN ROOT on google Jupyter Notebook

淺唱寂寞╮ 提交于 2021-01-28 02:53:58
问题 I have tried to install CERN ROOT http://root.cern.ch on google colaboratory Jupiter notebook https://colab.research.google.com. I can't get python running with ROOT, it crashes at: import ROOT I have been installing ROOT as usual: !mkdir -p APPS !pwd !cd APPS && wget https://root.cern/download/root_v6.16.00.Linux-ubuntu18-x86_64-gcc7.3.tar.gz !cd APPS && tar -xf root_v6.16.00.Linux-ubuntu18-x86_64-gcc7.3.tar.gz !ls APPS/root/bin/thisroot.sh !source APPS/root/bin/thisroot.sh !echo $ROOTSYS

CERN ROOT: Is is possible to plot pairs of x-y data points?

对着背影说爱祢 提交于 2021-01-27 23:32:42
问题 I would like to use CERN ROOT to draw a 2d graph of pairs of x-y datapoints possibly also with y-errorbars . However I only know how to draw histograms. Is this possible with CERN ROOT? If so how? Also I realize that there may be better libraries for doing this. I have been using GNUPlot, but unfortunately I can't seem to integrate it well with my C++ code, since I can't find a C/C++ GNUPlot interface which covers all the features and allows me to send data in a bidirectional manner - ie:

Python C API: omitted variable assignment causes unexpected behaviour

亡梦爱人 提交于 2020-06-25 10:49:32
问题 While using python with pyroot (a python interface to a CERN data analysis package named ROOT), I encountered the following strange behaviour: print ROOT.TFile(fname).GetListOfKeys() outputs None while the seemingly semantically equivalent code f=ROOT.TFile(fname) print f.GetListOfKeys() outputs the expected <ROOT.THashList object ("THashList") at 0x13f0fa0> . While this is hardly the first bug I have encountered while working with ROOT, this time I am quite puzzled that python allows this

Python C API: omitted variable assignment causes unexpected behaviour

穿精又带淫゛_ 提交于 2020-06-25 10:48:13
问题 While using python with pyroot (a python interface to a CERN data analysis package named ROOT), I encountered the following strange behaviour: print ROOT.TFile(fname).GetListOfKeys() outputs None while the seemingly semantically equivalent code f=ROOT.TFile(fname) print f.GetListOfKeys() outputs the expected <ROOT.THashList object ("THashList") at 0x13f0fa0> . While this is hardly the first bug I have encountered while working with ROOT, this time I am quite puzzled that python allows this

Python C API: omitted variable assignment causes unexpected behaviour

对着背影说爱祢 提交于 2020-06-25 10:48:07
问题 While using python with pyroot (a python interface to a CERN data analysis package named ROOT), I encountered the following strange behaviour: print ROOT.TFile(fname).GetListOfKeys() outputs None while the seemingly semantically equivalent code f=ROOT.TFile(fname) print f.GetListOfKeys() outputs the expected <ROOT.THashList object ("THashList") at 0x13f0fa0> . While this is hardly the first bug I have encountered while working with ROOT, this time I am quite puzzled that python allows this

I need to sum up thousands of histograms from one directory

╄→尐↘猪︶ㄣ 提交于 2019-12-24 19:10:55
问题 I have a directory Processed_Data with thousands of hists*****_blinded.root files. Each hists*****_blinded.root contains around 15 graphs and histograms in it. My goal is just to overlap 1 specific histogram sc***** from each file to get the final histogram finalhists_blinded.root which will represent all of those overlapped together. I have tried the following macro: void final() { TCanvas *time = new TCanvas("c1","overlap" ,600,1000); time ->Divide(1,1); time ->cd(1); TH1F *h1 = new TH1F(

CERN ROOT exporting data to plain text

耗尽温柔 提交于 2019-12-24 03:59:20
问题 So I have tried and tried to follow similar questions asked like this one, but to no success. It's really simple - I have some .root files and can see the histograms in ROOT but want to export the data as a .txt or similar to be able to analyse it in other programs. 回答1: Here is working example. Reads in a root file with three branches, named TS, ns, and nserr. #include <iostream> #include "TFile.h" #include "TTree.h" #include <fstream> using namespace std; void dumpTreeTotxt(){ TFile *f=new

Setting up ROOT from Cern in Xcode, linking the librariers correctly

吃可爱长大的小学妹 提交于 2019-12-19 09:41:31
问题 I want to set up ROOT from CERN in my Xcode IDE but I'm having problems linking the libraries. I'm using root 6.04.14 and xcode 7.3. I created a mock up project where I simply have a .cpp where I include a basic class from root (#include "TFile.h"). This I can compile from command line by: clang++ -std=c++11 -I/opt/root/root-6.04.14/include/root -L/opt/root/root-6.04.14/lib/root -lCore main.cpp Now it comes to setting up everything in the Xcode IDE. I included "/opt/root/root-6.04.14/include

Setting up ROOT from Cern in Xcode, linking the librariers correctly

回眸只為那壹抹淺笑 提交于 2019-12-19 09:40:07
问题 I want to set up ROOT from CERN in my Xcode IDE but I'm having problems linking the libraries. I'm using root 6.04.14 and xcode 7.3. I created a mock up project where I simply have a .cpp where I include a basic class from root (#include "TFile.h"). This I can compile from command line by: clang++ -std=c++11 -I/opt/root/root-6.04.14/include/root -L/opt/root/root-6.04.14/lib/root -lCore main.cpp Now it comes to setting up everything in the Xcode IDE. I included "/opt/root/root-6.04.14/include

Plotting ASCII files in ROOT

ε祈祈猫儿з 提交于 2019-12-18 09:39:24
问题 I am trying to write a small macro that reads data from an ASCII file that has 4 columns. But I want to graph only the second the third columns as (x, y). 回答1: The constructor of TGraph can directly take a CSV file, see the documentation. TGraph g("data.csv", "%*lg %lg %lg %*lg", ","); The first argument is the filename, and the second argument a format string. Skipped columns are denoted with a * ; to skip the last column you could actually just omit it from the format string, %*lg %lg %lg