Reading LorenzVectors from a Tree

Hello,

I have a tree which contains a
vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D > >.

Interactively, I can use tree->Draw(“lepton.pt()”).

When doing MakeSelector, I get
Double_t lepton_fCoordinates_fX[kMaxlepton]; //[lepton_]
Double_t lepton_fCoordinates_fY[kMaxlepton]; //[lepton_]
Double_t lepton_fCoordinates_fZ[kMaxlepton]; //[lepton_]
Double_t lepton_fCoordinates_fT[kMaxlepton]; //[lepton_]
Is there an easy way to read in the vector again or do I have to create the vector manually by looping over all leptons and pushing_back them to a vector? In the TBrowser I can see that the tree knows that lepton is a vector of LorenzVecors…

Thanks in advance

Hi,

You can use the result of MakeProxy rather than MakeSelector (MakeProxy preserver the object layout while MakeSelector decomposed it into ints and floats).

You can also replace all the lepton_* by a single vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > > lepton;
AND remove the call to SetMakeClass(1) from the selector. You will also need to replace all the other decomposition by their object equivalent. You will also need to update the call to SetBranchAddress accordingly.

Cheers,
Philippe.