I would like to find the type of the object associated to a branch.
I do have a tree with 5 branches:
Xvtx (float)
Yvtx (float)
Zvtx (float)
EPxPyPz (TLorentzVector)
extra (double)
Basically I would like to loop over branches and detect if it’s a float, double or TLorentzVector. Depending on that I would call different methods… Is there a way to access this ?
mytree does have a branch called EPxPyPz. Doing this in interpreted ROOT this is ok, I can get back my mass from TLorentzVector. But… doing the exact same in compiled ROOT doesn’t work. Do you have any guess ?
NB: I did use t->SetMakeClass(1), but I removed it and no improvement.
glad you could solve this. In order to leave a trace of this TTree::Draw / dataframe comparison, I’ll just leave the translation of the syntax above in terms of RDataFrame:
auto rdfWithMass = rdf.Define("M", "EPxPyPz.M()");
auto massH = rdfWithMass.Histo1D("M");
auto mValues = rdfWithMass.Take("M");
massH->Draw("goff");
for (auto m : mValues) cout << m << endl;