Problem withSetBranchAddress after Classification

Dear experts,
I successfully performed classification with TMVA. In between the variables of the classfication are variables called e.g ‘bjet.Pt()’ where bjet is a TLorentzVector.
Now that I want to apply my classification, I am following the tutorials to set up the reader and the trees but when I call

Float_t bjet_pt;
myTree->SetBranchAddress("bjet.Pt()", &bjet_pt);

I get this error:

Error in  <TTree::SetBranchAddress>: unknown branch -> bjet.Pt()

Can anybody help me avoiding/correcting this? From my understanding it is ok to call as a string “bjet.Pt()” in the AddVariable method, but not when you want to set the address of the branch. Still I cannot figure out how to avoid doing this.

Thanks for your help,


I haven’t used TLorentzVectors, but I suppose what’s stored in the tree is a TLorentzVector, so this may work:

Double_t bjetpt;
TLorentzVector bjet;
myTree->SetBranchAddress("bjet", &bjet);

And then when you need pt, do ptjet = bjet.Pt()

1 Like