# Extracting TLorentzVectors for Mass Reconstruction

I am running for a large number of events and have selected a fraction of them which have 2 jet pairs which look promising for reconstruction of a candidate particle I am looking for. If there are 2 jet pairs in an event, I would like to take the sum up the 4-momenta of the jets in each pair to get a new 4-momentum and then form the scalar product of the 4 momenta of the two pairs to get an invariant mass.

I am aware that there is a ROOT page for TLorentzVectors but I don’t know how this all works in context: I have previously been able to use a formula for invariant mass which did not use 4-momenta. Can I just type TLorentzVector(jet1)+TLorentzVector(jet2) to get the 4-momentum of a jet pair and then form the scalar product from there?

Yes after you have summed the two lorentz vector, you can use
TLorentzVector::M() to get invariant mass.

If your jet1 and jet2 are not pointer but object, you can do

`````` (jet1+jet2).M()
``````

if they are pointer use

`````` (*jet1+*jet2).M()
``````

Cheers,
Stefano

Hi Stefano,

Unfortunately either way does not work for me, if I try to add the jets as TLorentzVectors directly it produces an error message. As a last resort, could I maybe write code to extract the relevant momentum/energy components from the jets and then add and multiply until I have the scalar product which is equivalent to the invariant mass?

Hollis

Sorry, but do you have the TLorentzVectors?
Or you can access only energy and momentum?

S

I should have TLorentzVectors, I have a class to which the jets belong from which I am trying to extract a 4-vector.

I imagine you have a TTree where your data are stored.
Now one of the branch of the tree is of type TLorentzVector? If not you have to build the TLorentzVector by yourself, after you have declared the TLorentzVector you can set also transverse momentum, rapidity and phi angle, TLorentzVector::SetPtEtaPhiE()

I think I will have to define a new TLorentzVector for each jet such it has the energy and momentum components which can be summed. For example, could I declare jetTL1, jetTL2, jetTL3, jetTL4 and fill them by hand using SetPx etc?

Yes of course, than you can sum up and use the `M()` method of TLorentzVector.

S

Apologies, but I am not sure how this works. So say I want to build a TLorentzVector for the 4-momentum of jet1 and call it jetTL1, would I type:

float jetTL1 = jet1.SetPxPyPxE(px,py,pz,e);

Hi,
you can do like this

``````TLorentzVector jetTL1(px,py,pz,e);
``````

Cheers,
Stefano

I’ve tried this, but when I try to add jetTL1 to jetTL2 to be able to calculate the invariant mass, it says that they are both not declared in this scope.

If I just type jetTL1, how would it know that I am referring to jet1 as the ones which needs the components to be extracted from it?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.