cms-nanoAOD / cmssw

CMS NanoAOD software integration repository
http://cms-sw.github.io/
Apache License 2.0
3 stars 10 forks source link

extend the electron matching #552

Closed mariadalfonso closed 3 years ago

mariadalfonso commented 3 years ago

See report from Sergio https://indico.cern.ch/event/962278/contributions/4060711/attachments/2136665/3599026/electron_matching_nano_nov4.pdf

to do: extend the GenDressedLeptons at lower pt

sscruz commented 3 years ago

hi @mariadalfonso , all, I have implemented the matching to GenDressedLeptons in the matching. The approach recovers a similar level to efficiency to the other approaches I showed during the meeting. In particular, I have checked that the procedure agrees with the matching to status=1 OR isLastCopyBeforeFSR to a level below 0.1%.

However, this is a bit more tricky than what I initially thought and I had to make several decisions to implement this. Let me know if this is fine:

Also, I have validated that this approach does not affect significantly the fake rate. I'm plotting below the number of electrons matched to prompt electrons or taus in a DY->LL sample, showing that the number of matched electrons above 2 does not increase very significantly.

plot_withlog.pdf plot_nolog.pdf

You can find the implementation of this in sscruz:from-CMSSW_10_2_22_electronMatching, it is based (as nanoAOD v7) in CMSSW_10_2_22. I could rebase it to the master branch. Could you let me know on which cmssw release is cms-nanoAOD:master based?

bendavid commented 3 years ago

How is the genPartIdx filled in cases where a GenDressedLepton is matched? (It should be possible to determine the constituent electron from the GenDressedLepton somehow)

sscruz commented 3 years ago

Right now, I'm keeping the same index as it is right now. Ie, in cases in which the electron is matched to a GenDressedLepton but not to a status==1 GenParticle, genPartIdx is equal to-1... I guess it should be possible to match that to a GenParticle. Do you know of an existing implementation of that? I really wouldn't like to reinvent the wheel there :)

mariadalfonso commented 3 years ago

@sscruz @bendavid @peruzzim was there any decision on how to extend the electron matching ?

bendavid commented 3 years ago

The genparticle(s) should be easily accessible from the relevant accessors. I'm not aware of any ready-made solution.

https://github.com/cms-sw/cmssw/blob/ba6e8604a35283e39e89bc031766843d0afc3240/DataFormats/JetReco/interface/GenJet.h#L109-L114

It's PROBABLY the first constituent, but can explicitly select e.g. the highest pt constituent with abs(pdgid) 11

sscruz commented 3 years ago

hi @mariadalfonso , @bendavid , thanks a lot for the pointer. I have implemented that logic (picking the highest pt constituent with abs(pdgid) == 11) in sscruz:from-CMSSW_10_2_22_electronMatching. The only caveat is that I don't know of a way to link the constituents to the finalGenParticles, so i did a deltaR && deltaPt matching, which is quite dirty but works. If you have suggestions here I'm happy to implement it. If not, I can rebase and make a PR. Cheers

bendavid commented 3 years ago

Hi, you mean the highest pt constitution with abs(pdgid) == 11 I guess rather than pt>11 ? :)

sscruz commented 3 years ago

hi, yes, of course, sorry, too much coding today :) i've edited it

bendavid commented 3 years ago

You can get the index of the genParticle in the collection used to build the dressed leptons with getJetConstituents()[i].key(), but I'm not sure how easy it is to then match this up with the index in the finalGenParticles

sscruz commented 3 years ago

yeah, the problem is that I couldn't find a way to do the latter. I'm also not sure a reference from the finalGenParticles to the initial collection that is used to build the constituents is kept. Anyway, the matching with dR,dPt/pt seems to be good enough. @mariadalfonso should i go ahead and make a PR?

mariadalfonso commented 3 years ago

@mariadalfonso should i go ahead and make a PR?

yes, go ahead with a PR in master, so that we can review the coding details

mariadalfonso commented 3 years ago

closing this since has been handled