root-framework

Fast (in means of developer time) way to use a lot of C++ code from Java

穿精又带淫゛_ 提交于 2019-12-12 13:49:24
问题 Background: We are designing a physics app, that will do a lot of data analysis, but our focus is integrating physical electronic equipement. Basically I would like to be able to call root (it's a big data analysis library from CERN written in C++) library written in C++ library from Java. Basically ability to use ROOT classes from Java (and doing it without losing much time to code JNI wrappers) is a showstopper to us (if it will be hard, most probably we will be using Qt). I can think of

How to create ROOT histograms out of a 3 column .dat file?

久未见 提交于 2019-12-12 04:25:26
问题 I currently have a .dat file with format: Format: Log(10,s22th13) deltacp chi^2 -4 0 0.098127 -4 4 0.093642 -4 8 0.089323 -4 12 0.085185 -4 16 0.081242 .... How would I create a plot using ROOT, keeping the labels specified at the top of the .dat file? 回答1: The easiest way would be to read your file using TTree class: TTree *T = new TTree("ntuple","data from csv file"); Long64_t nlines = T->ReadFile("data.csv"); printf("found %lld points\n",nlines); Your header will be used as names for

Overlap hundreds of histograms macro question

社会主义新天地 提交于 2019-12-11 16:38:27
问题 I have a directory trial which contains hundreds of histograms in it and a macro. Each is called in a way hists09876_blinded.root or hists12365_blinded.root . The order, however, is not like that. There are some missig histograms like hists10467_blinded.root hists10468_blinded.root hists10470_blinded.root . The ultimate goal is to get one histogram on a canvas which represents all of those combined together. The tricky thing is that each hists*****_blinded.root has around 15 1D histos in it,

Reading a TTree in root using PyRoot

扶醉桌前 提交于 2019-12-11 06:59:51
问题 I just started using pyroot to read root files and I can't read the data from a file using jupyter notebook. Here is how the TBrowser looks like: I started like this: import ROOT as root import numpy as np f = root.TFile("RealData.root") myTree = f.Get("tree") entries = myTree.GetEntriesFast() Up to here it is working and if I print entries I get the right number of entires I have in the file. But i don't know how to read actual data from the tree (event_number, n_channels, etc.) If I try

Open txt file and draw histogram in root

时间秒杀一切 提交于 2019-12-08 13:18:46
问题 I have a txt file which contains numbers. I want to draw a histogram according to this file in root. But I can't do this. { TFile *f = new TFile("myfile.root"); f.ls(); TH1F * h1 = (TH1F*)f.Get("h1"); h1->Draw(); } 回答1: Have a look at this tutorial from the ROOT website. As far as I know ROOT can't open a plain text file directly. The TFile("myfile.root") call can be used to open a ROOT file (i.e. a binary file created by ROOT containing persistified ROOT objects such as histograms), which as

Converting 900 MB .csv into ROOT (CERN) TTree

点点圈 提交于 2019-12-08 09:23:57
问题 I am new to programming and ROOT (CERN), so go easy on me. Simply, I want to convert a ~900 MB (11M lines x 10 columns) .csv file into a nicely organized .root TTree. Could someone provide the best way to go about this? Here is an example line of data with headers (it's 2010 US census block population and population density data): "Census County Code","Census Tract Code","Census Block Code","County/State","Block Centroid Latitude (degrees)","Block Centroid W Longitude (degrees)","Block Land

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

不想你离开。 提交于 2019-12-01 08:03:54
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/root" in the header search path and Xcode is not complaining, so I guess it finds the header files. I

Painting a TCanvas to the screen in a compiled ROOT (CERN) application

我的梦境 提交于 2019-12-01 06:26:18
What are the rules for painting to the screen? My end goal is to put the TCanvas into a class and paint from there, but for now I think that maybe looking at a less complicated example might help. Below is some code that compiles and paints to the screen, on my computer. # include <TApplication.h> # include <TCanvas.h> # include <TH1D.h> # include <thread> # include <chrono> //TCanvas canvas ("fCanvas", "fCanvas", 600, 400); int main ( int argc, char* argv[] ) { TApplication app ("app",&argc,argv); TCanvas canvas ("fCanvas", "fCanvas", 600, 400); //TCanvas* canvas = new TCanvas("fCanvas",

Painting a TCanvas to the screen in a compiled ROOT (CERN) application

浪子不回头ぞ 提交于 2019-12-01 04:12:20
问题 What are the rules for painting to the screen? My end goal is to put the TCanvas into a class and paint from there, but for now I think that maybe looking at a less complicated example might help. Below is some code that compiles and paints to the screen, on my computer. # include <TApplication.h> # include <TCanvas.h> # include <TH1D.h> # include <thread> # include <chrono> //TCanvas canvas ("fCanvas", "fCanvas", 600, 400); int main ( int argc, char* argv[] ) { TApplication app ("app",&argc

Clion or cmake does not see environment variable

做~自己de王妃 提交于 2019-11-30 08:05:08
问题 I'm using CLion IDE, Cmake and trying to write Hello world using CERN ROOT library. CMakeLists.txt : message(STATUS $ENV{ROOTSYS}) ~/.bashrc : export ROOTSYS="$HOME/tools/root-build/" During build in CLion $ENV{ROOTSYS} is empty by some reason. But $ENV{PATH} returns correct $PATH . What I did wrong? 回答1: From CLion developers FAQ: Q: How to pass environment variables and parameters to CMake in CLion? A: The best way is to use Preferences/Settings | Build, Execution, Deployment | CMake dialog