# PtEtaPhi for dimuon

hi, im trying to modify the http://opendata.cern.ch/record/5500 its a zz4l exercise, mixing muon and electron combination for make the Z (Za) and Zb (Z*) then form the H
im using Delphes tree which only contains PtEtaPhi, whereby this example uses pxpypzE,
im stuck at making the tLorentz for p4Za & p4Zab as in line 541
starting with;

``````muon1 = muons->at(0);
muon2 = muons->at(1);
``````

i have set the dimuon pair invariant mass

`````` mZ12 = ((muon1->P4()) + (muon2->P4())).M();
``````

then which ever is closer to Z (n this case say mZ12) will be named Za and

``````mZa  = mZ12;
``````

but i dont have any idea how to fill for Eta, Phi, PT

``````p4Za.SetPtEtaPhiM(ZaPT, ZaEta, ZaPhi, mZa);
p4Zb.SetPtEtaPhiM(ZbPT, ZbEta, ZbPhi, mZb);
p4H = p4Za + p4Zb;
mass4mu = p4H.M();
``````

in the example it simply adds

``````pxZ24 = muon2.px() + muon4.px();
pyZ24 = muon2.py() + muon4.py();
pzZ24 = muon2.pz() + muon4.pz();
``````

then

``````pxZa = pxZ24;
pyZa = pyZ24;
pzZa = pzZ24;
p4za.setpxpypzE(pxZa, pyZa, pxZa, eZa);
``````

but in my case i cant do this because then it will break the momentum conservation, example

``````PtZ12 = muon1->PT + muon2->PT;
EtaZ12 = muon1->Eta + muon2->Eta;
PhiZ12 = muon1->Phi + muon2->Phi;

ZaPT = PtZ12;
ZaEta = EtaZ12;
ZaPhi = PhiZ12;

``````

i think this is wrong! I uploaded the full macro here, if theres any suggestions, please do help me out!,
Thanks Alot!

_ROOT Version:6.22
_Platform: mac catalina 10.15.16
_Compiler:Apple clang version 11.0.3 (clang-1103.0.32.29)

Hi there!

I seems like you just have to add the fourvector objects. The objects take care of the correct fourvector addition. It happens already here:

``````auto p4 = muon1->P4() + muon2->P4();
``````

You add the fourvector objects to get the invariant mass. The same way you can add every fourvector and get other properties, such as `px` or `Eta`. So go for something like

``````auto dimuon = muon1->P4() + muon2->P4();
auto dimoun_pt = dimuon->PT();
``````

to achieve what you want.

Feel free to reach out again if I understood your issue wrongly and this is not solving your problem!

Best
Stefan

im sorry, but isnt auto only used in DataFrame? in this example im only using normal root
so my

`````` mZ12 = ((muon1->P4()) + (muon2->P4())).M();
``````

is already correct, but this calculate the invariant mass only, so by dioing

``````Z12_V = muon1->P4()) + muon2->P4();
``````

i can get all objects? am i understanding this correctly?
then i should declare Z12_V as a TLorentzVector right

So `muon1->P4()` should give you a fourvector object, such as the one here:

These have overloads for `operator+`, so the addition of these objects, which takes care of the correct additions and takes care of the fourvector arithmetics. After the addition of the objects, you can extract the correctly added values for `pt`, `eta`, … .

Best
Stefan

hi i tried following the above but im getting

``````error: member reference type 'TLorentzVector' is not a pointer; did you mean to use '.'?
ZaPT = Z12_V->PT;
``````

i declared Z12_V as TLorentzVector

``````TLorentzVector Z12_V;
Z12_V.SetPtEtaPhiM(0.,0.,0.,0.);
``````

where

``````Z12_V = muon1->P4() + muon2->P4();
ZaPT = Z12_V->PT;
``````

should i be using

``````ZaPT = Z12_V.Pt(); ?
``````

can u suggest how i can fix this, thanks

Yes, if `Z12_V` is a `TLorentzVector` (which it is) and not a `TLorentzVector*`, you should use `.` instead of `->` when accessing its member functions.