I am new to the ROOT and trying to plot some histograms using RDataFrame. However, I encountered some difficulties. After MC generation I converted .lhe files to .root files and loaded them successfully, but I don’t know how to handle such trees that have multiple particles in a single event. I am using python and don’t know much about c++, so I assume this is the main problem. I am posting the minimal example below:
data = TChain('LHEF', 'LHEF') data.AddFile('rootfile.root') c = TCanvas() model = ROOT.RDF.TH1DModel("model","",64,0,2000) rframe = RDataFrame(data) rframe = rframe.Define('fourVect', 'ROOT::Math::PxPyPzE4D(Particle.Px, Particle.Py, Particle.Pz, Particle.E)').Define('pt','fourVect.Pt()').Histo1D(model, 'pt') rframe.Draw() c.SetLogy() c.Draw()
Here it works ok, but I want to filter and plot parameters for different particles now. So my guess e.g. for photon pt plot would be to add
before Histo1D, but the program complains. I assume the problem is that I am comparing an array of particle PIDs in a single event to an integer (since when I ran a test on Particle_size - which is integer in this tree works ok). So my question is how to extract desired particles from events with different numbers of other particles?
Thank you in advance,
EDIT: Sorry, my rootfile somehow was not attached and I thought it was.
rootfile.root (347.3 KB)