Questions tagged [pyroot]

`PyROOT` is a Python extension module that allows the user to interact with any `ROOT` class from the Python interpreter.

PyROOT is a Python extension module that allows the user to interact with any ROOT class from the Python interpreter. This is done generically using the ROOT dictionary, therefore there is no need to generate any Python wrapper code to include new ROOT classes. At the same time PyROOT offers the possibility to execute and evaluate any Python command or start a Python shell from the ROOT/CINT prompt. Further details are available in the PyROOT manual.

See more:

56 questions
1
vote
2 answers

Accessing Math functions from rootpy

I'm currently trying to access Math functions such as DeltaR from rootpy, but I'm not sure how this is done. I've seen nothing in the documentation or in any examples. The C++ equivalent would be something like: double dR =…
jmccartin
  • 13
  • 2
0
votes
0 answers

Cannot use DataFrame.AsNumpy() : np.object deprecated error

I am using PyRoot on Jupyter notebook.I have TTree in a ROOT file, which I read as an RDataFrame. I am trying to convert columns of my dataframe (branches of the original TTree) into Numpy arrays, but the below error is raised. My complete code…
LuciaB
  • 11
  • 1
0
votes
0 answers

Plotting histograms for several folders with a PyROOT loop

I would like to ask how to solve this error in my pyROOT code on lxplus (ssh server): This is two code sections: def mkdir_p(path): #print "Making dir: ", path try: os.makedirs(path) except OSError as exc: #print("OS…
0
votes
0 answers

How can I stop to restart the kernel with PyRoot?

I'm new to Pyroot and I don't know how to fix a little problem. I'm using Pyroot on Spyder 5.1 (Anaconda) because ROOT isn't compatible for now with macOS Monterey. I installed Root 6.24/08 on Spyder, I tried a simple program like the one in the…
0
votes
1 answer

Adding axis limits in pyROOT

I am trying to limit my x-axis in my pyROOT code. Right now the x-axis is way too long and makes the waveform that I am plotting look too thin. I need to limit the x-axis range to about (130,240) but everything I try comes back with an error so I…
0
votes
1 answer

Inhibiting a method called on a dataclass member

My dataclass has a field that holds an array of data in a custom type (actually it is a PyROOT std vector). However, for the user it is supposed to be visible as a list. This is simple enough with dataclass getters and setters, that convert the…
0
votes
1 answer

Merge files using Hadd

I am attempting to merge three ntuples (just an example but there are more) stored in a directory that are labeled as the following: [1] mc16a_SUSY.root [2] mc16d_SUSY.root [3] mc16e_SUSY.root [4] ...... To do this I am using the command hadd (hadd…
JustTrying
  • 13
  • 4
0
votes
2 answers

Passing a dictionary to a Process with modifyable elements in python

I'm trying to thread my code for better performance, using the multiprocessing library's Process module. The skeleton of code is to create dictionaries for each thread that they work on, and after it's all done, the dictionaries are summed and saved…
WhiteWolf
  • 25
  • 6
0
votes
2 answers

landau Random number generator

I am trying to generate 1000 values with landau distribution with an MPV(most probable value) of 25, can't find a landau random number generator in scipy or numpy. I tried pylandau {pip install pylandau} but this seems to only fit landaus and not…
0
votes
1 answer

Issues trying to open a bi-dimensional array leave contained in a ROOT Tree in Pyroot

I’m stuck with a problem using Pyroot. I’m not able to read a leaf on a tree which is a two dimensional array of float values. You can see the related Tree in the following: root [1] TTree tr=(TTree)g->Get(“tevent_2nd_integral”) root [2]…
Gipsy
  • 61
  • 4
0
votes
2 answers

Getting "TypeError: with staticmethid not callable"

I am getting an error about TypeError: 'staticmethod' object is not callable. Basically, you the input is a map of and given that you provide a pair of floats (pt,eta), the code should return the Y value of the bin that the particular values fall…
Terma
  • 81
  • 8
0
votes
1 answer

Reading multiple (CERN) ROOT files into NumPy array - using n nodes and say, 2n GPUs

I am reading many (say 1k) CERN ROOT files using a loop and storing some data into a nested NumPy array. The use of loops makes it serial task and each file take quite some time to complete the process. Since I am working on a deep learning model, I…
kolahalb
  • 21
  • 3
0
votes
0 answers

The Kernel in Jupyter Notebook does not respond when importing the ROOT framework

I am hoping to use pyRoot, the data analysis framework developed by CERN, by integrating it in a Jupyter notebook. That said, I believe that I did the proper installation of ROOT on my macOS 10. When I launch the ROOT Jupyter notebook using the…
user1680944
  • 537
  • 2
  • 13
  • 23
0
votes
1 answer

Three-term Gaussian fit to data in pyROOT

I tried to fit a three-term Gaussian function to data using the following code: import ROOT #from ROOT import TF1 import numpy as np data = np.loadtxt('V_lambda_n.dat') r = data[:, 0] V = data[:, 1] graph = ROOT.TGraph() for i in range(len(V)): …
Otto
  • 9
  • 3
0
votes
1 answer

python not return Noneobject, when it should be returning TDirectoryFile root object

So I am using pyroot to do data analysis. The analysis code chain runs different plugins on the data and outputs them to a root file, storing the output of each plugin in to their own TDirectoryFile within the root file. I wrote a function that…