@d-salerno here are some ideas on how to make the LR better.
[x] Throw away equivalent permutations to not slow down on high-jet multiplicity events: can be python-side only. BTW: better not to hardcode permutation lists as in Run 1.
[x] unify code for btag and QG likelihood calculation (same algo anyway): single C++ module taking list of jet probabilities from the python side, gives event likelihood by running the permutation loop in the C++ side. Compile module and import from pyROOT like MEM.
@d-salerno here are some ideas on how to make the LR better.
[1] https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagRecommendation74X