Closed bianchini closed 7 years ago
@GLP90: Gael, could you take a look: there are operations on strings that could be moved to the init function to speed up the code.
@bianchini In order to assign the SF within the correct pT-eta bin, it is necessary to loop over the json entries for each new event. So I don't see how the e.g. etaL and etaH can be defined in the initialisation since they are different for each lepton. Am I missing something ?
@GLP90 maybe you could do the parsing of the strings once in a setup function (like __init__
) and prepare some sort of a lookup or map that will be used in the get_2D
function that is faster?
you should just do the string to float conversion in init and prepare a dict (or any other structure.. perhaps even a ROOT.TH2F that has FindBin implemented in c++ !! ) to go faster event by event.
Ok got it, thanks for the suggestion. I will make the modifications.
Done here: https://github.com/vhbb/cmssw/pull/556
https://github.com/vhbb/cmssw/blob/vhbbHeppy76X/VHbbAnalysis/Heppy/python/leptonSF.py#L50-L66 could be imrpoved.