Dear ROOT community,
For repetitive plotting of many branches of a tree, I have been trying to shift my old (very lengthy) code using SetBranchAddress &Cie to the RDataFrame paradigms.
It seems very practical at first, but I met a problem that I could not solve, and ended up going back to the good old lengthy code.
The problem is that the variables that contain arrays of length “Reco_mu_size” cannot be read by the columnar analysis (TTreeReader) if the variable “Reco_mu_size” of the tree is of type Short_t.
So the simple histograming script attached works for variable “Centrality” (which is not an array), but not for variable “Reco_mu_nTrkHits” for example (on the attached .root file). It gives the error:
Error in <TTreeReaderValueBase::CreateProxy()>: The branch Reco_mu_size contains data of type short. It cannot be accessed by a TTreeReaderValue<int> terminate called after throwing an instance of 'std::runtime_error' what(): An error was encountered while processing the data. TTreeReader status code is: 6
I run with ROOT v6.22.02.
This seems like a rather simple functionality to implement, will it be done soon?
Best,
Guillaume
P.S: For now I don’t manage to attach my file… But here is the script MWE:
using namespace ROOT;
void test(){
auto fnAOD = "Oniatree_AOD.root";
ROOT::RDataFrame d("hionia/myTree", fnAOD);
auto test2 = d.Histo1D({"","",100,0,100},"Reco_mu_nTrkHits");
TCanvas *c2 = new TCanvas("c2","c2",1500,1500);
test2->Draw("hist");
}
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided