RooRealVar with arrays and vectors

Dear experts,

I would like to link a RooRealVar to the first element of an array in a TTree.
I tried with:

RooRealVar B0_DTF_PV_JPs_M = new RooRealVar(“B0_DTF_PV_JPs_M[0]”,"M_{B #rightarrow J/#psi K^{}}",5150,6000,“MeV/c^{2}”);
RooDataSet *rdsMCB0_DTF_PV_JPs_M = new RooDataSet(“rdsMCB0_DTF_PV_JPs_M”,“rdsMCB0_DTF_PV_JPs_M”,RooArgSet(*B0_DTF_PV_JPs_M),Import(*tMC));

where the B0_DTF_PV_JPs_M is the array-like TBranch in the TTree, but this is not working.
I saw that there has been a similar discussion in 2010, and at that time this option was not implemented.
Is it still the case? What would you suggest to do?

Thanks for your help,



It is correct. I don’t this this is possible. I would suggest you create a reduced tree or you just loop by hand on the tree entries and you fill your RooDataSet. It should be quite simple to do it

Best Regards


Dear Lorenzo,

thanks for your help, this is actually the workaround I used.