vhbb / cmssw

CMS Offline Software
cms-sw.github.io/cmssw
4 stars 5 forks source link

Improve leptonSF #548

Closed bianchini closed 7 years ago

bianchini commented 8 years ago

https://github.com/vhbb/cmssw/blob/vhbbHeppy76X/VHbbAnalysis/Heppy/python/leptonSF.py#L50-L66 could be imrpoved.

bianchini commented 8 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.

GLP90 commented 8 years ago

@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 ?

jpata commented 8 years ago

@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?

arizzi commented 8 years ago

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.

GLP90 commented 8 years ago

Ok got it, thanks for the suggestion. I will make the modifications.

bianchini commented 7 years ago

Done here: https://github.com/vhbb/cmssw/pull/556