`Float_t blah[]`, `TTreeReaderArray` and `RVec` interplay

Trying to re-implement this analysis: ROOT: tutorials/dataframe/df103_NanoAODHiggsAnalysis.py File Reference in “classic” ROOT for the peak performance. (@eguiraud told me RDF is slower than it needs to be)

However, one (made-up) requirement is I want to reuse RVec algorithms from the Header otherwise we’re literally back to 2000 era. And here are the problems:

  1. RVec can adopt std::vector<T>, but the branch such as Muon_pt in this tree is not std::vector, instead they are Float_t[] and SetBranchAddress would complain (and seg fault).
  2. TTreeReaderArray can’t be adopted by RVec? (and also can’t be used to read VecOps types?)

solution:

     Float_t pMuon_pt[10];
     TBranch *b_Muon_pt = t->GetBranch("Muon_pt");
     b_Muon_pt->SetAddress(&pMuon_pt);

RVec<Float_t> Muon_eta(pMuon_eta, nMuon);
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.