Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NanoAOD missing jet muon energy fraction? #169

Closed
juska opened this issue May 19, 2018 · 12 comments
Closed

NanoAOD missing jet muon energy fraction? #169

juska opened this issue May 19, 2018 · 12 comments

Comments

@juska
Copy link

juska commented May 19, 2018

[Moving the discussion here from Computing Tools hypernews]

Hi,

the jet muon energy fraction seems to be missing at least in 93X NanoAOD. The existing energy fraction variables are Jet_chEmEF, chHEF, neEmEF and neHEF. I am trying to reconstruct and study jet energy composition.

While the charged EM energy fraction, Jet_chEmEF, could basically also include muon energy, I find by summing over the energy fractions that in a non-vanishing fraction of the jets the energy fraction variables do not sum to unity. That is, muon energy is probably missing. Here's some sums for the two leading jet of a random 93X NanoAOD file:

Fraction sum: 0.998046875
Fraction sum: 0.0314025878906
Fraction sum: 0.998046875
Fraction sum: 1.00006103516
Fraction sum: 0.0256652832031
Fraction sum: 1.0048828125
Fraction sum: 1.001953125
Fraction sum: 1.001953125
Fraction sum: 0.62109375
Fraction sum: 1.00183105469
Fraction sum: 1.0
Fraction sum: 0.998138427734
Fraction sum: 1.00317382812

Please note that I have not applied jetID-cuts (because I did not yet figure out how to use the variable in nAOD), but I think the fractions should sum to unity no matter what.

Another interesting feature is the poor precision of the fraction variables, but this is a matter for another post and I do not know if this is rather a feature than a bug in the tightly compressed NanoAOD format.

Cheers,

Juska

Ps. I think I now figured out how to use the JetID; it's an integer between 0 and 6 and changing that to binary gives the flags for the three defined JetID booleans. Applying the tight cut does not bring all the fraction sums to unity.

@arizzi
Copy link

arizzi commented May 19, 2018

can you clarify your use case? for the muon fractions and for the fractions in general.
NanoAod is about choices of what to include, what not and which precision to use. Thw optimization is based on analysis use cases hence we need to know what yiu want to do with those number to understand why the available info is not sufficient (if that's the case)

@juska
Copy link
Author

juska commented May 20, 2018

I want to reconstruct the particle-flow jet energy composition:
Figure_046-a.pdf

This is a very efficient tool for studying the quality of the whole reconstruction process. As for example the JetID variables depend heavily on the jet energy fractions, it is important to be able to see whether the fraction variables are indeed healthy and produce a similar jet energy composition as studies done with RECO/AOD samples produce. This is not possible if I do not have access to all the fractions that PF divides the jets into. The presence of flavour variables in the NanoAOD also makes it possible to do further studies of jet composition, which is one of my personal agendas for making sure the fraction variables are all there.

I just tried to calculate the jet muon energy fraction by subtracting all the other variables from unity, and the resulting histogram is not what I have seen from AOD-based jet samples.

If the limited numerical precision of the fraction variables is a deliberate choice, I guess I'm fine with it. What worries me a bit tho is that the precision seems to decrease with increasing energy fractions, as you can see from the charged hadron energy fraction plotted with 1000 bins here:
chf_decreasing_precision.pdf
As you can see, the precision seems to drop first at around 0.127 (1/6), then at 0.25 (1/4) and then at 1/2, and then stays constant until 1.

Please note that I have been out of the loop for most of the time when NanoAOD has made it's appearance to CMS, so I may have ill-founded assumptions and expectations on our great new data format.

@arizzi
Copy link

arizzi commented May 20, 2018

Physics object studies are not in the nanoaod target list.
on the other hand I think JME POG is planning to use modified version of nano for their studies and I'm guessing your use case can fit in there. (@rappoccio)

@arizzi arizzi closed this as completed May 20, 2018
@juska
Copy link
Author

juska commented May 20, 2018

So why are the jet energy fraction variable there in the first place then? Seems quite funny that there's some of them but not all. Also, is the decreasing numerical precision an expected feature?

@rappoccio
Copy link

You can play with a JMAR workflow I've been developing here. This is in the context of substructure studies on AK8 jets, but in principle you can extend as you wish.

https://github.com/cms-jet/NanoAODJMAR

@juska
Copy link
Author

juska commented May 23, 2018

Looks nice thanks! Once my new analysis code is a bit more complete, I'll see if this would be good for me out-of-the-box or if I'd need to extend it to other jet types. Are the ntuples you have produced somewhere available?

@arizzi arizzi reopened this May 23, 2018
@arizzi
Copy link

arizzi commented May 23, 2018

I see that now muonFraction is used for JetID so there could be some use case (...but we precompute the IDs).
How inaccurate would it be to simply calculate the fraction from the two matched muon indices? (I'm guessing it should be quite accurate)

@gpetruc
Copy link

gpetruc commented May 23, 2018 via email

@juska
Copy link
Author

juska commented May 24, 2018

I tried calculating the muon fraction from the matched muons (using Jet_muonIdx1,2 and Muon_pt[]), and what I see is that the fraction is roughly half of what it is calculated with the other possible method, i.e. subtracting all other jet energy fractions from unity.
muon_fraction_muonIdx.pdf
muon_fraction_subtraction.pdf

Unfortunately I do not have a similar data sample from AOD at hand so I could check what the muon fraction should really look like in this case. What I can say is that the shape is what I would expect, but the magnitude is e.g. vastly different from my (fairly old) non-CHS jet sample that I happen to have stored locally.

I like Giovanni's idea of storing the fractions as integers. I can help in checking that if you tell me how to learn to do it. As you have noticed, I'm a complete novice when it comes to floating point precision and storage efficiency etc.

@arizzi
Copy link

arizzi commented May 24, 2018 via email

@juska
Copy link
Author

juska commented May 24, 2018

Oh that's a good point. I did the previous plot with corrected pt.
Here's a version with muon fraction calculated from MuonIdx1,2 using raw pt (Jet_pt*(1-Jet_rawFactor). The difference is very small.
muon_fraction_muonIdx_raw.pdf

A possible problem with obtaining jet muon energy fraction with the stored muons are unisolated muons - are they saved to the muon collection?

@rappoccio
Copy link

Addressed in the referenced PRs. Juska, I think this should satisfy your needs (otherwise we can reopen the issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants