Lorentz Vectors

Hi rooters

I have an ntuple and I used the method TTree::MakeClass
with a .C file I want to be able to use the LorentzVector class to loop through the variables in the ntuple to find invarient mass etc…
I was not sure how to declare it and how to run it through the loop to find the quantities I am looking for???
Im not very C++ literate so could you please spell out the steps.

Thanks

Maki…

In your xxx.C file add, eg
#include “TLorentzVector.h”

In the Loop function create an instance of TLorentzVector before the loop.
Inside the loop set the TLorentzVector via the setter functions using
the class members filled via TTree::GetEntry

Rene

sorry…

what did you mean by creating an “instance of TLorentzVector”

Thanks

Maki

For example in your function xxx::Loop, do

TLorentzVector objP4 ; //create innstance objP4 for ( Long64_t jentry=0 ; jentry < nentries ; jentry++ ) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); objP4.SetPtEtaPhiM(PtGen, EtaGen, PhiGen, MGen ) ; ...

Rene