python - how to use TTreeReader in PyROOT -


I am getting up and running using the TTRRIRDR approach to read TTRs in Pyroot. As a guide, I am using the root 6 analysis workshop () and its related root file (). File.Get ("MyTree") treeReader = TTreeReader ("MyTree", file)

  root import * fileName = "mockupx.root" file = TFile (file name) After that, I have lost a bit, I try to access variable information using the TTreeReader object and it does not work much enough:  
  & Gt; & Gt; & Gt; RvMissingET = TTreeReaderValue (tree reader, "missing") traceback (most recent call final): File "& lt; stdin>", line 1, & lt; Module & gt; File "/home/user/ROOT/v6-03-01/root/lib/ROOT.py", line 198, in __call__ result = _root.MakeRootTemplateClass (* newargs) SystemError: error set with no exceptions  

Where am I going wrong?

TTRIRDER value is a templated class, as shown in the documentation example So you need to specify the template type.

You can do this

  to be used for rvMissingET = ROOT.TTreeReaderValue   and  float  types , Such as     p> 
  rvInt = ROOT.TTreeReaderValue (int) (treeReader, "intBranch") rvFloat = ROOT.TTreeReaderValue (name (TreeReader, "floatBranch")  

Also note that. (If you are looking for fast nattappa branch access in dragon, then you can see it in the class I've written.)


Comments