# Question on DeltaR and vectors in rdf

**URL:** <https://root-forum.cern.ch/t/question-on-deltar-and-vectors-in-rdf/35952>\
**Category:** Newbie\
**Created:** [September 10, 2019, 3:47am UTC](https://root-forum.cern.ch/t/question-on-deltar-and-vectors-in-rdf/35952 "2019-09-10T03:47:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjohns](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kjohns](https://root-forum.cern.ch/u/kjohns)\
**Post date:** [September 10, 2019, 3:47am UTC](https://root-forum.cern.ch/t/question-on-deltar-and-vectors-in-rdf/35952/1 "2019-09-10T03:47:33Z")

</div>

hi,

your suggestions of 7/2/19 helped quite a bit wrt to rdf. thanks.  
however i am still missing something in one of the examples you gave.  
i am using root 6.18 now.

```auto
df = df.Filter("nMuon > 0 && nElectron > 0", "Select only valid events")\
       .Define("idx", "Combinations(Muon_phi, Electron_phi)")\
       .Define("dR", "DeltaR(Take(Muon_phi, idx[0]), Take(Electron_phi, idx[1]),\
                                          Take(Muon_eta,idx[0])"), Take(Electron_eta,idx[1]))
       .Define("minIdx", "ArgMin(dR)")\
       .Define("dRMin", "dR[minIdx]")

so lets say i have 2 muons and 2 electrons, and i am trying to find the smallest dR between the
combinations.

a. i am not sure what the idx should be with the Takes in defining DeltaR. i want to loop
over all the possible combinations and i dont think the way i defined dR does that.  
or am i wrong?

thanks..kj

```
