umd-lhcb / hammer-reweight

Code for FF reweighting in HAMMER
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Lots of events fail HAMMER reweighting in the lastest TO MC #9

Closed yipengsun closed 2 years ago

yipengsun commented 2 years ago

For 12773410, roughly 30% of events failed HAMMER reweighting. The error messages are:

WARN: HAMMER doesn't add process properly: 65232
Rosebud! Zero energy: 0.000000

This needs to be fixed.

yipengsun commented 2 years ago

The old MC FF validation plots can be found at https://github.com/umd-lhcb/lhcb-ntuples-gen/issues/77.

yipengsun commented 2 years ago

We looked into differences between sim09j and sim09k at here. Nothing suspicious unfortunately.

yipengsun commented 2 years ago

I tried to diff the old ntuple with the new by doing event-by-event subtraction of the weights, and the overall mean of the diff is -0.0007780060387184558, and the diff range is [-7.314896116818881, 0.8487702097392585].

This comparison is done without adding any radiative photons to the B meson for the new program only, so some differences are expected.

yipengsun commented 2 years ago

Previously when adding all photons (NOT removing soft photons), HAMMER would stuck on events, I "fixed" that by require photon energy > 0.1 MeV. Now I do the same thing, but HAMMER stuck on an event:

====
  Adding photon: 5736.87,128.61,-171.1,5732.88 to -511
  Adding photon: 3027.16,94.14,-22.86,3025.61 to -511

====
  Adding photon: 42.2749,-1.1,1.32,42.24 to -511
  Adding photon: 58.3823,-1.55,3.27,58.27 to 413  # stuck in this event!
yipengsun commented 2 years ago

So the bug was: I didn't add the photons emitted by the B meson correctly. After fixing that, output is consistent w/ old result.

yipengsun commented 2 years ago

I found the problem finally:

Previously, I add radiative photons to B meson, D meson that is the direct B daughter, and the lepton Tau/Mu that is also a direct B daughter.

Then I also add daughters for that D meson, and some of the daughters can be a photon. When this happens, HAMMER fails to process the event, because I ADDED the same photon twice! (confirmed by printing out the kinematics of all added particles.

Now I never add the photon to the D in the second step, to avoid duplication. Now the reweighting is success:

Total number of candidates: 65986
Hammer reweighted candidates: 65596
Reweighted fraction: 0.99409

Note that some of the events are not passed to HAMMER, because they fail naive truthmatching. The truth-matching success rate is 0.9942, whereas the HAMMER absolute success rate is 0.9941.

yipengsun commented 2 years ago

Also, the problem also existed in the previous version. So this is just an old bug that has not been discovered before this issue!