BTaggingSelectionJsonTool: more robust fix concerning pTBins and efficiency cuts matching (following up of MR !78570)
A bug concerning the flat mass efficiency cuts was found by @caiyi (many thanks!) this has been discussed in two MMs channels
The origin of the issue is that in the previous implementation, the json utility uses a dictionnary behind the scene.
There were 2 different loops:
- loop 1: loop over pT bin values (stored in a list)
-
loop 2: loop over the pT keys (
pT_200_250,pT_250_300ect) to retrieve the corresponding (mass bin, efficiency cut) values
--> The loop 2 could introduce some inconsistency w.r.t order of loop 1 because the pT key order could be modified by the json "dictionnary" utility
This MR implements a more robust fix than already provided in MR: !78570 (merged) as
by modifiying the logic.
We now have a single loop where at the same time pT bins values and (mass bin, efficiency cut) values are retrived ensuring the consistency of the information retrieved
For simplicity, let's imagine that there is 3 pT bins in the JSON file e.g. pTbins : [ 200, 250, 300, "inf" ]
In the loop over the pT bins values we successively
- retrieve the pT value so succesively
pTwill correspond to200then250then300then"inf" - for each pT value we then retrieve the corresponding pT bin name that is called
pT_key
so succesivelypT_key="pT_200_250",pT_key="pT_250_300"andpT_key="pT_300_inf" - for each
pT_key- Make sure that the
pT_keycan be found in the JSON file - then retrieve the corresponding (mass bin, efficiency cut) values
- Make sure that the
--> In this way there is no more issues things are consistent