diff --git a/analysis/wwz/get_wwz_yields.py b/analysis/wwz/get_wwz_yields.py index c27bae10..19fa05c9 100644 --- a/analysis/wwz/get_wwz_yields.py +++ b/analysis/wwz/get_wwz_yields.py @@ -7,17 +7,19 @@ import math import matplotlib.pyplot as plt import copy - import hist from topcoffea.scripts.make_html import make_html - from topcoffea.modules import utils import topcoffea.modules.MakeLatexTable as mlt +import ewkcoffea.modules.yield_tools as yt +import ewkcoffea.modules.sample_groupings as sg + + # This script opens a pkl file of histograms produced by wwz processor # Reads the histograms and dumps out the yields for each group of processes -# Example usage: python get_yld_check.py -f histos/tmp_histo.pkl.gz +# Example usage: python get_yld_check.py histos/tmp_histo.pkl.gz -y # Colors in VVV observation #ZZ = (240, 155, 205) #F09B9B @@ -25,9 +27,11 @@ #WZ = (163, 155, 47) #A39B2F #tWZ = (205, 240, 155) #CDF09B #Other = (205, 205, 205) #CDCDCD -CLR_LST = ["red","blue","#F09B9B","#00D091","#CDF09B","#CDCDCD"] +CLR_LST = ["red","blue","#F09B9B","#00D091","#CDF09B","#A39B2F","#CDCDCD"] #CLR_LST = ["#F09B9B","#00D091","#CDF09B"] +SAMPLE_DICT_BASE = sg.SAMPLE_DICT_BASE + # Names of the cut-based and BDT SRs SR_SF_CB = ["sr_4l_sf_A","sr_4l_sf_B","sr_4l_sf_C"] SR_OF_CB = ["sr_4l_of_1","sr_4l_of_2","sr_4l_of_3","sr_4l_of_4"] @@ -62,203 +66,23 @@ "l0pt", ] -# NOTE: cr_4l_of -> cr_4l_btag_of -# No SFs (e.g. oct27_new_sr_presel_cats.pkl.gz) -#EWK_REF = {'WWZ': {'all_events': (143.03255106410325, 0.0043850520761986814), '4l_presel': (25.390131740285142, 0.0007803646139015601), 'cr_4l_sf': (1.0234111444715381, 3.140601082099961e-05), 'cr_4l_of': (0.45467763889973867, 1.3605910434064165e-05), 'sr_4l_sf_C': (0.5507712043909123, 1.7292573108649655e-05), 'sr_4l_sf_presel': (4.887572965786603, 0.0001514161312930492), 'sr_4l_of_2': (0.7141527369931282, 2.1956767077417794e-05), 'sr_4l_of_presel': (8.977618631754012, 0.0002774286898025886), 'sr_4l_sf_A': (2.248077894200833, 6.983757537364668e-05), 'sr_4l_of_4': (4.9765614088337315, 0.00015460696855228265), 'sr_4l_sf_B': (1.9092815210624394, 5.8682199683671906e-05), 'sr_4l_of_1': (0.6239818002213724, 1.907498091594866e-05), 'sr_4l_of_3': (1.433722815978399, 4.4002888617222127e-05), 'sr_sf_all': [4.708130619654185, 0.00014581234816596824], 'sr_of_all': [7.748418762026631, 0.00023964160516287122], 'sr_all': [12.456549381680816, 0.0003854539533288395]}, 'ZH': {'all_events': (137.65612493509434, 0.008261347318550601), '4l_presel': (19.875361077707566, 0.0010595854754236352), 'cr_4l_sf': (0.06583264991149917, 2.963363355469417e-06), 'cr_4l_of': (0.3745634370106927, 2.4116204796741056e-05), 'sr_4l_sf_C': (0.6304575557069256, 2.7550956936472485e-05), 'sr_4l_sf_presel': (3.124085131260472, 0.00019582211706122878), 'sr_4l_of_2': (1.2643676003663131, 6.131047557490629e-05), 'sr_4l_of_presel': (7.463838904360273, 0.0003795543171914658), 'sr_4l_sf_A': (0.8808398754063091, 6.696664634914036e-05), 'sr_4l_of_4': (0.14063188295949658, 1.0594258701507094e-05), 'sr_4l_sf_B': (1.4252621539799293, 9.199921721242461e-05), 'sr_4l_of_1': (2.8618885583600786, 0.0001379722619070393), 'sr_4l_of_3': (0.32845933757653256, 1.7735717802349422e-05), 'sr_sf_all': [2.936559585093164, 0.00018651682049803745], 'sr_of_all': [4.595347379262421, 0.0002276127139858021], 'sr_all': [7.531906964355585, 0.0004141295344838396]}, 'ZZ': {'all_events': (20839.935963596385, 12.449965101821629), '4l_presel': (2996.3448773944438, 1.6969037274479533), 'cr_4l_sf': (1683.1491276815104, 0.9502221381958456), 'cr_4l_of': (0.8202006802384858, 0.0004966314810163349), 'sr_4l_sf_C': (2.4055145616730442, 0.0013489537268409199), 'sr_4l_sf_presel': (11.824718278345244, 0.00681902139812232), 'sr_4l_of_2': (0.562517372865841, 0.00033284359074704046), 'sr_4l_of_presel': (19.06702512973061, 0.011167948980671838), 'sr_4l_sf_A': (1.19626292139219, 0.0006944572452723625), 'sr_4l_of_4': (0.4632858518671128, 0.0002795386629397082), 'sr_4l_sf_B': (4.06302963554117, 0.002343257632045054), 'sr_4l_of_1': (0.5727219310065266, 0.00033610000247904766), 'sr_4l_of_3': (0.3522159432868648, 0.00020917560040396212), 'sr_sf_all': [7.664807118606404, 0.004386668604158336], 'sr_of_all': [1.9507410990263452, 0.0011576578565697584], 'sr_all': [9.61554821763275, 0.005544326460728095]}, 'ttZ': {'all_events': (6400.391729545197, 30.51472802648067), '4l_presel': (155.00430985842831, 0.5408661444449773), 'cr_4l_sf': (0.4853159709600732, 0.0016168707289103397), 'cr_4l_of': (58.69226784154307, 0.2055967200446931), 'sr_4l_sf_C': (0.23643477854784578, 0.0008312534314345273), 'sr_4l_sf_presel': (2.415647323941812, 0.008086969492348196), 'sr_4l_of_2': (0.2673212867230177, 0.0008240181824348471), 'sr_4l_of_presel': (3.787581167416647, 0.012204073027489382), 'sr_4l_sf_A': (1.0880661539267749, 0.003780754297758552), 'sr_4l_of_4': (2.0460971421562135, 0.006911022257176301), 'sr_4l_sf_B': (0.9408668631222099, 0.0030715775891913986), 'sr_4l_of_1': (0.26424446457531303, 0.0007768689629915706), 'sr_4l_of_3': (0.7172879233257845, 0.0020985737304703837), 'sr_sf_all': [2.2653677955968305, 0.007683585318384478], 'sr_of_all': [3.2949508167803288, 0.010610483133073102], 'sr_all': [5.560318612377159, 0.018294068451457583]}, 'tWZ': {'all_events': (457.53748542949324, 0.30642806343796253), '4l_presel': (21.40333431190811, 0.014331435286133691), 'cr_4l_sf': (0.1605230116401799, 0.00010696442888256418), 'cr_4l_of': (7.203838749264833, 0.00482214366093501), 'sr_4l_sf_C': (0.08661178010515869, 5.8415004415396626e-05), 'sr_4l_sf_presel': (0.7771313883713447, 0.0005206595096742938), 'sr_4l_of_2': (0.12694021221250296, 8.386069092457832e-05), 'sr_4l_of_presel': (1.3504042699933052, 0.0009034388377762367), 'sr_4l_sf_A': (0.3471746818977408, 0.00023228077732035136), 'sr_4l_of_4': (0.7259955864865333, 0.00048648538614210764), 'sr_4l_sf_B': (0.311000743182376, 0.00020852835627886666), 'sr_4l_of_1': (0.1106245769187808, 7.408093602573077e-05), 'sr_4l_of_3': (0.21680891863070428, 0.00014520287282259782), 'sr_sf_all': [0.7447872051852755, 0.0004992241380146146], 'sr_of_all': [1.1803692942485213, 0.0007896298859150146], 'sr_all': [1.9251564994337969, 0.001288854023929629]}, 'other': {'all_events': (2676923.753788651, 4742941.134583146), '4l_presel': (52.9465736518614, 6.320437286998802), 'cr_4l_sf': (11.619387141661718, 0.5389615805972202), 'cr_4l_of': (2.3255568619351834, 0.05312613938916803), 'sr_4l_sf_C': (0.3666284556966275, 0.0348884565099036), 'sr_4l_sf_presel': (2.418255006778054, 0.22476817034763386), 'sr_4l_of_2': (0.1325544456485659, 0.014538473315149195), 'sr_4l_of_presel': (3.819963646121323, 0.32266726616108504), 'sr_4l_sf_A': (0.6415139838354662, 0.04076051110880008), 'sr_4l_of_4': (1.3523445471655577, 0.07366978238918248), 'sr_4l_sf_B': (1.228122082655318, 0.14388323140421685), 'sr_4l_of_1': (0.6906138394260779, 0.06387016633097309), 'sr_4l_of_3': (0.08836240391246974, 0.0339883363117061), 'sr_sf_all': [2.236264522187412, 0.21953219902292054], 'sr_of_all': [2.2638752361526713, 0.18606675834701086], 'sr_all': [4.500139758340083, 0.4055989573699314]}, '$S/\\sqrt{B}$': {'sr_4l_sf_A': [1.7294976252152816, None], 'sr_4l_sf_B': [1.3036088753027868, None], 'sr_4l_sf_C': [0.6714139887147356, None], 'sr_4l_of_1': [2.7234984522148564, None], 'sr_4l_of_2': [1.8956585995614936, None], 'sr_4l_of_3': [1.5029715209596433, None], 'sr_4l_of_4': [2.3890939134622236, None], 'sr_sf_all': [2.267455595956694, None], 'sr_of_all': [4.356335439961683, None], 'sr_all': [4.911111212862266, None]}, '$S/\\sqrt{S+B}$': {'sr_4l_sf_A': [1.236626367090044, None], 'sr_4l_sf_B': [1.060990525966462, None], 'sr_4l_sf_C': [0.5712075260687947, None], 'sr_4l_of_1': [1.5399388843353916, None], 'sr_4l_of_2': [1.1295961393615663, None], 'sr_4l_of_3': [0.9949549440590747, None], 'sr_4l_of_4': [1.6426155209771396, None], 'sr_sf_all': [1.7266220506557137, None], 'sr_of_all': [2.708416566189788, None], 'sr_all': [3.2119688668824025, None]}, 'Sig': {'sr_4l_sf_A': [3.128917769607142, 0.00013680422172278702], 'sr_4l_sf_B': [3.3345436750423687, 0.00015068141689609653], 'sr_4l_sf_C': [1.181228760097838, 4.484353004512214e-05], 'sr_4l_of_1': [3.485870358581451, 0.00015704724282298796], 'sr_4l_of_2': [1.9785203373594413, 8.326724265232408e-05], 'sr_4l_of_3': [1.7621821535549316, 6.173860641957155e-05], 'sr_4l_of_4': [5.117193291793228, 0.00016520122725378975], 'sr_sf_all': [7.644690204747349, 0.0003323291686640057], 'sr_of_all': [12.343766141289052, 0.0004672543191486733], 'sr_all': [19.9884563460364, 0.0007995834878126791]}, 'Bkg': {'sr_4l_sf_A': [3.273017741052172, 0.045468003429151346], 'sr_4l_sf_B': [6.543019324501074, 0.1495065949817322], 'sr_4l_sf_C': [3.095189576022676, 0.03712707867259444], 'sr_4l_of_1': [1.6382048119266983, 0.06505721623246943], 'sr_4l_of_2': [1.0893333174499276, 0.01577919577925566], 'sr_4l_of_3': [1.3746751891558233, 0.03644128851540304], 'sr_4l_of_4': [4.587723127675417, 0.0813468286954406], 'sr_sf_all': [12.911226641575922, 0.23210167708347798], 'sr_of_all': [8.689936446207867, 0.19862452922256874], 'sr_all': [21.60116308778379, 0.43072620630604674]}, 'Zmetric': {'sr_4l_sf_A': [1.5271304041317981, None], 'sr_4l_sf_B': [1.211362434502514, None], 'sr_4l_sf_C': [0.6343417608521935, None], 'sr_4l_of_1': [2.171342366726005, None], 'sr_4l_of_2': [1.5478844248069015, None], 'sr_4l_of_3': [1.285097369234633, None], 'sr_4l_of_4': [2.0756701298826195, None], 'sr_sf_all': [2.0498574800479834, None], 'sr_of_all': [3.61532233730269, None], 'sr_all': [4.1560162765692406, None]}} +# Ref with no SFs applied (note naming change to presel categories since the time this was created) +# feb27_baseline_noSFnoSys.pkl.gz +#EWK_REF = {'WWZ': {'sr_4l_sf_B': [1.9092815210624394, 5.868219968367227e-05], 'sr_4l_sf_C': [0.5507712043909123, 1.7292573108649608e-05], 'sr_4l_of_3': [1.433722815978399, 4.4002888617222127e-05], 'sr_4l_of_4': [4.9765614088337315, 0.00015460696855228978], 'sr_4l_sf_presel': [8.218720214481436, 0.0002543393204535014], 'sr_4l_sf_trn': [5.38486802954867, 0.00016650880857958835], 'sr_4l_of_presel': [8.977618631754012, 0.00027742868980258986], 'all_events': [143.03255106410325, 0.004385052076200205], '4l_presel': [25.390131740285142, 0.000780364613901527], 'cr_4l_btag_sf_offZ_met80': [1.1789255509174836, 3.543312373031215e-05], 'cr_4l_sf': [1.0234111444715381, 3.1406010820999584e-05], 'sr_4l_sf_A': [2.248098852023759, 6.983801460398903e-05], 'sr_4l_of_1': [0.6239818002213724, 1.9074980915948606e-05], 'sr_4l_of_2': [0.7141527369931282, 2.195676707741774e-05], 'cr_4l_btag_of': [2.332873423842102, 7.052031927015096e-05], 'sr_sf_all_cutbased': [4.7081515774771105, 0.0001458127873963109], 'sr_of_all_cutbased': [7.748418762026631, 0.00023964160516287824], 'sr_all_cutbased': [12.456570339503742, 0.00038545439255918923]}, 'ZH': {'sr_4l_sf_B': [1.4252621539799293, 9.199921721242454e-05], 'sr_4l_sf_C': [0.6304575557069256, 2.7550956936472543e-05], 'sr_4l_of_3': [0.32845933757653256, 1.773571780234943e-05], 'sr_4l_of_4': [0.14063188295949658, 1.0594258701507093e-05], 'sr_4l_sf_presel': [7.500271647765658, 0.00038186652465116205], 'sr_4l_sf_trn': [4.522856767529447, 0.00022087671808088043], 'sr_4l_of_presel': [7.463838904360273, 0.0003795543171914625], 'all_events': [137.65612493509434, 0.008261347318551384], '4l_presel': [19.875361077707566, 0.0010595854754236367], 'cr_4l_btag_sf_offZ_met80': [0.6045969923652592, 4.986340568511177e-05], 'cr_4l_sf': [0.06583264991149917, 2.963363355469417e-06], 'sr_4l_sf_A': [0.8808398754063091, 6.696664634914041e-05], 'sr_4l_of_1': [2.8618885583600786, 0.00013797226190703833], 'sr_4l_of_2': [1.2643676003663131, 6.131047557490622e-05], 'cr_4l_btag_of': [1.6822630345304788, 0.00010680937268688129], 'sr_sf_all_cutbased': [2.936559585093164, 0.0001865168204980375], 'sr_of_all_cutbased': [4.595347379262421, 0.00022761271398580107], 'sr_all_cutbased': [7.531906964355585, 0.00041412953448383865]}, 'ZZ': {'sr_4l_sf_B': [4.06302963554117, 0.002343257632045054], 'sr_4l_sf_C': [2.4055145616730442, 0.0013489537268409197], 'sr_4l_of_3': [0.3522159432868648, 0.00020917560040396212], 'sr_4l_of_4': [0.4632858518671128, 0.00027953866293970814], 'sr_4l_sf_presel': [625.3544098984094, 0.3562166451167309], 'sr_4l_sf_trn': [90.69184155950279, 0.05143268771989755], 'sr_4l_of_presel': [19.06702512973061, 0.011167948980671838], 'all_events': [20839.935963596385, 12.44996510182031], '4l_presel': [2996.3448773944438, 1.6969037274479712], 'cr_4l_btag_sf_offZ_met80': [2.358815064686496, 0.0013679280585803325], 'cr_4l_sf': [1683.1491276815104, 0.9502221381958484], 'sr_4l_sf_A': [1.19626292139219, 0.0006944572452723625], 'sr_4l_of_1': [0.5727219310065266, 0.0003361000024790477], 'sr_4l_of_2': [0.562517372865841, 0.00033284359074704046], 'cr_4l_btag_of': [3.7302420161504415, 0.0021904190096882813], 'sr_sf_all_cutbased': [7.664807118606404, 0.004386668604158336], 'sr_of_all_cutbased': [1.9507410990263452, 0.0011576578565697584], 'sr_all_cutbased': [9.61554821763275, 0.005544326460728095]}, 'ttZ': {'sr_4l_sf_B': [0.9408668631222099, 0.0030715775891913986], 'sr_4l_sf_C': [0.23643477854784578, 0.0008312534314345273], 'sr_4l_of_3': [0.7172879233257845, 0.0020985737304703837], 'sr_4l_of_4': [2.0460971421562135, 0.006911022257176301], 'sr_4l_sf_presel': [3.5659334138035774, 0.01180990449602128], 'sr_4l_sf_trn': [2.4085794143611565, 0.00810546769571046], 'sr_4l_of_presel': [3.787581167416647, 0.012204073027489382], 'all_events': [6400.391729545197, 30.514728026480668], '4l_presel': [155.00430985842831, 0.5408661444449773], 'cr_4l_btag_sf_offZ_met80': [31.04904586810153, 0.10758473272086123], 'cr_4l_sf': [0.4853159709600732, 0.0016168707289103397], 'sr_4l_sf_A': [1.0880661539267749, 0.003780754297758552], 'sr_4l_of_1': [0.26424446457531303, 0.0007768689629915706], 'sr_4l_of_2': [0.2673212867230177, 0.0008240181824348471], 'cr_4l_btag_of': [63.414810959715396, 0.22234178470495916], 'sr_sf_all_cutbased': [2.2653677955968305, 0.007683585318384478], 'sr_of_all_cutbased': [3.2949508167803288, 0.010610483133073103], 'sr_all_cutbased': [5.560318612377159, 0.018294068451457583]}, 'tWZ': {'sr_4l_sf_B': [0.4198845353530487, 0.00010717563775915021], 'sr_4l_sf_C': [0.10839767166180536, 2.8695803200881038e-05], 'sr_4l_of_3': [0.3047727922530612, 7.527883120245118e-05], 'sr_4l_of_4': [0.9282776923646452, 0.00024224380419460127], 'sr_4l_sf_presel': [1.5975971029547509, 0.00040201487686921143], 'sr_4l_sf_trn': [1.123730185412569, 0.0002804039804139507], 'sr_4l_of_presel': [1.730163810585509, 0.0004416391065870169], 'all_events': [178.15963437006576, 0.04486192040271183], '4l_presel': [26.544821587594924, 0.0066209831302612675], 'cr_4l_btag_sf_offZ_met80': [4.7047833817778155, 0.0011600529197435352], 'cr_4l_sf': [0.20248869292845484, 5.108321546004097e-05], 'sr_4l_sf_A': [0.46284899866441265, 0.00011133764734468921], 'sr_4l_of_1': [0.1342859514261363, 3.176125450297847e-05], 'sr_4l_of_2': [0.1488241527986247, 3.757876565006425e-05], 'cr_4l_btag_of': [10.202555451760418, 0.002522789947753728], 'sr_sf_all_cutbased': [0.9911312056792667, 0.00024720908830472044], 'sr_of_all_cutbased': [1.5161605888424674, 0.0003868626555500952], 'sr_all_cutbased': [2.507291794521734, 0.0006340717438548156]}, 'WZ': {'sr_4l_sf_B': [0.4695464987307787, 0.01739613314260788], 'sr_4l_sf_C': [0.18745648488402367, 0.005562775915829661], 'sr_4l_of_3': [0.01870139129459858, 0.01571616535855198], 'sr_4l_of_4': [0.81333789229393, 0.04587245091006516], 'sr_4l_sf_presel': [1.9591068103909492, 0.10288223760163802], 'sr_4l_sf_trn': [0.9570152945816517, 0.04763624418418125], 'sr_4l_of_presel': [1.9694814532995224, 0.11593636356868098], 'all_events': [64295.440694248304, 3785.8715240238676], '4l_presel': [9.901992252096534, 0.5879718428319408], 'cr_4l_btag_sf_offZ_met80': [0.14544222131371498, 0.01005621476728371], 'cr_4l_sf': [0.19009067304432392, 0.012810969442493516], 'sr_4l_sf_A': [0.05745987221598625, 0.006227639598605526], 'sr_4l_of_1': [0.4658583365380764, 0.027649146792590645], 'sr_4l_of_2': [0.13211736641824245, 0.004049024052467726], 'cr_4l_btag_of': [0.7625117842108011, 0.04328537125233069], 'sr_sf_all_cutbased': [0.7144628558307886, 0.02918654865704307], 'sr_of_all_cutbased': [1.4300149865448475, 0.09328678711367551], 'sr_all_cutbased': [2.144477842375636, 0.12247333577071857]}, 'other': {'sr_4l_sf_B': [0.7585755839245394, 0.12648709826160898], 'sr_4l_sf_C': [0.17917197081260383, 0.029325680594073936], 'sr_4l_of_3': [0.06966101261787117, 0.01827217095315412], 'sr_4l_of_4': [0.5390066548716277, 0.027797331479117317], 'sr_4l_sf_presel': [6.328916352707893, 0.7409668954355337], 'sr_4l_sf_trn': [2.1822817949578166, 0.23177169086467067], 'sr_4l_of_presel': [1.8504821928218007, 0.20673090259240398], 'all_events': [2612628.3130944027, 4739155.263059123], '4l_presel': [43.044581399764866, 5.732465444166863], 'cr_4l_btag_sf_offZ_met80': [1.6483099256874993, 0.051794245569599134], 'cr_4l_sf': [11.429296468617395, 0.5261506111547267], 'sr_4l_sf_A': [0.58405411161948, 0.034532871510194546], 'sr_4l_of_1': [0.2247555028880015, 0.03622101953838245], 'sr_4l_of_2': [0.0004370792303234339, 0.010489449262681468], 'cr_4l_btag_of': [2.6049697652924806, 0.07841745866607606], 'sr_sf_all_cutbased': [1.5218016663566232, 0.19034565036587744], 'sr_of_all_cutbased': [0.8338602496078238, 0.09277997123333537], 'sr_all_cutbased': [2.355661915964447, 0.2831256215992128]}, '$S/\\sqrt{B}$': {'sr_4l_sf_A': [1.6997341741567213, None], 'sr_4l_sf_B': [1.2928955851584796, None], 'sr_4l_sf_C': [0.6690634727354225, None], 'sr_4l_of_1': [2.704040585334127, None], 'sr_4l_of_2': [1.8768995488452491, None], 'sr_4l_of_3': [1.4570760328884798, None], 'sr_4l_of_4': [2.338104016392618, None], 'sr_sf_all_cutbased': [2.2379278780754537, None], 'sr_of_all_cutbased': [4.2923639594842085, None], 'sr_all_cutbased': [4.840734401735572, None]}, '$S/\\sqrt{S+B}$': {'sr_4l_sf_A': [1.22560967692322, None], 'sr_4l_sf_B': [1.0551906003922045, None], 'sr_4l_sf_C': [0.5697580749248254, None], 'sr_4l_of_1': [1.5363956729406407, None], 'sr_4l_of_2': [1.1255886886700301, None], 'sr_4l_of_3': [0.9812913654271258, None], 'sr_4l_of_4': [1.6257598316487298, None], 'sr_sf_all_cutbased': [1.714692551819697, None], 'sr_of_all_cutbased': [2.6895147023128505, None], 'sr_all_cutbased': [3.18961751331142, None]}, 'Sig': {'sr_4l_sf_A': [3.128938727430068, 0.00013680466095312944], 'sr_4l_sf_B': [3.3345436750423687, 0.0001506814168960968], 'sr_4l_sf_C': [1.181228760097838, 4.484353004512215e-05], 'sr_4l_of_1': [3.485870358581451, 0.00015704724282298693], 'sr_4l_of_2': [1.9785203373594413, 8.326724265232396e-05], 'sr_4l_of_3': [1.7621821535549316, 6.173860641957155e-05], 'sr_4l_of_4': [5.117193291793228, 0.00016520122725379688], 'sr_sf_all_cutbased': [7.644711162570275, 0.0003323296078943484], 'sr_of_all_cutbased': [12.343766141289052, 0.00046725431914867934], 'sr_all_cutbased': [19.988477303859327, 0.0007995839270430276]}, 'Bkg': {'sr_4l_sf_A': [3.3886920578188438, 0.04534706029917568], 'sr_4l_sf_B': [6.651903116671747, 0.14940524226321245], 'sr_4l_sf_C': [3.116975467579323, 0.037097359471379925], 'sr_4l_of_1': [1.6618661864340538, 0.0650148965509467], 'sr_4l_of_2': [1.1112172580360493, 0.015732913853981147], 'sr_4l_of_3': [1.4626390627781802, 0.03637136447378289], 'sr_4l_of_4': [4.790005233553529, 0.08110258711349308], 'sr_sf_all_cutbased': [13.157570642069913, 0.23184966203376806], 'sr_of_all_cutbased': [9.025727740801813, 0.19822176199220382], 'sr_all_cutbased': [22.183298382871726, 0.43007142402597176]}, 'Zmetric': {'sr_4l_sf_A': [1.506006574717711, None], 'sr_4l_sf_B': [1.2026702524278647, None], 'sr_4l_sf_C': [0.6323467198919773, None], 'sr_4l_of_1': [2.1606677653842192, None], 'sr_4l_of_2': [1.536970006909602, None], 'sr_4l_of_3': [1.254969951949225, None], 'sr_4l_of_4': [2.04091460317212, None], 'sr_sf_all_cutbased': [2.028382092537306, None], 'sr_of_all_cutbased': [3.5736597476881857, None], 'sr_all_cutbased': [4.109182145582356, None]}} -# Lep SFs top MVA (e.g. nov04_lepSFTight_CRttZ1l.pkl.gz) -#EWK_REF = {'WWZ': {'sr_4l_sf_B': (1.74868254069881, 4.917508504242763e-05), 'sr_4l_sf_presel': (4.485213322035126, 0.0001274834371272613), 'all_events': (140.49884896972947, 0.0042351610608142515), '4l_presel': (23.282545120181545, 0.0006555966586360433), 'cr_4l_sf': (0.9351660713566458, 2.6186025483711817e-05), 'sr_4l_of_4': (4.622167446493546, 0.00013320708323522686), 'sr_4l_of_presel': (8.22255374678742, 0.00023250123569042185), 'cr_4l_of': (0.4185447171302684, 1.1512598140844779e-05), 'sr_4l_of_3': (1.3010239895778046, 3.616291039660801e-05), 'sr_4l_sf_A': (2.0713672516110853, 5.9315776828571735e-05), 'sr_4l_sf_C': (0.5017651491147224, 1.4345213220363006e-05), 'sr_4l_of_2': (0.6392456712632927, 1.7562125977397695e-05), 'sr_4l_of_1': (0.5547224892334729, 1.504718134311537e-05), 'sr_sf_all': [4.321814941424617, 0.00012283607509136236], 'sr_of_all': [7.117159596568117, 0.00020197930095234795], 'sr_all': [11.438974537992735, 0.0003248153760437103]}, 'ZH': {'sr_4l_sf_B': (1.2788690998095447, 7.608744194847245e-05), 'sr_4l_sf_presel': (2.8082857463062836, 0.00016194320312425535), 'all_events': (135.1955275044606, 0.00804450770608423), '4l_presel': (17.867805208533284, 0.0008812736600852035), 'cr_4l_sf': (0.05997741084194117, 2.476135332980253e-06), 'sr_4l_of_4': (0.12922648540757373, 8.987281304726395e-06), 'sr_4l_of_presel': (6.700939767087803, 0.0003149247951256664), 'cr_4l_of': (0.33829148431526557, 2.0302748603509765e-05), 'sr_4l_of_3': (0.29687829180933717, 1.4754310441059466e-05), 'sr_4l_sf_A': (0.7998454691442916, 5.547575575722742e-05), 'sr_4l_sf_C': (0.5617188863544369, 2.263170941530228e-05), 'sr_4l_of_2': (1.1344083935660307, 5.067890254114451e-05), 'sr_4l_of_1': (2.55994128557563, 0.00011380052967514463), 'sr_sf_all': [2.640433455308273, 0.00015419490712100214], 'sr_of_all': [4.120454456358572, 0.000188221023962075], 'sr_all': [6.7608879116668446, 0.00034241593108307717]}, 'ZZ': {'sr_4l_sf_B': (3.67848669195266, 0.0019192733711653476), 'sr_4l_sf_presel': (10.644875305946407, 0.005518689817435923), 'all_events': (20480.140682549172, 12.056295896759893), '4l_presel': (2720.7554111197423, 1.3958887964699902), 'cr_4l_sf': (1534.2599060524597, 0.787760489758707), 'sr_4l_of_4': (0.42259493833710116, 0.0002322511185316642), 'sr_4l_of_presel': (16.656698245005934, 0.008506865772611031), 'cr_4l_of': (0.720524285849299, 0.0003826803013148129), 'sr_4l_of_3': (0.3154593548227072, 0.00016727607892548892), 'sr_4l_sf_A': (1.0859978774794223, 0.0005727572547785321), 'sr_4l_sf_C': (2.1505048033201524, 0.0010757501569306244), 'sr_4l_of_2': (0.49655303148241503, 0.00025851613979802616), 'sr_4l_of_1': (0.5022183542971218, 0.0002573535069119564), 'sr_sf_all': [6.914989372752235, 0.0035677807828745044], 'sr_of_all': [1.7368256789393453, 0.0009153968441671357], 'sr_all': [8.65181505169158, 0.00448317762704164]}, 'ttZ': {'sr_4l_sf_B': (0.8623534921040487, 0.0026072132614722385), 'sr_4l_sf_presel': (2.2199135626257247, 0.006866412477031506), 'all_events': (6383.087986846862, 30.391735907350938), '4l_presel': (142.05677820627022, 0.4559282075895868), 'cr_4l_sf': (0.4439092328322823, 0.0013620522379399643), 'sr_4l_of_4': (1.8944468392895115, 0.0059636123355944455), 'sr_4l_of_presel': (3.4678790244953532, 0.010304685806516485), 'cr_4l_of': (53.768419315835885, 0.1731114682795787), 'sr_4l_of_3': (0.653330679680918, 0.001748962496855188), 'sr_4l_sf_A': (1.0055752564436247, 0.0032314494211373073), 'sr_4l_sf_C': (0.2161743800251384, 0.0006931474238017385), 'sr_4l_of_2': (0.24119583487607194, 0.0006679596224336652), 'sr_4l_of_1': (0.23368665546995349, 0.0006164622415794652), 'sr_sf_all': [2.0841031285728118, 0.006531810106411284], 'sr_of_all': [3.022660009316455, 0.008996996696462763], 'sr_all': [5.106763137889266, 0.015528806802874048]}, 'tWZ': {'sr_4l_sf_B': (0.2859664381300148, 0.00017667278493666024), 'sr_4l_sf_presel': (0.7152586082876218, 0.00044209172801275276), 'all_events': (455.4749377694133, 0.30381106357458043), '4l_presel': (19.656311394705504, 0.01211181234852329), 'cr_4l_sf': (0.14715859224582475, 9.008463241592307e-05), 'sr_4l_of_4': (0.6759082105012022, 0.0004220498538698098), 'sr_4l_of_presel': (1.2397287775225816, 0.0007629024552210294), 'cr_4l_of': (6.611493527295336, 0.00406995273997062), 'sr_4l_of_3': (0.1972787183086039, 0.00012040479187796226), 'sr_4l_sf_A': (0.3201974562306746, 0.00019807125613647463), 'sr_4l_sf_C': (0.07923669398284293, 4.903932175832338e-05), 'sr_4l_of_2': (0.11362721564154872, 6.739094537387002e-05), 'sr_4l_of_1': (0.09882170912487395, 5.9356989736279064e-05), 'sr_sf_all': [0.6854005883435323, 0.0004237833628314583], 'sr_of_all': [1.0856358535762287, 0.000669202580857921], 'sr_all': [1.7710364419197613, 0.0010929859436893793]}, 'other': {'sr_4l_sf_B': (1.1039758356047003, 0.1153498845316028), 'sr_4l_sf_presel': (2.175467418271284, 0.17904304942867552), 'all_events': (2676885.562879981, 4742821.485251619), '4l_presel': (47.720825052669255, 5.0050931433288754), 'cr_4l_sf': (10.618131090570161, 0.45610101045872087), 'sr_4l_of_4': (1.2560581627118375, 0.06480727751973193), 'sr_4l_of_presel': (3.424158982788239, 0.25620604445088613), 'cr_4l_of': (2.1181532489905788, 0.04497175017953798), 'sr_4l_of_3': (0.07670962255594513, 0.02764394673567354), 'sr_4l_sf_A': (0.587462637715449, 0.034215018598536415), 'sr_4l_sf_C': (0.3208864176982962, 0.02532342224375908), 'sr_4l_of_2': (0.11683187903784763, 0.011819071436898526), 'sr_4l_of_1': (0.6131084627263095, 0.04833481876350218), 'sr_sf_all': [2.0123248910184452, 0.17488832537389828], 'sr_of_all': [2.0627081270319394, 0.15260511445580618], 'sr_all': [4.0750330180503855, 0.3274934398297046]}, '$S/\\sqrt{B}$': {'sr_4l_sf_A': [1.6579073236239172, None], 'sr_4l_sf_B': [1.243184430438196, None], 'sr_4l_sf_C': [0.6393547723449631, None], 'sr_4l_of_1': [2.5885205017133126, None], 'sr_4l_of_2': [1.8025386843695004, None], 'sr_4l_of_3': [1.4333537035004176, None], 'sr_4l_of_4': [2.305033579902631, None], 'sr_sf_all': [2.1686260043470016, None], 'sr_of_all': [4.161402016178655, None], 'sr_all': [4.692569177645207, None]}, '$S/\\sqrt{S+B}$': {'sr_4l_sf_A': [1.185031303185296, None], 'sr_4l_sf_B': [1.0115280535666447, None], 'sr_4l_sf_C': [0.5433946453973049, None], 'sr_4l_of_1': [1.4581754520985202, None], 'sr_4l_of_2': [1.0711397102996822, None], 'sr_4l_of_3': [0.9480669557798651, None], 'sr_4l_of_4': [1.5837625997173428, None], 'sr_sf_all': [1.6500805838891106, None], 'sr_of_all': [2.584714849454142, None], 'sr_all': [3.0665154143288724, None]}, 'Sig': {'sr_4l_sf_A': [2.871212720755377, 0.00011479153258579916], 'sr_4l_sf_B': [3.0275516405083547, 0.0001252625269909001], 'sr_4l_sf_C': [1.0634840354691593, 3.697692263566529e-05], 'sr_4l_of_1': [3.114663774809103, 0.00012884771101826], 'sr_4l_of_2': [1.7736540648293233, 6.824102851854221e-05], 'sr_4l_of_3': [1.5979022813871417, 5.0917220837667476e-05], 'sr_4l_of_4': [4.75139393190112, 0.00014219436453995326], 'sr_sf_all': [6.962248396732891, 0.00027703098221236455], 'sr_of_all': [11.237614052926688, 0.0003902003249144229], 'sr_all': [18.199862449659577, 0.0006672313071267874]}, 'Bkg': {'sr_4l_sf_A': [2.999233227869171, 0.03821729653058873], 'sr_4l_sf_B': [5.930782457791424, 0.12005304394917705], 'sr_4l_sf_C': [2.76680229502643, 0.027141359146249766], 'sr_4l_of_1': [1.4478351816182586, 0.04926799150172988], 'sr_4l_of_2': [0.9682079610378834, 0.012812938144504089], 'sr_4l_of_3': [1.2427783753681743, 0.029680590103332176], 'sr_4l_of_4': [4.249008150839652, 0.07142519082772786], 'sr_sf_all': [11.696817980687026, 0.18541169962601556], 'sr_of_all': [7.907829668863968, 0.163186710577294], 'sr_all': [19.604647649550998, 0.34859841020330956]}, 'Zmetric': {'sr_4l_sf_A': [1.4637115657112032, None], 'sr_4l_sf_B': [1.1550907652954854, None], 'sr_4l_sf_C': [0.6038316021520365, None], 'sr_4l_of_1': [2.0601831062065683, None], 'sr_4l_of_2': [1.4700171813207716, None], 'sr_4l_of_3': [1.2251301329720645, None], 'sr_4l_of_4': [2.0020793789373705, None], 'sr_sf_all': [1.9599231687556398, None], 'sr_of_all': [3.45174892290265, None], 'sr_all': [3.9693663794344753, None]}} - -# Lep SFs topMVA and btag corrections (e.g. nov19_lepSFTight_CRttZ1l_btagSFsingleWP_withUL16APVF_corlibBtagSF_newBtagEFFbd4162f.pkl.gz) -#EWK_REF = {'WWZ': {'sr_4l_sf_A': (1.9328528313343771, 5.213755600250673e-05), 'sr_4l_sf_B': (1.6453567291371223, 4.388333364131873e-05), 'sr_4l_sf_C': (0.4761728793852009, 1.2995780148850957e-05), 'sr_4l_of_1': (0.5232237891276427, 1.34827875241377e-05), 'sr_4l_of_2': (0.6034339692979168, 1.576638237951547e-05), 'sr_4l_of_3': (1.2253236255671685, 3.23119614163263e-05), 'sr_4l_of_4': (4.34639790601154, 0.00011872493338036402), 'sr_4l_sf_presel': (4.2059161040137925, 0.00011304061115484224), 'sr_4l_of_presel': (7.744366932601156, 0.00020780212769824956), 'all_events': (154.73522662092805, 0.005647558222033173), '4l_presel': (23.506105509185, 0.0006969176653045498), 'cr_4l_of': (2.719997349356926, 0.00010234799809708152), 'cr_4l_sf': (0.8826387009123812, 2.3492256993059274e-05), 'sr_sf_all': [4.054382439856701, 0.0001090166697926764], 'sr_of_all': [6.698379290004268, 0.0001802860647003435], 'sr_all': [10.752761729860968, 0.00028930273449301986]}, 'ZH': {'sr_4l_sf_A': (0.7488679706238699, 4.7678868181546e-05), 'sr_4l_sf_B': (1.211665390873752, 6.72379729411185e-05), 'sr_4l_sf_C': (0.5355616177276739, 2.0290587523138885e-05), 'sr_4l_of_1': (2.433313092376997, 0.00010041310383502371), 'sr_4l_of_2': (1.0788351300897419, 4.512231360582697e-05), 'sr_4l_of_3': (0.28174983232668194, 1.3033933078325302e-05), 'sr_4l_of_4': (0.12237884045258428, 7.932386116297714e-06), 'sr_4l_sf_presel': (2.6514237376142438, 0.00014179180443829814), 'sr_4l_of_presel': (6.367442568621571, 0.0002788470806316566), 'all_events': (148.35524375314753, 0.010281545149311684), '4l_presel': (18.01854265138008, 0.0009278156064695831), 'cr_4l_of': (1.918142139692452, 0.00014479361131858044), 'cr_4l_sf': (0.057239810557850615, 2.259675458538832e-06), 'sr_sf_all': [2.4960949792252958, 0.00013520742864580338], 'sr_of_all': [3.916276895246005, 0.0001665017366354737], 'sr_all': [6.4123718744713, 0.00030170916528127705]}, 'ZZ': {'sr_4l_sf_A': (1.016690630867433, 0.0005039304203131004), 'sr_4l_sf_B': (3.3825657961164852, 0.0016343260971195938), 'sr_4l_sf_C': (1.9903822665283606, 0.0009283558449268911), 'sr_4l_of_1': (0.4747548751517215, 0.00023153334037399474), 'sr_4l_of_2': (0.4699339390755087, 0.00023338714214114095), 'sr_4l_of_3': (0.2979325959045335, 0.0001499326592357303), 'sr_4l_of_4': (0.40183271849912555, 0.0002109213257393783), 'sr_4l_sf_presel': (9.90901400195508, 0.004818257468338145), 'sr_4l_of_presel': (15.942973111892883, 0.007826042075432008), 'all_events': (22510.162130849723, 15.858978389565964), '4l_presel': (2750.3427774826228, 1.4780420922210347), 'cr_4l_of': (4.194991716194073, 0.0029413111574327793), 'cr_4l_sf': (1469.077011626406, 0.7264159103039762), 'sr_sf_all': [6.389638693512278, 0.0030666123623595853], 'sr_of_all': [1.6444541286308891, 0.0008257744674902443], 'sr_all': [8.034092822143167, 0.00389238682984983]}, 'ttZ': {'sr_4l_sf_A': (1.0040904162898063, 0.003174164118648877), 'sr_4l_sf_B': (0.8644839242267756, 0.002627522256113313), 'sr_4l_sf_C': (0.21876828039843882, 0.0007184064251811959), 'sr_4l_of_1': (0.23622393602033473, 0.0006408656684392281), 'sr_4l_of_2': (0.24545506437456024, 0.0007084272257368942), 'sr_4l_of_3': (0.6670764706438969, 0.0018062633088032733), 'sr_4l_of_4': (1.898767666101388, 0.005953020451609651), 'sr_4l_sf_presel': (2.2294353861152296, 0.006871342423870653), 'sr_4l_of_presel': (3.5029047410250254, 0.010455439688981667), 'all_events': (6732.614511395827, 37.5506666045899), '4l_presel': (143.20231527299708, 0.48353752370665865), 'cr_4l_of': (58.53269960779905, 0.19862214416068574), 'cr_4l_sf': (0.43789838384843677, 0.0013672675495066703), 'sr_sf_all': [2.0873426209150208, 0.006520092799943387], 'sr_of_all': [3.04752313714018, 0.009108576654589046], 'sr_all': [5.1348657580552, 0.015628669454532434]}, 'tWZ': {'sr_4l_sf_A': (0.3151479764540492, 0.0001956475153507406), 'sr_4l_sf_B': (0.28262821736325916, 0.00017550439905985452), 'sr_4l_sf_C': (0.07862374972712925, 4.8976386938752056e-05), 'sr_4l_of_1': (0.09656565498504384, 5.7523984922841484e-05), 'sr_4l_of_2': (0.11151339673621262, 6.619464194934773e-05), 'sr_4l_of_3': (0.19378064624962915, 0.00011778900840292277), 'sr_4l_of_4': (0.6672360288263123, 0.0004176260567433958), 'sr_4l_sf_presel': (0.7054981850916262, 0.00043782367788507376), 'sr_4l_of_presel': (1.2242457705058638, 0.0007557616277358607), 'all_events': (481.4677892777096, 0.37290934855350727), '4l_presel': (19.80510777197338, 0.012832275215475131), 'cr_4l_of': (7.642521036504865, 0.004986257914654622), 'cr_4l_sf': (0.14568836262943768, 8.990692673261788e-05), 'sr_sf_all': [0.6763999435444376, 0.00042012830134934714], 'sr_of_all': [1.0690957267971979, 0.0006591336920185077], 'sr_all': [1.7454956703416356, 0.001079261993367855]}, 'other': {'sr_4l_sf_A': (0.5690752960390437, 0.03105833484186301), 'sr_4l_sf_B': (1.0741286377497536, 0.0927840461373301), 'sr_4l_sf_C': (0.29824033849416226, 0.023373605387380765), 'sr_4l_of_1': (0.5510847696019162, 0.03959363958073122), 'sr_4l_of_2': (0.09538458600770297, 0.011042215526065423), 'sr_4l_of_3': (0.08089019268582368, 0.023890108872888356), 'sr_4l_of_4': (1.1768197791978092, 0.05488650128467712), 'sr_4l_sf_presel': (2.0826611598475586, 0.15048406599050587), 'sr_4l_of_presel': (3.1709478761658714, 0.2187377941695375), 'all_events': (2860728.18394136, 6017867.169534823), '4l_presel': (47.88942795718206, 4.38712317244549), 'cr_4l_of': (3.417519193830976, 0.13915612452607556), 'cr_4l_sf': (9.825664693920267, 0.388140956221059), 'sr_sf_all': [1.9414442722829597, 0.14721598636657388], 'sr_of_all': [1.9041793274932521, 0.12941246526436212], 'sr_all': [3.8456235997762116, 0.276628451630936]}, '$S/\\sqrt{B}$': {'sr_4l_sf_A': [1.5734037088293156, None], 'sr_4l_sf_B': [1.2069020767748808, None], 'sr_4l_sf_C': [0.6291454631538783, None], 'sr_4l_of_1': [2.536488064796381, None], 'sr_4l_of_2': [1.751710879889635, None], 'sr_4l_of_3': [1.3535666345294313, None], 'sr_4l_of_4': [2.1950499282717715, None], 'sr_sf_all': [2.080393200260103, None], 'sr_of_all': [4.019035895746074, None], 'sr_all': [4.52555912556492, None]}, '$S/\\sqrt{S+B}$': {'sr_4l_sf_A': [1.1345794389997155, None], 'sr_4l_sf_B': [0.9822163334368799, None], 'sr_4l_sf_C': [0.5333976768387407, None], 'sr_4l_of_1': [1.4232609752341936, None], 'sr_4l_of_2': [1.0423860982624902, None], 'sr_4l_of_3': [0.9093364269383806, None], 'sr_4l_of_4': [1.5226515189827519, None], 'sr_sf_all': [1.592649525390964, None], 'sr_of_all': [2.5015197315018383, None], 'sr_all': [2.9654904278754786, None]}, 'Sig': {'sr_4l_sf_A': [2.681720801958247, 9.981642418405273e-05], 'sr_4l_sf_B': [2.8570221200108743, 0.00011112130658243723], 'sr_4l_sf_C': [1.0117344971128748, 3.328636767198984e-05], 'sr_4l_of_1': [2.95653688150464, 0.00011389589135916141], 'sr_4l_of_2': [1.6822690993876588, 6.088869598534244e-05], 'sr_4l_of_3': [1.5070734578938505, 4.53458944946516e-05], 'sr_4l_of_4': [4.468776746464124, 0.00012665731949666173], 'sr_sf_all': [6.550477419081996, 0.00024422409843847983], 'sr_of_all': [10.614656185250274, 0.0003467878013358172], 'sr_all': [17.16513360433227, 0.000591011899774297]}, 'Bkg': {'sr_4l_sf_A': [2.9050043196503323, 0.03493207689617573], 'sr_4l_sf_B': [5.603806575456273, 0.09722139888962286], 'sr_4l_sf_C': [2.586014635148091, 0.025069344044427604], 'sr_4l_of_1': [1.3586292357590164, 0.040523562574467285], 'sr_4l_of_2': [0.9222869861939845, 0.012050224535892806], 'sr_4l_of_3': [1.2396799054838832, 0.02596409384933028], 'sr_4l_of_4': [4.144656192624635, 0.06146806911876954], 'sr_sf_all': [11.094825530254697, 0.15722281983022618], 'sr_of_all': [7.665252320061519, 0.14000595007845992], 'sr_all': [18.760077850316215, 0.29722876990868613]}, 'Zmetric': {'sr_4l_sf_A': [1.3941054315112151, None], 'sr_4l_sf_B': [1.121470334733581, None], 'sr_4l_sf_C': [0.593646320326605, None], 'sr_4l_of_1': [2.015105967190228, None], 'sr_4l_of_2': [1.4294612189280722, None], 'sr_4l_of_3': [1.1646040222160488, None], 'sr_4l_of_4': [1.9141453826105042, None], 'sr_sf_all': [1.88511050591042, None], 'sr_of_all': [3.3353060593828427, None], 'sr_all': [3.831175815497084, None]}} - -EWK_REF = {'WWZ': {'sr_4l_sf_A': [1.9328528313343776, 5.2137556002506736e-05], 'sr_4l_sf_B': [1.6453567291371223, 4.388333364131875e-05], 'sr_4l_sf_C': [0.4761728793852009, 1.2995780148850962e-05], 'sr_4l_of_1': [0.5232237891276429, 1.3482787524137701e-05], 'sr_4l_of_2': [0.6034339692979167, 1.5766382379515466e-05], 'sr_4l_of_3': [1.225323625567169, 3.2311961416326294e-05], 'sr_4l_of_4': [4.34639790601154, 0.00011872493338036404], 'sr_4l_sf_presel': [4.2059161040137925, 0.00011304061115484228], 'sr_4l_of_presel': [7.744366932601152, 0.0002078021276982496], 'all_events': [154.73522662092856, 0.005647558222033289], '4l_presel': [23.506105509184987, 0.0006969176653045492], 'cr_4l_btag_of': [2.7199973493569267, 0.00010234799809708152], 'cr_4l_sf': [0.8826387009123812, 2.349225699305928e-05], 'cr_4l_btag_sf': [2.807732492378132, 0.000105813793933202], 'cr_4l_btag_sf_offZ': [2.4994376236809583, 9.434796861413905e-05], 'cr_4l_btag_sf_offZ_met80': [1.370863075717862, 5.142520196891215e-05], 'sr_4l_bdt_sf_wwz_sr2': [3.4114452308227627, 9.266324308609935e-05], 'sr_4l_bdt_sf_wwz_sr3': [0.2260790356134493, 5.822331152233266e-06], 'sr_4l_bdt_sf_zh_sr1': [0.876577180974417, 2.326077877140768e-05], 'sr_4l_bdt_of_wwz_sr2': [1.581818339080513, 4.2371884787355617e-05], 'sr_4l_bdt_of_wwz_sr3': [1.4699469379544168, 3.872868887761272e-05], 'sr_4l_bdt_of_wwz_sr4': [1.515234977604428, 4.032970318617102e-05], 'sr_4l_bdt_of_zh_sr2': [0.3105757025517787, 8.188114113863624e-06], 'sr_4l_bdt_of_zh_sr3': [0.09846758213798881, 2.5996770298945594e-06], 'sr_4l_bdt_of_zh_sr4': [0.12269368495874469, 3.168940886463119e-06], 'sr_4l_bdt_sf_wwz_sr1': [1.0737994050290791, 2.8681886031869566e-05], 'sr_4l_bdt_sf_zh_sr2': [0.06938677891722966, 1.8637741784684314e-06], 'sr_4l_bdt_sf_wwz_sr4': [0.022804140048872393, 6.17006654740373e-07], 'sr_4l_bdt_of_wwz_sr1': [1.5848611631672562, 4.473811200890358e-05], 'sr_4l_bdt_of_zh_sr1': [0.24012856029268062, 6.572178848746523e-06], 'sr_sf_all_cutbased': [4.054382439856701, 0.00010901666979267644], 'sr_of_all_cutbased': [6.698379290004269, 0.0001802860647003435], 'sr_all_cutbased': [10.75276172986097, 0.00028930273449301997], 'sr_sf_all_bdt': [5.680091771405811, 0.00015290901987481868], 'sr_of_all_bdt': [6.923726947747807, 0.00018669729973901078], 'sr_all_bdt': [12.603818719153617, 0.0003396063196138293]}, 'ZH': {'sr_4l_sf_A': [0.74886797062387, 4.767886818154601e-05], 'sr_4l_sf_B': [1.2116653908737525, 6.72379729411185e-05], 'sr_4l_sf_C': [0.535561617727674, 2.0290587523138885e-05], 'sr_4l_of_1': [2.4333130923769977, 0.00010041310383502371], 'sr_4l_of_2': [1.0788351300897419, 4.512231360582697e-05], 'sr_4l_of_3': [0.281749832326682, 1.3033933078325302e-05], 'sr_4l_of_4': [0.12237884045258428, 7.932386116297716e-06], 'sr_4l_sf_presel': [2.6514237376142447, 0.00014179180443829812], 'sr_4l_of_presel': [6.36744256862157, 0.0002788470806316566], 'all_events': [148.35524375314742, 0.010281545149311948], '4l_presel': [18.018542651380084, 0.0009278156064695831], 'cr_4l_btag_of': [1.918142139692452, 0.00014479361131858044], 'cr_4l_sf': [0.057239810557850615, 2.259675458538832e-06], 'cr_4l_btag_sf': [1.9567002974932706, 0.00015009150617847005], 'cr_4l_btag_sf_offZ': [1.9392451353647309, 0.00014880910655946673], 'cr_4l_btag_sf_offZ_met80': [0.6923203539789865, 6.976661287622539e-05], 'sr_4l_bdt_sf_wwz_sr2': [0.39160436774155843, 2.5926631957515468e-05], 'sr_4l_bdt_sf_wwz_sr3': [0.4818267276102463, 2.0034187529146368e-05], 'sr_4l_bdt_sf_zh_sr1': [2.0878215039245958, 9.787861402982257e-05], 'sr_4l_bdt_of_wwz_sr2': [0.036314909047065705, 2.828936254104918e-06], 'sr_4l_bdt_of_wwz_sr3': [0.06882749752718008, 4.245564735667345e-06], 'sr_4l_bdt_of_wwz_sr4': [0.7652632554781561, 4.020722703663161e-05], 'sr_4l_bdt_of_zh_sr2': [2.1161407270810217, 8.970103401236629e-05], 'sr_4l_bdt_of_zh_sr3': [0.882349167748851, 4.182791410968408e-05], 'sr_4l_bdt_of_zh_sr4': [0.36868736103994915, 1.896218221572697e-05], 'sr_4l_bdt_sf_wwz_sr1': [0.015590050563695751, 1.345288863681486e-06], 'sr_4l_bdt_sf_zh_sr2': [0.6117415028081631, 2.6333781969531946e-05], 'sr_4l_bdt_sf_wwz_sr4': [0.2679539892551868, 1.2431903157867423e-05], 'sr_4l_bdt_of_wwz_sr1': [0.023657255624538704, 1.6007066077671341e-06], 'sr_4l_bdt_of_zh_sr1': [0.8801021223548686, 2.9369671883670373e-05], 'sr_sf_all_cutbased': [2.496094979225296, 0.0001352074286458034], 'sr_of_all_cutbased': [3.9162768952460056, 0.0001665017366354737], 'sr_all_cutbased': [6.412371874471302, 0.0003017091652812771], 'sr_sf_all_bdt': [3.8565381419034463, 0.0001839504075075653], 'sr_of_all_bdt': [5.141342295901631, 0.0002287432368556187], 'sr_all_bdt': [8.997880437805078, 0.000412693644363184]}, 'ZZ': {'sr_4l_sf_A': [1.016690630867433, 0.0005039304203131004], 'sr_4l_sf_B': [3.3825657961164852, 0.0016343260971195938], 'sr_4l_sf_C': [1.9903822665283606, 0.0009283558449268911], 'sr_4l_of_1': [0.4747548751517215, 0.00023153334037399474], 'sr_4l_of_2': [0.4699339390755087, 0.00023338714214114095], 'sr_4l_of_3': [0.2979325959045335, 0.0001499326592357303], 'sr_4l_of_4': [0.40183271849912555, 0.0002109213257393783], 'sr_4l_sf_presel': [9.90901400195508, 0.004818257468338144], 'sr_4l_of_presel': [15.942973111892883, 0.007826042075432008], 'all_events': [22510.162130849734, 15.85897838956542], '4l_presel': [2750.342777482622, 1.478042092221035], 'cr_4l_btag_of': [4.194991716194073, 0.0029413111574327793], 'cr_4l_sf': [1469.077011626406, 0.7264159103039761], 'cr_4l_btag_sf': [526.9653351466242, 0.37054970643706936], 'cr_4l_btag_sf_offZ': [145.22853492325328, 0.10123287287224945], 'cr_4l_btag_sf_offZ_met80': [2.7488619221657467, 0.0020374979879436393], 'sr_4l_bdt_sf_wwz_sr2': [0.7403274193841964, 0.0003702285928844691], 'sr_4l_bdt_sf_wwz_sr3': [1.064940282037649, 0.0005167028169753288], 'sr_4l_bdt_sf_zh_sr1': [1.4115794690468602, 0.0006940326885552536], 'sr_4l_bdt_of_wwz_sr2': [0.1268140654279364, 6.74907840540416e-05], 'sr_4l_bdt_of_wwz_sr3': [0.2337498990898393, 0.00011939511415674552], 'sr_4l_bdt_of_wwz_sr4': [0.620116738088171, 0.0003138199110718423], 'sr_4l_bdt_of_zh_sr2': [0.11753345243429077, 5.9732955502863324e-05], 'sr_4l_bdt_of_zh_sr3': [0.2634735183679704, 0.00013033540237496533], 'sr_4l_bdt_of_zh_sr4': [0.6078390855466855, 0.00030106192467923323], 'sr_4l_bdt_sf_wwz_sr1': [0.06294909570019519, 3.407037323677032e-05], 'sr_4l_bdt_sf_zh_sr2': [0.14766283511468803, 7.288722234691572e-05], 'sr_4l_bdt_sf_wwz_sr4': [0.13121586350593942, 6.49535260798448e-05], 'sr_4l_bdt_of_wwz_sr1': [0.06237440155110597, 3.3552973145785485e-05], 'sr_4l_bdt_of_zh_sr1': [0.016319989253129413, 8.242355793495689e-06], 'sr_sf_all_cutbased': [6.389638693512278, 0.0030666123623595853], 'sr_of_all_cutbased': [1.6444541286308891, 0.0008257744674902443], 'sr_all_cutbased': [8.034092822143167, 0.00389238682984983], 'sr_sf_all_bdt': [3.5586749647895277, 0.0017528752200785824], 'sr_of_all_bdt': [2.048221149759129, 0.0010336314207789726], 'sr_all_bdt': [5.6068961145486576, 0.0027865066408575547]}, 'ttZ': {'sr_4l_sf_A': [1.0040904162898063, 0.003174164118648877], 'sr_4l_sf_B': [0.8644839242267756, 0.002627522256113313], 'sr_4l_sf_C': [0.21876828039843882, 0.0007184064251811959], 'sr_4l_of_1': [0.2362239360203347, 0.0006408656684392281], 'sr_4l_of_2': [0.24545506437456024, 0.0007084272257368942], 'sr_4l_of_3': [0.6670764706438969, 0.0018062633088032733], 'sr_4l_of_4': [1.898767666101388, 0.005953020451609651], 'sr_4l_sf_presel': [2.2294353861152296, 0.006871342423870653], 'sr_4l_of_presel': [3.502904741025026, 0.010455439688981669], 'all_events': [6732.614511395827, 37.5506666045899], '4l_presel': [143.20231527299705, 0.48353752370665865], 'cr_4l_btag_of': [58.53269960779907, 0.19862214416068574], 'cr_4l_sf': [0.4378983838484369, 0.0013672675495066703], 'cr_4l_btag_sf': [61.45237767830762, 0.20695714256825193], 'cr_4l_btag_sf_offZ': [53.8453306600037, 0.18092563815002047], 'cr_4l_btag_sf_offZ_met80': [28.73497309154785, 0.09638784980148293], 'sr_4l_bdt_sf_wwz_sr2': [1.783702589398399, 0.0053571581462256105], 'sr_4l_bdt_sf_wwz_sr3': [0.0985756347866812, 0.0002669192740532763], 'sr_4l_bdt_sf_zh_sr1': [0.38550145410165754, 0.0010534268442725916], 'sr_4l_bdt_of_wwz_sr2': [0.7045606904486231, 0.002306146814310665], 'sr_4l_bdt_of_wwz_sr3': [0.9508374749926077, 0.002911281432011187], 'sr_4l_bdt_of_wwz_sr4': [0.7032879526837775, 0.0019599712119811505], 'sr_4l_bdt_of_zh_sr2': [0.14553081030787138, 0.0004046881644573356], 'sr_4l_bdt_of_zh_sr3': [0.03603756969085395, 0.00010768952960222134], 'sr_4l_bdt_of_zh_sr4': [0.08983034184232387, 0.00023428592278252022], 'sr_4l_bdt_sf_wwz_sr1': [0.3837736678827732, 0.0012499735397910538], 'sr_4l_bdt_sf_zh_sr2': [0.023000750936863094, 8.009407280059725e-05], 'sr_4l_bdt_sf_wwz_sr4': [0.007353326349971189, 1.560721270965806e-05], 'sr_4l_bdt_of_wwz_sr1': [0.3528205756105665, 0.0009530437621222475], 'sr_4l_bdt_of_zh_sr1': [0.06699592055750414, 0.00014465454332028996], 'sr_sf_all_cutbased': [2.0873426209150208, 0.006520092799943387], 'sr_of_all_cutbased': [3.04752313714018, 0.009108576654589046], 'sr_all_cutbased': [5.1348657580552, 0.015628669454532434], 'sr_sf_all_bdt': [2.6819074234563454, 0.008023179089852787], 'sr_of_all_bdt': [3.0499013361341287, 0.009021761380587618], 'sr_all_bdt': [5.731808759590474, 0.017044940470440407]}, 'tWZ': {'sr_4l_sf_A': [0.3151479764540492, 0.0001956475153507406], 'sr_4l_sf_B': [0.28262821736325916, 0.00017550439905985452], 'sr_4l_sf_C': [0.07862374972712925, 4.8976386938752056e-05], 'sr_4l_of_1': [0.09656565498504384, 5.7523984922841484e-05], 'sr_4l_of_2': [0.11151339673621262, 6.619464194934773e-05], 'sr_4l_of_3': [0.19378064624962915, 0.00011778900840292276], 'sr_4l_of_4': [0.6672360288263122, 0.0004176260567433958], 'sr_4l_sf_presel': [0.7054981850916262, 0.00043782367788507376], 'sr_4l_of_presel': [1.2242457705058638, 0.0007557616277358607], 'all_events': [481.4677892777097, 0.37290934855350727], '4l_presel': [19.805107771973383, 0.012832275215475131], 'cr_4l_btag_of': [7.642521036504865, 0.004986257914654622], 'cr_4l_sf': [0.1456883626294377, 8.990692673261787e-05], 'cr_4l_btag_sf': [7.7571537412132034, 0.005058097126013755], 'cr_4l_btag_sf_offZ': [6.844257419644353, 0.004468273210250645], 'cr_4l_btag_sf_offZ_met80': [3.6114260990870237, 0.002362821090852035], 'sr_4l_bdt_sf_wwz_sr2': [0.576109619917098, 0.0003579694877225985], 'sr_4l_bdt_sf_wwz_sr3': [0.03882963648423582, 2.342190747548625e-05], 'sr_4l_bdt_sf_zh_sr1': [0.1536490251367103, 9.225952655528711e-05], 'sr_4l_bdt_of_wwz_sr2': [0.2574160731471791, 0.0001583058451034892], 'sr_4l_bdt_of_wwz_sr3': [0.2564783831655443, 0.00016168993070957564], 'sr_4l_bdt_of_wwz_sr4': [0.272884511772505, 0.00016710475682891118], 'sr_4l_bdt_of_zh_sr2': [0.05563439315200546, 3.2773904110129536e-05], 'sr_4l_bdt_of_zh_sr3': [0.02381342741139815, 1.4821259874428316e-05], 'sr_4l_bdt_of_zh_sr4': [0.02276801798376125, 1.3318359859476107e-05], 'sr_4l_bdt_sf_wwz_sr1': [0.13265944137458388, 8.36682191589689e-05], 'sr_4l_bdt_sf_zh_sr2': [0.015728765929002356, 9.341442170329286e-06], 'sr_4l_bdt_sf_wwz_sr4': [0.004593937267696908, 2.66978276230378e-06], 'sr_4l_bdt_of_wwz_sr1': [0.1637949353423472, 0.00010147740022992679], 'sr_4l_bdt_of_zh_sr1': [0.035071217571631216, 2.1105231035985287e-05], 'sr_sf_all_cutbased': [0.6763999435444376, 0.00042012830134934714], 'sr_of_all_cutbased': [1.0690957267971979, 0.0006591336920185077], 'sr_all_cutbased': [1.7454956703416353, 0.001079261993367855], 'sr_sf_all_bdt': [0.9215704261093273, 0.0005693303658449738], 'sr_of_all_bdt': [1.0878609595463717, 0.000670596687751922], 'sr_all_bdt': [2.0094313856556987, 0.001239927053596896]}, 'other': {'sr_4l_sf_A': [0.5690752960390437, 0.03105833484186301], 'sr_4l_sf_B': [1.0741286377497539, 0.0927840461373301], 'sr_4l_sf_C': [0.29824033849416226, 0.023373605387380765], 'sr_4l_of_1': [0.5510847696019162, 0.03959363958073122], 'sr_4l_of_2': [0.09538458600770297, 0.011042215526065423], 'sr_4l_of_3': [0.08089019268582368, 0.023890108872888356], 'sr_4l_of_4': [1.1768197791978092, 0.05488650128467712], 'sr_4l_sf_presel': [2.0826611598475586, 0.15048406599050587], 'sr_4l_of_presel': [3.170947876165872, 0.2187377941695375], 'all_events': [2860728.18394136, 6017867.169534825], '4l_presel': [47.88942795718206, 4.38712317244549], 'cr_4l_btag_of': [3.4175191938309757, 0.13915612452607554], 'cr_4l_sf': [9.825664693920267, 0.388140956221059], 'cr_4l_btag_sf': [12.452762968474797, 0.6947259661764553], 'cr_4l_btag_sf_offZ': [6.64471939786873, 0.5353809613132353], 'cr_4l_btag_sf_offZ_met80': [1.7572691175650694, 0.06600155807888991], 'sr_4l_bdt_sf_wwz_sr2': [0.4007713786784851, 0.03441651188815824], 'sr_4l_bdt_sf_wwz_sr3': [0.06698497453963786, 0.006192242119082616], 'sr_4l_bdt_sf_zh_sr1': [0.2135629744756766, 0.0411358097480734], 'sr_4l_bdt_of_wwz_sr2': [0.24167573388072983, 0.01970008656763433], 'sr_4l_bdt_of_wwz_sr3': [0.6147790225481051, 0.03321740254515027], 'sr_4l_bdt_of_wwz_sr4': [0.6305676380579189, 0.03520732544276005], 'sr_4l_bdt_of_zh_sr2': [0.3765321730914618, 0.021421544610217107], 'sr_4l_bdt_of_zh_sr3': [0.2245618232896836, 0.01009552025840234], 'sr_4l_bdt_of_zh_sr4': [-0.14788271695809765, 0.019266248601065083], 'sr_4l_bdt_sf_wwz_sr1': [0.44613138261676455, 0.021227021091157674], 'sr_4l_bdt_sf_zh_sr2': [0.09023899695881787, 0.0021325316357607574], 'sr_4l_bdt_sf_wwz_sr4': [-0.004445079669266625, 0.0004807414834765565], 'sr_4l_bdt_of_wwz_sr1': [0.2158468663878626, 0.011507382636833517], 'sr_4l_bdt_of_zh_sr1': [0.021298108352499016, 0.00027960499893960115], 'sr_sf_all_cutbased': [1.94144427228296, 0.14721598636657388], 'sr_of_all_cutbased': [1.9041793274932521, 0.12941246526436212], 'sr_all_cutbased': [3.8456235997762125, 0.276628451630936], 'sr_sf_all_bdt': [1.2132446276001156, 0.10558485796570924], 'sr_of_all_bdt': [2.1773786486501634, 0.1506951156610023], 'sr_all_bdt': [3.390623276250279, 0.25627997362671157]}, '$S/\\sqrt{B}$': {'sr_4l_sf_A': [1.573403708829316, None], 'sr_4l_sf_B': [1.206902076774881, None], 'sr_4l_sf_C': [0.6291454631538784, None], 'sr_4l_of_1': [2.536488064796382, None], 'sr_4l_of_2': [1.7517108798896348, None], 'sr_4l_of_3': [1.3535666345294317, None], 'sr_4l_of_4': [2.1950499282717715, None], 'sr_sf_all_cutbased': [2.080393200260104, None], 'sr_of_all_cutbased': [4.019035895746074, None], 'sr_all_cutbased': [4.525559125564921, None], 'sr_4l_bdt_sf_wwz_sr1': [1.0757527324228051, None], 'sr_4l_bdt_sf_wwz_sr2': [2.0325510106063884, None], 'sr_4l_bdt_sf_wwz_sr3': [0.6283304190056143, None], 'sr_4l_bdt_sf_wwz_sr4': [0.7806662107873534, None], 'sr_4l_bdt_sf_zh_sr1': [2.015016432983087, None], 'sr_4l_bdt_sf_zh_sr2': [1.2950251900355532, None], 'sr_4l_bdt_of_wwz_sr1': [1.8042098974916552, None], 'sr_4l_bdt_of_wwz_sr2': [1.4028534331310891, None], 'sr_4l_bdt_of_wwz_sr3': [1.073197869312929, None], 'sr_4l_bdt_of_wwz_sr4': [1.5282119487358412, None], 'sr_4l_bdt_of_zh_sr1': [2.9973137853001006, None], 'sr_4l_bdt_of_zh_sr2': [2.9104123154613792, None], 'sr_4l_bdt_of_zh_sr3': [1.3250816446168878, None], 'sr_4l_bdt_of_zh_sr4': [0.649396431272683, None], 'sr_sf_all_bdt': [3.468447472308546, None], 'sr_of_all_bdt': [5.323748998534859, None], 'sr_all_bdt': [6.353930379502475, None]}, '$S/\\sqrt{S+B}$': {'sr_4l_sf_A': [1.134579438999716, None], 'sr_4l_sf_B': [0.9822163334368801, None], 'sr_4l_sf_C': [0.5333976768387408, None], 'sr_4l_of_1': [1.4232609752341938, None], 'sr_4l_of_2': [1.04238609826249, None], 'sr_4l_of_3': [0.9093364269383808, None], 'sr_4l_of_4': [1.5226515189827519, None], 'sr_sf_all_cutbased': [1.5926495253909643, None], 'sr_of_all_cutbased': [2.5015197315018383, None], 'sr_all_cutbased': [2.9654904278754795, None], 'sr_4l_bdt_sf_wwz_sr1': [0.749096790387717, None], 'sr_4l_bdt_sf_wwz_sr2': [1.407190123578576, None], 'sr_4l_bdt_sf_wwz_sr3': [0.503438194815083, None], 'sr_4l_bdt_sf_wwz_sr4': [0.4436723120478694, None], 'sr_4l_bdt_sf_zh_sr1': [1.3089809290945755, None], 'sr_4l_bdt_sf_zh_sr2': [0.6959862336903174, None], 'sr_4l_bdt_of_wwz_sr1': [1.037569167628566, None], 'sr_4l_bdt_of_wwz_sr2': [0.9423372629946764, None], 'sr_4l_bdt_of_wwz_sr3': [0.811612106766389, None], 'sr_4l_bdt_of_wwz_sr4': [1.0741596991646238, None], 'sr_4l_bdt_of_zh_sr1': [0.9980141115922105, None], 'sr_4l_bdt_of_zh_sr2': [1.3734291144620403, None], 'sr_4l_bdt_of_zh_sr3': [0.7932796297271857, None], 'sr_4l_bdt_of_zh_sr4': [0.47638786961875385, None], 'sr_sf_all_bdt': [2.2780371138246562, None], 'sr_of_all_bdt': [2.7414704519017006, None], 'sr_all_bdt': [3.564423281628135, None]}, 'Sig': {'sr_4l_sf_A': [2.6817208019582477, 9.981642418405275e-05], 'sr_4l_sf_B': [2.8570221200108747, 0.00011112130658243725], 'sr_4l_sf_C': [1.011734497112875, 3.3286367671989845e-05], 'sr_4l_of_1': [2.9565368815046407, 0.00011389589135916141], 'sr_4l_of_2': [1.6822690993876586, 6.0888695985342435e-05], 'sr_4l_of_3': [1.507073457893851, 4.5345894494651594e-05], 'sr_4l_of_4': [4.468776746464124, 0.00012665731949666176], 'sr_sf_all_cutbased': [6.550477419081997, 0.00024422409843847983], 'sr_of_all_cutbased': [10.614656185250276, 0.00034678780133581724], 'sr_all_cutbased': [17.165133604332272, 0.0005910118997742971], 'sr_4l_bdt_sf_wwz_sr1': [1.0893894555927748, 3.0027174895551054e-05], 'sr_4l_bdt_sf_wwz_sr2': [3.8030495985643213, 0.00011858987504361482], 'sr_4l_bdt_sf_wwz_sr3': [0.7079057632236956, 2.5856518681379633e-05], 'sr_4l_bdt_sf_wwz_sr4': [0.2907581293040592, 1.3048909812607796e-05], 'sr_4l_bdt_sf_zh_sr1': [2.9643986848990127, 0.00012113939280123024], 'sr_4l_bdt_sf_zh_sr2': [0.6811282817253927, 2.819755614800038e-05], 'sr_4l_bdt_of_wwz_sr1': [1.608518418791795, 4.6338818616670716e-05], 'sr_4l_bdt_of_wwz_sr2': [1.6181332481275787, 4.5200821041460535e-05], 'sr_4l_bdt_of_wwz_sr3': [1.5387744354815969, 4.297425361328007e-05], 'sr_4l_bdt_of_wwz_sr4': [2.280498233082584, 8.053693022280262e-05], 'sr_4l_bdt_of_zh_sr1': [1.1202306826475492, 3.59418507324169e-05], 'sr_4l_bdt_of_zh_sr2': [2.4267164296328003, 9.788914812622991e-05], 'sr_4l_bdt_of_zh_sr3': [0.9808167498868398, 4.442759113957864e-05], 'sr_4l_bdt_of_zh_sr4': [0.4913810459986938, 2.213112310219009e-05], 'sr_sf_all_bdt': [9.536629913309257, 0.00033685942738238394], 'sr_of_all_bdt': [12.065069243649438, 0.0004154405365946295], 'sr_all_bdt': [21.601699156958695, 0.0007522999639770133]}, 'Bkg': {'sr_4l_sf_A': [2.9050043196503323, 0.03493207689617573], 'sr_4l_sf_B': [5.603806575456273, 0.09722139888962286], 'sr_4l_sf_C': [2.586014635148091, 0.025069344044427604], 'sr_4l_of_1': [1.3586292357590164, 0.040523562574467285], 'sr_4l_of_2': [0.9222869861939845, 0.012050224535892806], 'sr_4l_of_3': [1.2396799054838832, 0.02596409384933028], 'sr_4l_of_4': [4.144656192624635, 0.06146806911876954], 'sr_sf_all_cutbased': [11.094825530254697, 0.15722281983022618], 'sr_of_all_cutbased': [7.665252320061519, 0.14000595007845992], 'sr_all_cutbased': [18.760077850316215, 0.29722876990868613], 'sr_4l_bdt_sf_wwz_sr1': [1.0255135875743169, 0.022594733223344467], 'sr_4l_bdt_sf_wwz_sr2': [3.500911007378179, 0.040501868114990916], 'sr_4l_bdt_sf_wwz_sr3': [1.2693305278482039, 0.006999286117586707], 'sr_4l_bdt_sf_wwz_sr4': [0.13871804745434088, 0.0005639720050283632], 'sr_4l_bdt_sf_zh_sr1': [2.1642929227609047, 0.04297552880745653], 'sr_4l_bdt_sf_zh_sr2': [0.27663134893937136, 0.0022948543730785995], 'sr_4l_bdt_of_wwz_sr1': [0.7948367788918822, 0.012595456772331476], 'sr_4l_bdt_of_wwz_sr2': [1.3304665629044685, 0.022232030011102525], 'sr_4l_bdt_of_wwz_sr3': [2.0558447797960966, 0.036409769022027784], 'sr_4l_bdt_of_wwz_sr4': [2.2268568406023723, 0.03764822132264195], 'sr_4l_bdt_of_zh_sr1': [0.1396852357347638, 0.0004536071290893721], 'sr_4l_bdt_of_zh_sr2': [0.6952308289856295, 0.021918739634287435], 'sr_4l_bdt_of_zh_sr3': [0.547886338759906, 0.010348366450253955], 'sr_4l_bdt_of_zh_sr4': [0.572554728414673, 0.019814914808386312], 'sr_sf_all_bdt': [8.375397441955316, 0.11593024264148559], 'sr_of_all_bdt': [8.363362094089792, 0.1614211051501208], 'sr_all_bdt': [16.73875953604511, 0.27735134779160636]}, 'Zmetric': {'sr_4l_sf_A': [1.3941054315112158, None], 'sr_4l_sf_B': [1.1214703347335815, None], 'sr_4l_sf_C': [0.5936463203266058, None], 'sr_4l_of_1': [2.015105967190229, None], 'sr_4l_of_2': [1.4294612189280724, None], 'sr_4l_of_3': [1.1646040222160488, None], 'sr_4l_of_4': [1.9141453826105042, None], 'sr_sf_all_cutbased': [1.885110505910421, None], 'sr_of_all_cutbased': [3.3353060593828436, None], 'sr_all_cutbased': [3.831175815497085, None], 'sr_4l_bdt_sf_wwz_sr1': [0.9395849941320298, None], 'sr_4l_bdt_sf_wwz_sr2': [1.7710086137460372, None], 'sr_4l_bdt_sf_wwz_sr3': [0.580389526721976, None], 'sr_4l_bdt_sf_wwz_sr4': [0.6238632945519789, None], 'sr_4l_bdt_sf_zh_sr1': [1.7090437165490364, None], 'sr_4l_bdt_sf_zh_sr2': [1.0082896653985574, None], 'sr_4l_bdt_of_wwz_sr1': [1.449659454352522, None], 'sr_4l_bdt_of_wwz_sr2': [1.2069504181550514, None], 'sr_4l_bdt_of_wwz_sr3': [0.9692506626108055, None], 'sr_4l_bdt_of_wwz_sr4': [1.3399443011107321, None], 'sr_4l_bdt_of_zh_sr1': [1.8170521942441855, None], 'sr_4l_bdt_of_zh_sr2': [2.1271339181089166, None], 'sr_4l_bdt_of_zh_sr3': [1.0842475856872784, None], 'sr_4l_bdt_of_zh_sr4': [0.5794082229944537, None], 'sr_sf_all_bdt': [2.946663767484141, None], 'sr_of_all_bdt': [3.9535836301573544, None], 'sr_all_bdt': [4.930887433236744, None]}} +# Ref with all current SFs applied (btag, lep, PU, prefire) Mar 02, 2024 +# feb27_baseline_withSFnoSys_withCBpresel.pkl.gz +EWK_REF = {'WWZ': {'sr_4l_sf_A': [1.8796742427699058, 5.0011966352230034e-05], 'sr_4l_sf_B': [1.596064584710653, 4.1913361034359516e-05], 'sr_4l_sf_C': [0.46329822942371474, 1.2478240476784822e-05], 'sr_4l_of_1': [0.5089704111430158, 1.2928098662250936e-05], 'sr_4l_of_2': [0.5863582014957153, 1.5105571655629712e-05], 'sr_4l_of_3': [1.1904609448245147, 3.094890749661624e-05], 'sr_4l_of_4': [4.221321537855876, 0.00011366124456835628], 'all_events': [150.97044577809945, 0.005508468309953707], '4l_presel': [22.942228933056704, 0.0006758208952004465], 'sr_4l_sf_incl': [4.086939376681597, 0.0001082900240082549], 'sr_4l_of_incl': [7.524496275892502, 0.0001990142032474757], 'cr_4l_btag_of': [2.6844044528430437, 0.00010151390499609684], 'cr_4l_btag_sf_offZ_met80': [1.352840130589533, 5.099584303344667e-05], 'cr_4l_sf': [0.8578601477161325, 2.251552161108323e-05], 'sr_sf_all_cutbased': [3.939037056904273, 0.00010440356786337436], 'sr_of_all_cutbased': [6.507111095319122, 0.00017264382238285316], 'sr_all_cutbased': [10.446148152223394, 0.0002770473902462275]}, 'ZH': {'sr_4l_sf_A': [0.729182685851617, 4.514358815906539e-05], 'sr_4l_sf_B': [1.1802983133547118, 6.439208199854825e-05], 'sr_4l_sf_C': [0.5238591034915036, 1.9353931412792887e-05], 'sr_4l_of_1': [2.3741376736563735, 9.673793250202969e-05], 'sr_4l_of_2': [1.0512964047749698, 4.274738875297518e-05], 'sr_4l_of_3': [0.27487046285644734, 1.2516520867463701e-05], 'sr_4l_of_4': [0.11932959533821874, 7.591287106296967e-06], 'all_events': [145.62539717282453, 0.01004702745166159], '4l_presel': [17.639006952903085, 0.000897724478318867], 'sr_4l_sf_incl': [2.585684086912913, 0.00013520743152816494], 'sr_4l_of_incl': [6.207629455186265, 0.0002664887798313454], 'cr_4l_btag_of': [1.8996142891682295, 0.00014267977972230728], 'cr_4l_btag_sf_offZ_met80': [0.686375081593778, 6.94158621939911e-05], 'cr_4l_sf': [0.055719411432755335, 2.139009834632954e-06], 'sr_sf_all_cutbased': [2.4333401026978323, 0.00012888960157040653], 'sr_of_all_cutbased': [3.8196341366260094, 0.00015959312922876555], 'sr_all_cutbased': [6.2529742393238426, 0.00028848273079917205]}, 'ZZ': {'sr_4l_sf_A': [0.9897744828273218, 0.0004867788096212909], 'sr_4l_sf_B': [3.3126167722389104, 0.0015901957641724686], 'sr_4l_sf_C': [1.971583247515798, 0.0009209113661524344], 'sr_4l_of_1': [0.4613732783213163, 0.00022237833938276952], 'sr_4l_of_2': [0.46108370261056303, 0.00022786268728842662], 'sr_4l_of_3': [0.2935959769568094, 0.00014762270992032994], 'sr_4l_of_4': [0.3891131801194942, 0.0002007563039401573], 'all_events': [22132.43491159535, 15.642873844819166], '4l_presel': [2691.1766010171436, 1.4391414532425766], 'sr_4l_sf_incl': [9.809160716833057, 0.00478333333872781], 'sr_4l_of_incl': [15.519336306919715, 0.007525034060702233], 'cr_4l_btag_of': [4.1592982373747365, 0.002939994893574839], 'cr_4l_btag_sf_offZ_met80': [2.7554293416441475, 0.0020865159266828443], 'cr_4l_sf': [1431.1449772069113, 0.698969642521474], 'sr_sf_all_cutbased': [6.27397450258203, 0.002997885939946194], 'sr_of_all_cutbased': [1.605166138008183, 0.0007986200405316834], 'sr_all_cutbased': [7.879140640590213, 0.003796505980477877]}, 'ttZ': {'sr_4l_sf_A': [0.9744323818401107, 0.002988213693670242], 'sr_4l_sf_B': [0.8260914480482815, 0.0024411443158970365], 'sr_4l_sf_C': [0.2117777372878653, 0.0006793733688719802], 'sr_4l_of_1': [0.2274315031538946, 0.0006141271088714311], 'sr_4l_of_2': [0.24264839413990152, 0.0006803625592641666], 'sr_4l_of_3': [0.6497391620795682, 0.0017203709264879009], 'sr_4l_of_4': [1.8370650087275844, 0.005608680086156667], 'all_events': [6584.347460577734, 36.5765832029854], '4l_presel': [139.51959476092196, 0.46530609600697137], 'sr_4l_sf_incl': [2.1481188650717815, 0.006441869102479813], 'sr_4l_of_incl': [3.3987615017713977, 0.009902575175096328], 'cr_4l_btag_of': [57.02843920704273, 0.19120787997139224], 'cr_4l_btag_sf_offZ_met80': [27.96411533276142, 0.09254164193739435], 'cr_4l_sf': [0.42989697675843075, 0.001306420936671004], 'sr_sf_all_cutbased': [2.012301567176258, 0.006108731378439258], 'sr_of_all_cutbased': [2.9568840681009485, 0.008623540680780166], 'sr_all_cutbased': [4.969185635277206, 0.014732272059219422]}, 'tWZ': {'sr_4l_sf_A': [0.40417646308070293, 8.703750596671525e-05], 'sr_4l_sf_B': [0.37410199380609116, 8.532189290243701e-05], 'sr_4l_sf_C': [0.0957249409079119, 2.258685361984745e-05], 'sr_4l_of_1': [0.11518523443695693, 2.4047369970902342e-05], 'sr_4l_of_2': [0.1296259288057434, 2.883456646287243e-05], 'sr_4l_of_3': [0.26653774477742836, 5.913066647446086e-05], 'sr_4l_of_4': [0.8301279967178373, 0.00019654830703977157], 'all_events': [192.49430732626087, 0.05881629917636074], '4l_presel': [23.97344544819388, 0.005715484631594204], 'sr_4l_sf_incl': [0.9235819068409694, 0.00020599139869891832], 'sr_4l_of_incl': [1.5294180689195565, 0.0003516027067161033], 'cr_4l_btag_of': [9.237700282558725, 0.0022026516549542774], 'cr_4l_btag_sf_offZ_met80': [4.255080503872744, 0.0010152383797496227], 'cr_4l_sf': [0.17782139062034538, 4.003134982851281e-05], 'sr_sf_all_cutbased': [0.874003397794706, 0.0001949462524889997], 'sr_of_all_cutbased': [1.341476904737966, 0.0003085609099480072], 'sr_all_cutbased': [2.215480302532672, 0.0005035071624370069]}, 'WZ': {'sr_4l_sf_A': [0.07096471161892892, 0.0031669096309620373], 'sr_4l_sf_B': [0.38406512417674726, 0.012442842468890386], 'sr_4l_sf_C': [0.16260528877019054, 0.004210805556691592], 'sr_4l_of_1': [0.3724353881761476, 0.0178115542873584], 'sr_4l_of_2': [0.10258944561447007, 0.0023701419327491835], 'sr_4l_of_3': [0.011818492291620748, 0.010013353958452284], 'sr_4l_of_4': [0.6973773005085421, 0.03337936876254605], 'all_events': [67206.13135117064, 4553.624485563815], '4l_presel': [8.859950688690056, 0.4746705553140165], 'sr_4l_sf_incl': [0.7129665173515559, 0.02258580279217667], 'sr_4l_of_incl': [1.6520052483661258, 0.0804926867847766], 'cr_4l_btag_of': [0.8860196415778555, 0.059575910521280286], 'cr_4l_btag_sf_offZ_met80': [0.11606954799352177, 0.010279649434932512], 'cr_4l_sf': [0.14670822278034434, 0.009247351563810902], 'sr_sf_all_cutbased': [0.6176351245658667, 0.019820557656544016], 'sr_of_all_cutbased': [1.1842206265907804, 0.06357441894110591], 'sr_all_cutbased': [1.8018557511566469, 0.08339497659764994]}, 'other': {'sr_4l_sf_A': [0.4993868268217272, 0.027154017210982366], 'sr_4l_sf_B': [0.6033849836294176, 0.07499426824703304], 'sr_4l_sf_C': [0.09591669267138649, 0.02215997619394746], 'sr_4l_of_1': [0.1393089487979516, 0.019281127575627503], 'sr_4l_of_2': [-0.006085849094745107, 0.007863615554409087], 'sr_4l_of_3': [0.05654106816261955, 0.011564137349614385], 'sr_4l_of_4': [0.4417725773375794, 0.019546908278451205], 'all_events': [2747882.281747165, 5947477.843846047], '4l_presel': [37.71068049919267, 3.5641995992582793], 'sr_4l_sf_incl': [1.2401878850076171, 0.12465785077497647], 'sr_4l_of_incl': [1.4477455619548447, 0.12790510023309565], 'cr_4l_btag_of': [2.494962082595951, 0.06885015229405128], 'cr_4l_btag_sf_offZ_met80': [1.5760296544906491, 0.052401971126985615], 'cr_4l_sf': [9.464967629072424, 0.37356337925725397], 'sr_sf_all_cutbased': [1.1986885031225314, 0.12430826165196288], 'sr_of_all_cutbased': [0.6315367452034055, 0.05825578875810218], 'sr_all_cutbased': [1.8302252483259367, 0.18256405041006507]}, '$S/\\sqrt{B}$': {'sr_4l_sf_A': [1.5218437321425393, None], 'sr_4l_sf_B': [1.1838171020186103, None], 'sr_4l_sf_C': [0.6196894699730852, None], 'sr_4l_of_1': [2.5134880048170003, None], 'sr_4l_of_2': [1.6982950716613776, None], 'sr_4l_of_3': [1.2960774065043659, None], 'sr_4l_of_4': [2.119167541718631, None], 'sr_sf_all_cutbased': [2.025202783745074, None], 'sr_of_all_cutbased': [3.9207800007540765, None], 'sr_all_cutbased': [4.412931240071834, None]}, '$S/\\sqrt{S+B}$': {'sr_4l_sf_A': [1.1076384270013098, None], 'sr_4l_sf_B': [0.9650496099402631, None], 'sr_4l_sf_C': [0.5258008422662838, None], 'sr_4l_of_1': [1.4070066010959612, None], 'sr_4l_of_2': [1.022034867751365, None], 'sr_4l_of_3': [0.8846639338623044, None], 'sr_4l_of_4': [1.4856788881128868, None], 'sr_sf_all_cutbased': [1.5603365535498177, None], 'sr_of_all_cutbased': [2.452365160592572, None], 'sr_all_cutbased': [2.906672503264163, None]}, 'Sig': {'sr_4l_sf_A': [2.608856928621523, 9.515555451129542e-05], 'sr_4l_sf_B': [2.776362898065365, 0.00010630544303290777], 'sr_4l_sf_C': [0.9871573329152183, 3.183217188957771e-05], 'sr_4l_of_1': [2.8831080847993893, 0.00010966603116428062], 'sr_4l_of_2': [1.6376546062706852, 5.785296040860489e-05], 'sr_4l_of_3': [1.465331407680962, 4.3465428364079944e-05], 'sr_4l_of_4': [4.340651133194095, 0.00012125253167465325], 'sr_sf_all_cutbased': [6.372377159602106, 0.00023329316943378092], 'sr_of_all_cutbased': [10.326745231945132, 0.0003322369516116187], 'sr_all_cutbased': [16.699122391547235, 0.0005655301210453997]}, 'Bkg': {'sr_4l_sf_A': [2.938734866188791, 0.03388295685120265], 'sr_4l_sf_B': [5.500260321899448, 0.09155377268889536], 'sr_4l_sf_C': [2.5376079071531517, 0.027993653339283314], 'sr_4l_of_1': [1.315734352886267, 0.03795323468121101], 'sr_4l_of_2': [0.9298616220759329, 0.011170817300173736], 'sr_4l_of_3': [1.2782324442680462, 0.02350461561094936], 'sr_4l_of_4': [4.195456063411037, 0.058932261738133845], 'sr_sf_all_cutbased': [10.97660309524139, 0.15343038287938132], 'sr_of_all_cutbased': [7.719284482641283, 0.13156092933046795], 'sr_all_cutbased': [18.695887577882672, 0.2849913122098493]}, 'Zmetric': {'sr_4l_sf_A': [1.3535126937574338, None], 'sr_4l_sf_B': [1.1007210618985692, None], 'sr_4l_sf_C': [0.5848969322063289, None], 'sr_4l_of_1': [1.9946363806225782, None], 'sr_4l_of_2': [1.3928855127238835, None], 'sr_4l_of_3': [1.122627723636731, None], 'sr_4l_of_4': [1.8561096981857161, None], 'sr_sf_all_cutbased': [1.8400238828814135, None], 'sr_of_all_cutbased': [3.2594693678628235, None], 'sr_all_cutbased': [3.7429705381701934, None]}} SOVERROOTB = "$S/\sqrt{B}$" SOVERROOTSPLUSB = "$S/\sqrt{S+B}$" -# Keegan's yields as of Aug 18, 2023 -KEEGAN_YIELDS = { - "WWZ" : { - "sr_4l_sf_A": 2.33, - "sr_4l_sf_B": 1.97, - "sr_4l_sf_C": 0.572, - "sr_4l_of_1": 0.645, - "sr_4l_of_2": 0.738, - "sr_4l_of_3": 1.48, - "sr_4l_of_4": 5.14, - }, - "ZH" : { - "sr_4l_sf_A": 0.952, - "sr_4l_sf_B": 1.52, - "sr_4l_sf_C": 0.677, - "sr_4l_of_1": 3.05, - "sr_4l_of_2": 1.35, - "sr_4l_of_3": 0.348, - "sr_4l_of_4": 0.152, - }, - "ttZ" : { - "sr_4l_sf_A": 1.32*(0.281/0.2529), - "sr_4l_sf_B": 1.12*(0.281/0.2529), - "sr_4l_sf_C": 0.269*(0.281/0.2529), - "sr_4l_of_1": 0.322*(0.281/0.2529), - "sr_4l_of_2": 0.382*(0.281/0.2529), - "sr_4l_of_3": 0.833*(0.281/0.2529), - "sr_4l_of_4": 2.51*(0.281/0.2529), - }, - "ZZ": { - "sr_4l_sf_A": 1.32, - "sr_4l_sf_B": 4.58, - "sr_4l_sf_C": 2.78, - "sr_4l_of_1": 0.623, - "sr_4l_of_2": 0.619, - "sr_4l_of_3": 0.39, - "sr_4l_of_4": 0.503, - }, - "other": { - "sr_4l_sf_A": 0.607 + 0.00855, - "sr_4l_sf_B": 0.417 + 0.0571, - "sr_4l_sf_C": 0.0967 + 0.0106, - "sr_4l_of_1": 0.27 + 0.107 + 0.0069, - "sr_4l_of_2": -0.055 + 0.0 + 0.0106, - "sr_4l_of_3": -0.0555 + 0.176 + 0.0446, - "sr_4l_of_4": 0.452 + 0.12 + 0.0233, - }, -} - -_SAMPLE_DICT_BASE = { - "ZZ" : ['ZZTo4L_central'], - "ttZ" : ['ttllJet_private'], #['ttZ_central'], - "tWZ" : ['TWZToLL_central'], -} -_SAMPLE_DICT_BASE = { - "ZZ" : ["ZZTo4l", "ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau"], - "ttZ" : ["TTZToLLNuNu_M_10"], - "tWZ" : ["tWll"], -} - -SAMPLE_DICT_BASE = { - "WWZ" : ["WWZJetsTo4L2Nu"], - "ZH" : ["GluGluZH","qqToZHToZTo2L"], - - #"qqZZ": ["ZZTo4l"], - #"ggZZ": ["ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau"], - "ZZ" : ["ZZTo4l", "ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau"], - - "ttZ" : [ - "TTZToLL_M_1to10", - "TTZToLLNuNu_M_10", - "TTZToQQ", - ], - - "tWZ" : ["tWll"], - - "other" : [ - - ##"WWZJetsTo4L2Nu", - ##"GluGluZH","qqToZHToZTo2L", - ##"ZZTo4l", "ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau", - ##"TTZToLL_M_1to10","TTZToLLNuNu_M_10","TTZToQQ", - ##"tWll", - - ##"DYJetsToLL_M_10to50_MLM", - "DYJetsToLL_M_50_MLM", - "SSWW", - "ST_antitop_t-channel", - "ST_top_s-channel", - "ST_top_t-channel", - "tbarW_noFullHad", - "ttHnobb", - "TTTo2L2Nu", - "TTWJetsToLNu", - "TTWJetsToQQ", - "tW_noFullHad", - "tZq", - "VHnobb", - ##"WJetsToLNu", - "WWTo2L2Nu", - "WZTo3LNu", - - "WWW", - "WZZ", - "ZZZ", - ], -} - -# Processes indiviudally -SAMPLE_DICT_BASE_INDIV = { - "WWZJetsTo4L2Nu": ["WWZJetsTo4L2Nu"], - "GluGluZH": ["GluGluZH"], - "qqToZHToZTo2L": ["qqToZHToZTo2L"], - "ZZTo4l": ["ZZTo4l"], - "ggToZZTo2e2mu": ["ggToZZTo2e2mu"], - "ggToZZTo2e2tau": ["ggToZZTo2e2tau"], - "ggToZZTo2mu2tau": ["ggToZZTo2mu2tau"], - "ggToZZTo4e": ["ggToZZTo4e"], - "ggToZZTo4mu": ["ggToZZTo4mu"], - "ggToZZTo4tau": ["ggToZZTo4tau"], - "TTZToLL_M_1to10": ["TTZToLL_M_1to10"], - "TTZToLLNuNu_M_10": ["TTZToLLNuNu_M_10"], - "TTZToQQ": ["TTZToQQ"], - "tWll" : ["tWll"], - - ##"DYJetsToLL_M_10to50_MLM": ["DYJetsToLL_M_10to50_MLM"], - "DYJetsToLL_M_50_MLM": ["DYJetsToLL_M_50_MLM"], - "SSWW": ["SSWW"], - "ST_antitop_t-channel": ["ST_antitop_t-channel"], - "ST_top_s-channel": ["ST_top_s-channel"], - "ST_top_t-channel": ["ST_top_t-channel"], - "tbarW_noFullHad": ["tbarW_noFullHad"], - "ttHnobb": ["ttHnobb"], - "TTTo2L2Nu": ["TTTo2L2Nu"], - "TTWJetsToLNu": ["TTWJetsToLNu"], - "TTWJetsToQQ": ["TTWJetsToQQ"], - "tW_noFullHad": ["tW_noFullHad"], - "tZq": ["tZq"], - "VHnobb": ["VHnobb"], - ##"WJetsToLNu": ["WJetsToLNu"], - "WWTo2L2Nu": ["WWTo2L2Nu"], - "WZTo3LNu": ["WZTo3LNu"], - - "WWW" : ["WWW"], - "WZZ" : ["WZZ"], - "ZZZ" : ["ZZZ"], -} - - - -# Pass dictionary with the base names for the samples, and return with full list for 4 years -def create_mc_sample_dict(in_dict,year): - out_dict = {} - if year == "all": - years = ["UL16APV","UL16","UL17","UL18"] - else: - years = [year] - for proc_group in in_dict.keys(): - out_dict[proc_group] = [] - for proc_base_name in in_dict[proc_group]: - for year_str in years: - out_dict[proc_group].append(f"{year_str}_{proc_base_name}") - #out_dict[proc_group].append(f"{proc_base_name}{year_str}") # TOP22006 format - return out_dict - -# Get data sampel dict -def create_data_sample_dict(year): - if year == "all": - grouping_data = {'data': ["UL16APV_data","UL16_data","UL17_data","UL18_data"]} - #grouping_data = {'data': ["dataUL16APV","dataUL16","dataUL17","dataUL18"]} # TOP22006 format - else: - grouping_data = {'data': [f"{year}_data"]} - #grouping_data = {'data': [f"data{year}"]} # TOP22006 format - return grouping_data - - ################### Getting and printing yields ################### # Get the yields in the SR -def get_yields(histos_dict,sample_dict,raw_counts=False,quiet=False,blind=True): +def get_yields(histos_dict,sample_dict,raw_counts=False,quiet=True,blind=True,systematic_name="nominal"): yld_dict = {} @@ -268,12 +92,13 @@ def get_yields(histos_dict,sample_dict,raw_counts=False,quiet=False,blind=True): for proc_name in sample_dict.keys(): yld_dict[proc_name] = {} for cat_name in histos_dict[dense_axis].axes["category"]: + #if "bdt" in cat_name: continue # TMP!!! if blind and (("data" in proc_name) and (not cat_name.startswith("cr_"))): # If this is data and we're not in a CR category, put placeholder numbers for now yld_dict[proc_name][cat_name] = [-999,-999] else: - val = sum(sum(histos_dict[dense_axis][{"category":cat_name,"process":sample_dict[proc_name],"systematic":"nominal"}].values(flow=True))) - var = sum(sum(histos_dict[dense_axis][{"category":cat_name,"process":sample_dict[proc_name],"systematic":"nominal"}].variances(flow=True))) + val = sum(sum(histos_dict[dense_axis][{"category":cat_name,"process":sample_dict[proc_name],"systematic":systematic_name}].values(flow=True))) + var = sum(sum(histos_dict[dense_axis][{"category":cat_name,"process":sample_dict[proc_name],"systematic":systematic_name}].variances(flow=True))) yld_dict[proc_name][cat_name] = [val,var] # Print to screen @@ -289,9 +114,7 @@ def get_yields(histos_dict,sample_dict,raw_counts=False,quiet=False,blind=True): # Gets the process sums for S and B and gets metrics e.g. S/sqrt(B) and puts it into the dict # Hard coded for the summed values (e.g. looking for "ZH" not "GluGluZH","qqToZHToZTo2L") -def put_proc_row_sums(yld_dict,sr_cat_lst): - sig_lst = ["WWZ","ZH"] - bkg_lst = ["ZZ","ttZ","tWZ","other"] +def put_proc_row_sums(yld_dict,sr_cat_lst, sig_lst=sg.SIG_LST,bkg_lst=sg.BKG_LST): # Build up the empty dicts for sig and bkg that we can later fill and then put into the yld dict # Will look something like this: {"sr_4l_sf_A":[0,0], "sr_4l_sf_B":[0,0], "sr_4l_sf_C":[0,0], "sr_4l_of_1":[0,0], "sr_4l_of_2":[0,0], "sr_4l_of_3":[0,0], "sr_4l_of_4":[0,0]} sig_sum = {} @@ -331,6 +154,7 @@ def put_proc_row_sums(yld_dict,sr_cat_lst): yld_dict["Sig"][cat] = [s, s_var] yld_dict["Bkg"][cat] = [b, b_var] + # Gets the sums of categoreis (assumed to be columns in the input dict) and puts them into the dict # Special handling for rows that are metrics (e.g. s/sqrt(b)), sums these in quadrature def put_cat_col_sums(yld_dict,sr_sf_lst,sr_of_lst,metrics_names_lst=["Zmetric",SOVERROOTB,SOVERROOTSPLUSB],tag=""): @@ -411,19 +235,18 @@ def get_err_from_var(in_dict): subkey_order=cats_to_print, print_begin_info=True, print_end_info=True, - print_errs=False, # If you want to turn this on, figure out where/when you want to sqrt the var + print_errs=True, column_variable="subkeys", + size="tiny", + hz_line_lst=[6], ) #exit() ### Compare with other yields, print comparison ### - #tag1 = "ewkcoffea" - #tag2 = "VVVNanoLooper" - tag1 = "lepTightSF btagSFtopeft" - tag2 = "lepTightSF " # Hard coded ref + tag1 = "New" + tag2 = "Ref" - #yld_dict_comp = utils.put_none_errs(KEEGAN_YIELDS) yld_dict_comp = get_err_from_var(EWK_REF) yld_dict_1 = copy.deepcopy(yld_dict) @@ -587,15 +410,9 @@ def make_cr_fig(histo_mc,histo_data=None,title="test",unit_norm_bool=False): # Plots a hist -def make_single_fig(histo_mc,title,unit_norm_bool=False): +def make_single_fig(histo_mc,ax_to_overlay="process",err_p=None,err_m=None,ylims=None,unit_norm_bool=False,title=None): #print("\nPlotting values:",histo.values()) - fig, ax = plt.subplots(1, 1, figsize=(7,7)) - - # Guard against accidently looking at data before unblind - proc_lst = get_axis_cats(histo_mc,"process_grp") - for proc_name in proc_lst: - if "data" in proc_name: - raise Exception(f"CAUTION: Are you sure you want to look at this data in {proc_name}?") + fig, ax = plt.subplots(1, 1, figsize=(12,7)) # Plot the mc histo_mc.plot1d( @@ -603,10 +420,22 @@ def make_single_fig(histo_mc,title,unit_norm_bool=False): histtype="fill", color=CLR_LST, yerr=True, + overlay=ax_to_overlay ) - plt.title(title) - ax.autoscale(axis='y') + # Set title and y lims + if title is not None: plt.title(title) + if ylims is None: + ax.autoscale(axis='y') + else: + ax.set_ylim(ylims) + + # Draw errors + if (err_p is not None) and (err_m is not None): + bin_edges_arr = histo_mc.axes[0].edges + bin_centers_arr = histo_mc.axes[0].centers + ax.fill_between(bin_edges_arr,err_m,err_p, step='post', facecolor='none', edgecolor='gray', alpha=0.5, linewidth=0.0, label='MC stat', hatch='/////') + plt.legend() return fig @@ -668,11 +497,18 @@ def make_syst_plots(histo_dict,grouping_mc,grouping_data,save_dir_path,year): histo = histo_dict[var_name] cat_lst = [ - "cr_4l_sf", - "cr_4l_btag_sf_offZ_met80", - "cr_4l_btag_of", - "sr_4l_of_presel", - "sr_4l_sf_presel", + "sr_4l_sf_A", + "sr_4l_sf_B", + "sr_4l_sf_C", + "sr_4l_of_1", + "sr_4l_of_2", + "sr_4l_of_3", + "sr_4l_of_4", + #"cr_4l_sf", + #"cr_4l_btag_sf_offZ_met80", + #"cr_4l_btag_of", + #"sr_4l_of_incl", + #"sr_4l_sf_incl", ] # Rebin if continous variable @@ -690,6 +526,7 @@ def make_syst_plots(histo_dict,grouping_mc,grouping_data,save_dir_path,year): syst_var_lst.append(syst_name_base) for cat in cat_lst: + print("\n",cat) if "cr_4l_of" not in cat and var_name == "j0pt": continue histo_cat = histo[{"category":cat}] histo_grouped_mc = group(histo_cat,"process","process_grp",grouping_mc) @@ -699,7 +536,13 @@ def make_syst_plots(histo_dict,grouping_mc,grouping_data,save_dir_path,year): data_nom = merge_overflow(histo_grouped_data[{"systematic":"nominal"}]) for syst in syst_var_lst: + #if "btag" not in syst: continue + #if "uncorrelated" not in syst: continue #if "lepSF" not in syst: continue + #if "PreFiring" not in syst: continue + #if "PU" not in syst: continue + #if "ISR" not in syst and "FSR" not in syst: continue + if "renorm" not in syst and "fact" not in syst: continue # Skip the variations that don't apply (TODO: why are these in the hist to begin with??) if year == "UL16APV": blacklist_years = ["2016","2017","2018"] @@ -724,13 +567,22 @@ def make_syst_plots(histo_dict,grouping_mc,grouping_data,save_dir_path,year): mc_up_arr = mc_up[{"process_grp":sum}].values() mc_down_arr = mc_down[{"process_grp":sum}].values() + # Print individual syst numbers #if var_name != "nleps": continue #n = sum(sum(mc_nom.values())) #u = sum(mc_up_arr) + #d = sum(mc_down_arr) #print("\n",syst) #print("nom",n) #print("up",u) - #print("err",abs(n-u)/n) + #print("do",d) + #r_up = abs((n-u)/n) + #r_do = abs((n-d)/n) + #r = (r_up+r_do)/2 + #print("err",np.round(100*abs(n-u)/n,1),"%") + #print("err up",np.round(100*r_up,1),"%") + #print("err do",np.round(100*r_do,1),"%") + #print("err do",np.round(100*r,1),"%") #continue fig = make_syst_fig(mc_nom,mc_up_arr,mc_down_arr,syst,title=f"{var_name}_{yeartag}_{cat}_{syst}") @@ -742,11 +594,59 @@ def make_syst_plots(histo_dict,grouping_mc,grouping_data,save_dir_path,year): make_html(os.path.join(os.getcwd(),out_path_for_this_cat)) +# A function for making a summary plot of SR yields +def make_sr_comb_plot(histo_dict,grouping_mc,grouping_data): + + # Declare the hist we'll be filling + sr_lst = ["sr_4l_sf_A","sr_4l_sf_B","sr_4l_sf_C" , "sr_4l_of_1","sr_4l_of_2","sr_4l_of_3","sr_4l_of_4"] + proc_lst = ["WWZ", "ZH", "ZZ", "ttZ", "tWZ", "WZ", "other"] + histo_comb = hist.Hist( + hist.axis.StrCategory(proc_lst, name="process", label="process"), + hist.axis.StrCategory(sr_lst, name="cat", label="Cut-based SRs"), + ) + + # Get the yield dict + year = "all" + histo = histo_dict["njets"] + sample_names_dict_mc = sg.create_mc_sample_dict(sg.SAMPLE_DICT_BASE,"all") + sample_names_dict_data = sg.create_data_sample_dict(year) + yld_dict_mc = yt.get_yields(histo,sample_names_dict_mc) + yld_dict_data = yt.get_yields(histo,sample_names_dict_data) + + # Apply the data-driven normalization for ZZ, ttZ + yld_dict_mc, _, _ = yt.do_tf(yld_dict_mc,yld_dict_data,None,sg.BKG_TF_MAP,quiet=False) + + # Get the values and fill the combined hist + histo = histo_dict["nleps"][{"systematic":"nominal"}] + err_lst_p = [] + err_lst_m = [] + for cat_name in sr_lst: + val_sum = 0 + var_sum = 0 + # Loop over processes, get yields to fill hist with (along with summing errs) + for proc_name in proc_lst: + val = yld_dict_mc[cat_name]["nominal"][proc_name][0] + histo_comb[{"process": proc_name, "cat": cat_name}] = val + # Sum the variances so we can have stat uncertainty (also need sum of nom) + var_sum += yld_dict_mc[cat_name]["nominal"][proc_name][1] + val_sum += val + err_lst_p.append(val_sum + np.sqrt(var_sum)) + err_lst_m.append(val_sum - np.sqrt(var_sum)) + + # Append a 0 err for overflow bin + err_lst_p.append(0) + err_lst_m.append(0) + + # Make plot + fig = make_single_fig(histo_comb,err_p=err_lst_p,err_m=err_lst_m,ylims=[0,9]) + fig.savefig("sr_comb_plot.png") + + # Main function for making CR plots def make_plots(histo_dict,grouping_mc,grouping_data,save_dir_path): for var_name in histo_dict.keys(): - print(f"\n{var_name}") + #print(f"\n{var_name}") if "counts" in var_name: continue #if var_name != "njets": continue # TMP if var_name == "nbtagsm": continue # TMP @@ -765,12 +665,14 @@ def make_plots(histo_dict,grouping_mc,grouping_data,save_dir_path): #grouping_sr_procs = {"sr_4l_sf":["sr_4l_sf_A","sr_4l_sf_B","sr_4l_sf_C"],"sr_4l_of":["sr_4l_of_1","sr_4l_of_2","sr_4l_of_3","sr_4l_of_4"]} #histo = group(histo,"category","category",grouping_sr_procs) + # Loop over categories and make plots for each for cat_name in histo.axes["category"]: #if cat_name not in ["cr_4l_sf","cr_4l_btag_of"]: continue # TMP - if "cr" not in cat_name: continue # TMP - #if cat_name not in ["cr_4l_sf","cr_4l_btag_of","sr_4l_of_presel","sr_4l_sf_presel"]: continue # TMP - print(cat_name) + #if "cr" not in cat_name: continue # TMP + #if "bdt" in cat_name: continue # TMP + if cat_name not in ["cr_4l_sf","sr_4l_of_incl","sr_4l_sf_incl","sr_4l_bdt_sf_presel","sr_4l_bdt_sf_trn","sr_4l_bdt_of_presel"]: continue # TMP + #print(cat_name) histo_cat = histo[{"category":cat_name}] @@ -778,8 +680,7 @@ def make_plots(histo_dict,grouping_mc,grouping_data,save_dir_path): histo_grouped_mc = group(histo_cat,"process","process_grp",grouping_mc) histo_grouped_data = group(histo_cat,"process","process_grp",grouping_data) - ####### - ###if (cat_name == "cr_4l_sf" or cat_name == "cr_4l_btag_of") and var_name == "nleps": + ###### #if (cat_name == "cr_4l_btag_sf_offZ_met80") and var_name == "nleps": #if ("met80" in cat_name and ("ee" in cat_name or "mm" in cat_name)) and var_name == "nleps": #if ("ee" in cat_name or "mm" in cat_name) or ("cutflow" in cat_name and var_name == "nleps"): @@ -794,12 +695,14 @@ def make_plots(histo_dict,grouping_mc,grouping_data,save_dir_path): # #print("var mc\n",(histo_grouped_mc.variances(flow=True))) # #print("var data\n",(histo_grouped_data.variances(flow=True))) #continue - #print("\Yields") - #print(type(histo_cat.values(flow=True))) - #print(sum(histo_cat.values(flow=True))) - #print(sum(sum(histo_cat.values(flow=True)))) + #if (cat_name == "cr_4l_sf" or cat_name == "cr_4l_btag_of" or cat_name=="cr_4l_btag_sf_offZ_met80") and var_name == "nleps": + # print(f"\n{cat_name} {var_name}:") + # print("Yields") + # print("mc:",sum(sum(histo_grouped_mc.values(flow=True)))) + # print("data:",sum(sum(histo_grouped_data.values(flow=True)))) + # print("data/mc:",sum(sum(histo_grouped_data.values(flow=True))) / sum(sum(histo_grouped_mc.values(flow=True))) ) #continue - ###### + ##### # Merge overflow into last bin (so it shows up in the plot) histo_grouped_data = merge_overflow(histo_grouped_data) @@ -822,7 +725,38 @@ def make_plots(histo_dict,grouping_mc,grouping_data,save_dir_path): +###### Transfer factors for background ###### + +# TODO move to same function as used in datacard maker +# Function for getting a dict with NSF and TF etc +def get_background_dict(yld_dict_mc,yld_dict_data,bkg_proc,cr_name,sr_name): + + # Get the sum of all other contributions + bkg_all_but_bkg_of_interest = [0,0] + for proc in yld_dict_mc.keys(): + if proc != bkg_proc: + bkg_all_but_bkg_of_interest[0] += yld_dict_mc[proc][cr_name][0] + bkg_all_but_bkg_of_interest[1] += yld_dict_mc[proc][cr_name][1] + + n_cr = yld_dict_data["data"][cr_name][0] - bkg_all_but_bkg_of_interest[0] + m_cr = yld_dict_mc[bkg_proc][cr_name][0] + m_sr = yld_dict_mc[bkg_proc][sr_name][0] + + n_cr_err = np.sqrt(yld_dict_data["data"][cr_name][1] + bkg_all_but_bkg_of_interest[1]) + m_cr_err = np.sqrt(yld_dict_mc[bkg_proc][cr_name][1]) + m_sr_err = np.sqrt(yld_dict_mc[bkg_proc][sr_name][1]) + out_dict = { + "n_sr_est" : [n_cr*(m_sr/m_cr) , (n_cr*(m_sr/m_cr))*np.sqrt((n_cr_err/n_cr)**2 + (m_sr_err/m_sr)**2 + (m_cr_err/m_cr)**2)], + "m_sr" : [m_sr , m_sr_err], + "n_cr" : [n_cr , n_cr_err], + "m_cr" : [m_cr , m_cr_err], + "tf" : [m_sr/m_cr , (m_sr/m_cr)*np.sqrt((m_sr_err/m_sr)**2+(m_cr_err/m_cr)**2)], + "nsf" : [n_cr/m_cr , (n_cr/m_cr)*np.sqrt((n_cr_err/n_cr)**2+(m_cr_err/m_cr)**2)], + } + return out_dict + +# TODO move to same function as used in datacard maker # Wrapper around the background estimation of TFs and yields def do_background_estimation(yld_dict_mc,yld_dict_data): @@ -836,33 +770,6 @@ def do_background_estimation(yld_dict_mc,yld_dict_data): "nsf" : "NSF", } - # Function for getting a dict with NSF and TF etc - def get_background_dict(yld_dict_mc,yld_dict_data,bkg_proc,cr_name,sr_name): - - # Get the sum of all other contributions - bkg_all_but_bkg_of_interest = [0,0] - for proc in yld_dict_mc.keys(): - if proc != bkg_proc: - bkg_all_but_bkg_of_interest[0] += yld_dict_mc[proc][cr_name][0] - bkg_all_but_bkg_of_interest[1] += yld_dict_mc[proc][cr_name][1] - - n_cr = yld_dict_data["data"][cr_name][0] - bkg_all_but_bkg_of_interest[0] - m_cr = yld_dict_mc[bkg_proc][cr_name][0] - m_sr = yld_dict_mc[bkg_proc][sr_name][0] - - n_cr_err = np.sqrt(yld_dict_data["data"][cr_name][1] + bkg_all_but_bkg_of_interest[1]) - m_cr_err = np.sqrt(yld_dict_mc[bkg_proc][cr_name][1]) - m_sr_err = np.sqrt(yld_dict_mc[bkg_proc][sr_name][1]) - - out_dict = { - "n_sr_est" : [n_cr*(m_sr/m_cr) , (n_cr*(m_sr/m_cr))*np.sqrt((n_cr_err/n_cr)**2 + (m_sr_err/m_sr)**2 + (m_cr_err/m_cr)**2)], - "m_sr" : [m_sr , m_sr_err], - "n_cr" : [n_cr , n_cr_err], - "m_cr" : [m_cr , m_cr_err], - "tf" : [m_sr/m_cr , (m_sr/m_cr)*np.sqrt((m_sr_err/m_sr)**2+(m_cr_err/m_cr)**2)], - "nsf" : [n_cr/m_cr , (n_cr/m_cr)*np.sqrt((n_cr_err/n_cr)**2+(m_cr_err/m_cr)**2)], - } - return out_dict print_dict = {} @@ -918,8 +825,8 @@ def main(): # Get the counts from the input hiso histo_dict = pickle.load(gzip.open(args.pkl_file_path)) - sample_dict_mc = create_mc_sample_dict(SAMPLE_DICT_BASE,args.ul_year) - sample_dict_data = create_data_sample_dict(args.ul_year) + sample_dict_mc = sg.create_mc_sample_dict(SAMPLE_DICT_BASE,args.ul_year) + sample_dict_data = sg.create_data_sample_dict(args.ul_year) out_path = "plots" # Could make this an argument @@ -930,6 +837,7 @@ def main(): # Wrapper around the code for getting the TFs and background estimation factors + # TODO move to same function as used in datacard maker if args.get_backgrounds: yld_dict_data = get_yields(histo_dict,sample_dict_data,quiet=True,blind=True) yld_dict_mc = get_yields(histo_dict,sample_dict_mc,quiet=True) @@ -952,13 +860,14 @@ def main(): # Dump latex table for cut based hlines = [2,3,7,8] sr_cats_to_print = SR_SF_CB + ["sr_sf_all_cutbased"] + SR_OF_CB + ["sr_of_all_cutbased","sr_all_cutbased"] - procs_to_print = ["WWZ","ZH","Sig","ZZ","ttZ","tWZ","other","Bkg",SOVERROOTB,SOVERROOTSPLUSB,"Zmetric"] + #sr_cats_to_print = ["sr_sf_all_cutbased" , "sr_of_all_cutbased" , "sr_all_cutbased" , "sr_4l_sf_presel" , "sr_4l_sf_trn" , "sr_4l_of_presel"] # Preselection SR categories + procs_to_print = ["WWZ","ZH","Sig","ZZ","ttZ","tWZ","WZ","other","Bkg",SOVERROOTB,SOVERROOTSPLUSB,"Zmetric"] print_yields(yld_dict,sr_cats_to_print,procs_to_print,hlines=hlines) # Dump latex table for BDT #hlines = [6,7,15,16] #sr_cats_to_print = SR_SF_BDT + ["sr_sf_all_bdt"] + SR_OF_BDT + ["sr_of_all_bdt","sr_all_bdt"] - #procs_to_print = ["WWZ","ZH","Sig","ZZ","ttZ","tWZ","other","Bkg",SOVERROOTB,SOVERROOTSPLUSB,"Zmetric"] + #procs_to_print = ["WWZ","ZH","Sig","ZZ","ttZ","tWZ","WZ","other","Bkg",SOVERROOTB,SOVERROOTSPLUSB,"Zmetric"] #print_yields(yld_dict,sr_cats_to_print,procs_to_print,hlines=hlines) # Dump yield dict to json @@ -972,6 +881,7 @@ def main(): if args.make_plots: make_plots(histo_dict,sample_dict_mc,sample_dict_data,save_dir_path=out_path) #make_syst_plots(histo_dict,sample_dict_mc,sample_dict_data,out_path,args.ul_year) # Check on individual systematics + #make_sr_comb_plot(histo_dict,sample_dict_mc,sample_dict_data) # Make plot of all SR yields in one plot diff --git a/analysis/wwz/make_datacards.py b/analysis/wwz/make_datacards.py index 72bcaa37..3a4d2822 100644 --- a/analysis/wwz/make_datacards.py +++ b/analysis/wwz/make_datacards.py @@ -1,29 +1,38 @@ +import numpy as np import os +import copy import json import pickle import gzip import argparse -from get_wwz_yields import get_yields # Note the fact that we're using this function means it probably belongs in ewkcoffea/ewkcoffea/modules +from topcoffea.modules import utils +from ewkcoffea.modules.paths import ewkcoffea_path +import ewkcoffea.modules.sample_groupings as sg +import ewkcoffea.modules.yield_tools as yt +SMALL = 0.000001 # Global variables PRECISION = 6 # Decimal point precision in the text datacard output -PROC_LST = ["WWZ","ZH","ZZ","ttZ","other"] -SIG_LST = ["WWZ","ZH"] -CAT_LST = ["4l_wwz_sf_A", "4l_wwz_sf_B", "4l_wwz_sf_C", "4l_wwz_of_1", "4l_wwz_of_2", "4l_wwz_of_3", "4l_wwz_of_4"] +# Systs that are not correlated across years +SYSTS_SPECIAL = { + "btagSFlight_uncorrelated_2016APV" : {"yr_rel":"UL16APV", "yr_notrel": ["UL16", "UL17", "UL18"]}, + "btagSFbc_uncorrelated_2016APV" : {"yr_rel":"UL16APV", "yr_notrel": ["UL16", "UL17", "UL18"]}, + "btagSFlight_uncorrelated_2016" : {"yr_rel":"UL16", "yr_notrel": ["UL16APV", "UL17", "UL18"]}, + "btagSFbc_uncorrelated_2016" : {"yr_rel":"UL16", "yr_notrel": ["UL16APV", "UL17", "UL18"]}, + "btagSFlight_uncorrelated_2017" : {"yr_rel":"UL17", "yr_notrel": ["UL16APV", "UL16", "UL18"]}, + "btagSFbc_uncorrelated_2017" : {"yr_rel":"UL17", "yr_notrel": ["UL16APV", "UL16", "UL18"]}, + "btagSFlight_uncorrelated_2018" : {"yr_rel":"UL18", "yr_notrel": ["UL16APV", "UL16", "UL17"]}, + "btagSFbc_uncorrelated_2018" : {"yr_rel":"UL18", "yr_notrel": ["UL16APV", "UL16", "UL17"]}, +} -# Sum the predicted yields over categorires to get asimov data number -def get_fake_data_for_ch(yld_dict,ch): - data_obs = 0 - for proc in yld_dict.keys(): - data_obs += yld_dict[proc][ch][0] - return data_obs +########### Writing the datacard ########### # Make the datacard for a given channel -def make_ch_card(ch_ylds,ch,out_dir): +def make_ch_card(ch,proc_order,ch_ylds,ch_kappas=None,ch_gmn=None,out_dir="."): # Building blocks we'll need to build the card formatting bin_str = f"bin_{ch}" @@ -34,15 +43,14 @@ def make_ch_card(ch_ylds,ch,out_dir): left_width = max(syst_width+len("shape")+1,left_width) # The output name, location - outf_card_name = f"test_card_{ch}.txt" - print(f"Generating text file: {outf_card_name}") + outf_card_name = f"wwz4l_card_{ch}.txt" + print(f"Generating text file: {out_dir}/{outf_card_name}") outf_card_name = os.path.join(out_dir,outf_card_name) # Create the card for this channel with open(outf_card_name,"w") as f: # Shapes rows, not sure of the purpose of the shapes lines when we have no shape templates - #f.write("shapes * * {ch} FAKE\n") f.write("shapes * * FAKE\n") f.write(line_break) f.write(f"bin {bin_str}\n") @@ -50,9 +58,6 @@ def make_ch_card(ch_ylds,ch,out_dir): f.write(line_break) f.write(line_break) - # Note: This list is what controls the columns in the text datacard, if a process appears - proc_order = PROC_LST - # Bin row row = [f"{'bin':<{left_width}}"] # Python string formatting is pretty great! for p in proc_order: @@ -72,7 +77,7 @@ def make_ch_card(ch_ylds,ch,out_dir): bkgd_count = 1 sgnl_count = -1 for p in proc_order: - if any([x in p for x in SIG_LST]): # Check for if the process is signal or not + if any([x in p for x in sg.SIG_LST]): # Check for if the process is signal or not row.append(f"{sgnl_count:>{col_width}}") sgnl_count += -1 else: @@ -84,24 +89,261 @@ def make_ch_card(ch_ylds,ch,out_dir): # Rate row row = [f"{'rate':<{left_width}}"] for p in proc_order: - r = ch_ylds[p][0] - if r < 0: - raise Exception(f"\nERROR: Process {p} has negative total rate: {r:.3f}.\n") - row.append(f"{r:>{col_width}.{PRECISION}f}") + r = ch_ylds[p] + row.append(r) row = " ".join(row) + "\n" - - # Write to the file f.write(row) f.write(line_break) + # Systematics rows + if ch_kappas is not None: + for syst_name in ch_kappas: + row = [f"{syst_name} lnN"] + for p in proc_order: + kappa_str = ch_kappas[syst_name][p] + row.append(kappa_str) + row = " ".join(row) + "\n" + f.write(row) + + # Systematics rows for gmN + if ch_gmn is not None: + for name in ch_gmn: + row = [name] + for p in proc_order: + alpha_str = ch_gmn[name][p] + row.append(alpha_str) + row = " ".join(row) + "\n" + f.write(row) + f.write(line_break) + else: + f.write(line_break) + + + + +########### Getting and manipulating yields ########### + + +# Modify the yields dict to properly calculate the per-year systs +# - Needs all years in input dict, expects input dict with keys: year,cat,syst,proc +# - Modifies the "FR2" subdict of the yield dict to have proper up and down variations for the per year systematics +# - Because of how we fill in the processor, the yields for per year systs come _only_ from that year +# - So this function adds the nominal yields from the other three years to the up/down variation for the relevant year +# - Note the in_dict is modifed in place (we do not return a copy of the dict) +def handle_per_year_systs_for_fr2(in_dict, systs_special=SYSTS_SPECIAL): + for cat in in_dict["FR2"].keys(): + for sys in systs_special: + # Find up/down variation for the year relevant to that syst + yrrel = systs_special[sys]["yr_rel"] # The relevant year for this special syst + yld_yrrel_up = in_dict[yrrel][cat][f"{sys}Up"] + yld_yrrel_do = in_dict[yrrel][cat][f"{sys}Down"] + # Get nominal yld for all years other than the relevant one + yld_yrrel_nom = in_dict[yrrel][cat]["nominal"] + yld_yrall_nom = in_dict["FR2"][cat]["nominal"] + yld_allbutyrrel_nom = utils.get_diff_between_dicts(yld_yrall_nom,yld_yrrel_nom,difftype="absolute_diff") # This is: x = sum(nom yld for all years except relevant year) + # Get the yield with just the relevant year's up/down variation varied (with nominal yld for all other years) + yld_up = utils.get_diff_between_dicts(yld_allbutyrrel_nom, yld_yrrel_up, difftype="sum") # This is: x + (up yld for relevant year) + yld_do = utils.get_diff_between_dicts(yld_allbutyrrel_nom, yld_yrrel_do, difftype="sum") # This is: x + (down yld for relevant year) + in_dict["FR2"][cat][f"{sys}Up"] = yld_up + in_dict["FR2"][cat][f"{sys}Down"] = yld_do + + +# Get rid of negative values in the yld dict +# - Replace the value with SMALL +# - And add |value| to the stat error to be more conservative +# - Shift the up/down variations to be centered around SMALL (does not touch stat uncertainty on up/down) +def handle_negatives(in_dict): + out_dict = copy.deepcopy(in_dict) + for cat in in_dict: + for proc in in_dict[cat]["nominal"]: + val = in_dict[cat]["nominal"][proc][0] + var = in_dict[cat]["nominal"][proc][1] + if val < 0: + print(f"WARNING: Process \"{proc}\" in cat \"{cat}\" is negative ({val}), replacing with {SMALL} and shifting up/down systematic variations accordingly.") + out_dict[cat]["nominal"][proc][0] = SMALL + out_dict[cat]["nominal"][proc][1] = (abs(val) + np.sqrt(var))**2 + for syst in out_dict[cat]: + if syst == "nominal": continue # Already handled this one + syst_var_orig = out_dict[cat][syst][proc] + out_dict[cat][syst][proc][0] = (syst_var_orig - val) + SMALL # Center around SMALL + + return out_dict + + + +########### Regarding uncertainties ########### + +# Get the rate systs from the intput json, dump into dict (with nested keys: syst, proc) +# Outputs strings, ready to be dumped into datacard +def get_rate_systs(proc_lst): + syst_json = ewkcoffea_path("params/rate_systs.json") + with open(syst_json) as f_systs: rate_systs_dict = json.load(f_systs) + + # Build up the dictionary + out_dict = {} + + # Make row for rate uncertainties that impact all processes (for now just lumi) + for uncty_name in rate_systs_dict["rate_uncertainties_all_proc"]: + out_dict[uncty_name] = {} + for proc in proc_lst: + out_dict[uncty_name][proc] = str(rate_systs_dict["rate_uncertainties_all_proc"][uncty_name]) + + # Make rows for rate uncertainties that impact a subset of the processes + for uncty_name in rate_systs_dict["rate_uncertainties_some_proc"]: + for proc_of_interest in rate_systs_dict["rate_uncertainties_some_proc"][uncty_name]["procs"]: + out_dict[f"{uncty_name}_{proc_of_interest}"] = {} + for proc_itr in proc_lst: + if proc_itr == proc_of_interest: + uncty = str(rate_systs_dict["rate_uncertainties_some_proc"][uncty_name]["val"]) + else: + uncty = "-" + out_dict[f"{uncty_name}_{proc_of_interest}"][proc_itr] = uncty + + return out_dict + + +# Get kappa dict (e.g. up/nom ratios) from the dict of all histograms +def get_kappa_dict(in_dict_mc,in_dict_data): + + # Get the list of systematic base names (i.e. without the up and down tags) + # - Assumes each syst has a "systnameUp" and a "systnameDown" + # - This will drop nominal (since there is no "nominalUp" to tag on) + def get_syst_base_name_lst(in_lst): + out_lst = [] + for syst in in_lst: + if syst.endswith("Up"): + syst_name_base = syst.replace("Up","") + if syst_name_base not in out_lst: + out_lst.append(syst_name_base) + return out_lst + + # Get the kappa dict + kappa_dict = {} + for cat in in_dict_mc.keys(): + kappa_dict[cat] = {} + for sys in get_syst_base_name_lst(list(in_dict_mc[cat].keys())): + kappa_dict[cat][sys] = {} + for proc in in_dict_mc[cat]["nominal"]: + kappa_dict[cat][sys][proc] = {} + valvar_up = in_dict_mc[cat][f"{sys}Up"][proc] + valvar_do = in_dict_mc[cat][f"{sys}Down"][proc] + valvar_nom = in_dict_mc[cat]["nominal"][proc] + valvar_kappa_up = yt.valvar_op(valvar_up,valvar_nom,"div") + valvar_kappa_do = yt.valvar_op(valvar_do,valvar_nom,"div") + + # Handle negative cases + if (valvar_kappa_up[0]<0) and (valvar_kappa_do[0]<0): raise Exception("Both kappas negative, should not be possible.") + if valvar_kappa_up[0] < 0: + print(f"WARNING: Up var for {sys} for {proc} for {cat} is negative, setting to {SMALL}.") + valvar_kappa_up[0] = SMALL + if valvar_kappa_do[0] < 0: + valvar_kappa_do[0] = SMALL + print(f"WARNING: Down var for {sys} for {proc} for {cat} is negative, setting to {SMALL}.") + + kappa_dict[cat][sys][proc]["Up"] = valvar_kappa_up + kappa_dict[cat][sys][proc]["Down"] = valvar_kappa_do + + + return kappa_dict + + +# Get the MC stats from the yld dict and put it into kappa dict +# Can optionally skip processes (e.g. skip data driven ZZ and ttZ since do these different via gmN) +def add_stats_kappas(yld_mc, kappas, skip_procs=[]): + + kappas_out = copy.deepcopy(kappas) + + # Loop over cat and do NSF calculation for each relevant proc in each cat + for cat in yld_mc: + + # Make a row for proc_of_interest's stats + for proc_of_interest in yld_mc[cat]["nominal"]: + if proc_of_interest in skip_procs: continue + kappas_out[cat][f"stats_{cat}_{proc_of_interest}"] = {} + # Now fill the columns for proc_of_interest's row + for proc_itr in yld_mc[cat]["nominal"]: + # Most columns are not relevant (will just be a "-" in the datacard) + kappas_out[cat][f"stats_{cat}_{proc_of_interest}"][proc_itr] = {"Up": [None,None], "Down": [None,None]} + # But for the column that goes with this proc_of_interest, fill the actual numbers + if proc_itr == proc_of_interest: + valvar = yld_mc[cat]["nominal"][proc_of_interest] + up = (valvar[0] + np.sqrt(valvar[1]))/valvar[0] + do = (valvar[0] - np.sqrt(valvar[1]))/valvar[0] + # Clip at 0 + if do < 0: + print(f"WARNING: For cat \"{cat}\" and proc \"{proc_of_interest}\", the uncertainty {np.sqrt(valvar[1])} is larger than the value {valvar[0]}. Clipping down variation to {SMALL}.") + do = SMALL + kappas_out[cat][f"stats_{cat}_{proc_of_interest}"][proc_itr]["Up"] = [up, None] # Rel err up, do not include error on the error (just leave as None) + kappas_out[cat][f"stats_{cat}_{proc_of_interest}"][proc_itr]["Down"] = [do, None] # Rel err down, do not include error on the error (just leave as None) + + return kappas_out + + + +########### Put stuff into form to pass to the function to write out cards ########### + +# Get just the numbers we want for rate row for datacard +# Also sum all MC rates together into asimov number +# Assumes in_dict has nested keys: cat,syst,proc +def get_rate_for_dc(in_dict,cat): + out_dict = {} + asimov_data = 0 + for proc in in_dict[cat]["nominal"]: + rate = in_dict[cat]["nominal"][proc][0] + if rate < 0: + print(f"\nWarning: Process \"{proc}\" in \"{cat}\" has negative total rate: {rate}.\n") + out_dict[proc] = str(rate) + asimov_data += rate + out_dict["data_obs"] = str(asimov_data) + + return out_dict + + +# Assumes in_dict has nested keys: cat,syst_base,proc,"Up"(or "Down) +# Takes just the val (dropps uncty) +def get_kappa_for_dc(in_dict,cat): + out_dict = {} + for systname_base in in_dict[cat]: + out_dict[systname_base] = {} + for proc in in_dict[cat][systname_base]: + u = in_dict[cat][systname_base][proc]['Up'][0] + d = in_dict[cat][systname_base][proc]['Down'][0] + if (u is None) and (d is None): + out_dict[systname_base][proc] = "-" + else: + out_dict[systname_base][proc] = f"{d}/{u}" + return out_dict + + +# Prepares the gmN line for the datacard +# The proc_lst shoudl be all processes +# Assumes this is for a single category, so dict looks like {cr_name: {"N": 60, "proc_alpha": {"proc": value}}} +def get_gmn_for_dc(in_dict,proc_lst): + out_dict = {} + for cr_name in in_dict: + N = in_dict[cr_name]['N'] + if int(N)!= N: raise Exception(f"ERROR: Why is the number of events in your CR ({N}) not an int?") + row_name = f"stats_{cr_name} gmN {int(N)}" + out_dict[row_name] = {} + for p_itr in proc_lst: + if p_itr in in_dict[cr_name]["proc_alpha"]: + out = str(in_dict[cr_name]["proc_alpha"][p_itr]) + else: + out = "-" + out_dict[row_name][p_itr] = out + return out_dict + + +##################################### +########### Main function ########### def main(): # Parse args parser = argparse.ArgumentParser() parser.add_argument("in_file_name",help="Either json file of yields or pickle file with scikit hists") - parser.add_argument("--out-dir","-d",default="./testcards",help="Output directory to write root and text datacard files to") - parser.add_argument("--do-nuisance",action="store_true",help="Include nuisance parameters") + parser.add_argument("--out-dir","-d",default="./cards_wwz4l",help="Output directory to write root and text datacard files to") + parser.add_argument("-s","--do-nuisance",action="store_true",help="Include nuisance parameters") parser.add_argument("--unblind",action="store_true",help="If set, use real data, otherwise use asimov data") args = parser.parse_args() @@ -111,39 +353,91 @@ def main(): unblind = args.unblind # Check args - if do_nuis: - raise Exception("Nuisance params not implimented yet.") if out_dir != "." and not os.path.exists(out_dir): print(f"Making dir \"{out_dir}\"") os.makedirs(out_dir) - # Get the yields dict from the input file - # - We can load a scikit hist (produced by wwz4l.py processor) and get the yields from that, dumpt to a dict - # - We can also load a json that contains the yields directly - if in_file.endswith(".pkl.gz"): - f = pickle.load(gzip.open(in_file)) - yld_dict = get_yields(f) - elif in_file.endswith(".json"): - with open(in_file) as f: - yld_dict = json.load(f) - else: - raise Exception(f"ERROR: This script can only take hists or jsons, not files of type \"{in_file.split('.')[-1]}\".") - - - # Make the cards for each channel - print(f"Making cards for {CAT_LST}. \nPutting in {out_dir}.") - for ch in CAT_LST: - # Get yields for just this chan (also make fake asimov data if necessary) - ch_ylds = {} - for proc_name in yld_dict.keys(): - ch_ylds[proc_name] = yld_dict[proc_name][ch] - if not unblind: - ch_ylds["data_obs"] = get_fake_data_for_ch(yld_dict,ch) # Make asimov data for now - else: - raise Exception("We are not unblinded yet.") + # Get the histo + f = pickle.load(gzip.open(in_file)) + histo = f["njets"] # Let's use njets + + # Get the dictionary defining the mc sample grouping + sample_names_dict_data = {"FR2" : sg.create_data_sample_dict("all")} + sample_names_dict_mc = { + "UL16APV" : sg.create_mc_sample_dict(sg.SAMPLE_DICT_BASE,"UL16APV"), + "UL16" : sg.create_mc_sample_dict(sg.SAMPLE_DICT_BASE,"UL16"), + "UL17" : sg.create_mc_sample_dict(sg.SAMPLE_DICT_BASE,"UL17"), + "UL18" : sg.create_mc_sample_dict(sg.SAMPLE_DICT_BASE,"UL18"), + "FR2" : sg.create_mc_sample_dict(sg.SAMPLE_DICT_BASE,"all"), + } + + # Get yield dictionary (nested in the order: year,cat,syst,proc) + yld_dict_mc_allyears = {} + for year in sample_names_dict_mc: + yld_dict_mc_allyears[year] = yt.get_yields(histo,sample_names_dict_mc[year]) + handle_per_year_systs_for_fr2(yld_dict_mc_allyears) + + # We're only looking at Full R2 for now + yld_dict_mc = yld_dict_mc_allyears["FR2"] + yld_dict_data = yt.get_yields(histo,sample_names_dict_data["FR2"]) + + # Print info about a bin + printinfo = 0 + if printinfo: + s = "renorm" + p = "WWZ" + c = "sr_4l_of_2" + cr = "cr_4l_btag_of" + print(p,c,s,cr) + print("\nPrinting info:") + print("mc sr n",yld_dict_mc[c]["nominal"][p]) + print("mc sr u",yld_dict_mc[c][f"{s}Up"][p]) + print("mc cr n",yld_dict_mc[cr]["nominal"][p]) + print("mc cr u",yld_dict_mc[cr][f"{s}Up"][p]) + print("da cr n",yld_dict_data[cr]["nominal"]["data"]) + print("da cr u",yld_dict_data[cr][f"{s}Up"]["data"]) + print("\n") + #exit() + + + # Get the syst ratios to nominal (i.e. kappas) + kappa_dict = get_kappa_dict(yld_dict_mc,yld_dict_data) + + # Do the TF calculation + yld_dict_mc, kappa_dict, gmn_dict = yt.do_tf(yld_dict_mc,yld_dict_data,kappa_dict,sg.BKG_TF_MAP) + + # Get rid of negative yields (and recenter syst variations around SMALL), should happen before computing kappas + yld_dict_mc = handle_negatives(yld_dict_mc) + + # Add mc stats to kappa dict (important to be after TF calculation so that data driven bkg stats include stats of CRs) + kappa_dict = add_stats_kappas(yld_dict_mc,kappa_dict,skip_procs=["ZZ","ttZ"]) + + + #### Make the cards for each channel #### + print(f"Making cards for {sg.CAT_LST_CB}. \nPutting in {out_dir}.") + for ch in sg.CAT_LST_CB: + + # Get just the info we want to put in the card in str form + rate_for_dc_ch = get_rate_for_dc(yld_dict_mc,ch) + + # Get the kappa and gamma dict for this channel if we are doing systs + kappa_for_dc_ch = None + gmn_for_dc_ch = None + if do_nuis: + kappa_for_dc_ch = get_kappa_for_dc(kappa_dict,ch) + kappa_for_dc_ch.update(get_rate_systs(sg.PROC_LST)) # Append in the ones from rate json + gmn_for_dc_ch = get_gmn_for_dc(gmn_dict[ch],proc_lst=list(sg.SAMPLE_DICT_BASE.keys())) + # Make the card for this chan - make_ch_card(ch_ylds,ch,out_dir) + make_ch_card( + ch, + sg.PROC_LST, + rate_for_dc_ch, + kappa_for_dc_ch, + gmn_for_dc_ch, + out_dir, + ) print("Finished!") diff --git a/analysis/wwz/make_sample_lst_json.py b/analysis/wwz/make_sample_lst_json.py index 3df8628e..2b9bc116 100644 --- a/analysis/wwz/make_sample_lst_json.py +++ b/analysis/wwz/make_sample_lst_json.py @@ -90,6 +90,38 @@ ############################ Bkg samples ############################ +# Get some from TOP-22-006 skims # +central_UL16APV_22006_dict = { + "UL16APV_tWZ4l" : { + "path" : "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16APV_TWZToLL_tlept_Wlept/", + "histAxisName": "UL16APV_tWZ4l", + "xsecName": "TWZToLL_tlept_Wlept", + } +} +central_UL16_22006_dict = { + "UL16_tWZ4l" : { + "path" : "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16_TWZToLL_tlept_Wlept/", + "histAxisName": "UL16_tWZ4l", + "xsecName": "TWZToLL_tlept_Wlept", + } +} +central_UL17_22006_dict = { + "UL17_tWZ4l" : { + "path" : "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL17_TWZToLL_tlept_Wlept/", + "histAxisName": "UL17_tWZ4l", + "xsecName": "TWZToLL_tlept_Wlept", + } +} +central_UL18_22006_dict = { + "UL18_tWZ4l" : { + "path" : "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL18_TWZToLL_tlept_Wlept/", + "histAxisName": "UL18_tWZ4l", + "xsecName": "TWZToLL_tlept_Wlept", + } +} + + +# All the rest of the backgrounds (located at ucsd) central_UL16APV_bkg_dict = { "UL16APV_ZZTo4L" : { @@ -386,7 +418,7 @@ def main(): # A simple example #make_jsons_for_dict_of_samples(test_wwz_dict, "/ceph/cms/","2017",".",on_das=False) # An example - make_jsons_for_dict_of_samples(ci_dict, "","2017","../../input_samples/sample_jsons/test_samples/",on_das=False) # For CI json + #make_jsons_for_dict_of_samples(ci_dict, "","2017","../../input_samples/sample_jsons/test_samples/",on_das=False) # For CI json # Specify output paths jsons_path = "../../input_samples/sample_jsons/" @@ -404,6 +436,10 @@ def main(): #make_jsons_for_dict_of_samples(data_UL18, "/ceph/cms/","2018", out_dir_data_18,on_das=False) # Make configs for bkg samples + #make_jsons_for_dict_of_samples(central_UL16APV_22006_dict, "/cmsuf/data/","2016APV", out_dir_bkg,on_das=False) + #make_jsons_for_dict_of_samples(central_UL16_22006_dict, "/cmsuf/data/","2016", out_dir_bkg,on_das=False) + #make_jsons_for_dict_of_samples(central_UL17_22006_dict, "/cmsuf/data/","2017", out_dir_bkg,on_das=False) + #make_jsons_for_dict_of_samples(central_UL18_22006_dict, "/cmsuf/data/","2018", out_dir_bkg,on_das=False) make_jsons_for_dict_of_samples(central_UL16APV_bkg_dict, "/ceph/cms/","2016APV", out_dir_bkg,on_das=False) make_jsons_for_dict_of_samples(central_UL16_bkg_dict, "/ceph/cms/","2016", out_dir_bkg,on_das=False) make_jsons_for_dict_of_samples(central_UL17_bkg_dict, "/ceph/cms/","2017", out_dir_bkg,on_das=False) diff --git a/analysis/wwz/ref_for_ci/counts_wwz_ref.json b/analysis/wwz/ref_for_ci/counts_wwz_ref.json index c6a9ef85..00b23b41 100644 --- a/analysis/wwz/ref_for_ci/counts_wwz_ref.json +++ b/analysis/wwz/ref_for_ci/counts_wwz_ref.json @@ -40,14 +40,6 @@ 1861.0, null ], - "sr_4l_sf_presel_counts": [ - 1836.0, - null - ], - "sr_4l_of_presel_counts": [ - 3433.0, - null - ], "all_events_counts": [ 54868.0, null @@ -56,26 +48,26 @@ 9865.0, null ], - "cr_4l_btag_of_counts": [ - 919.0, - null - ], - "cr_4l_sf_counts": [ - 393.0, + "sr_4l_sf_incl_counts": [ + 1836.0, null ], - "cr_4l_btag_sf_counts": [ - 955.0, + "sr_4l_of_incl_counts": [ + 3433.0, null ], - "cr_4l_btag_sf_offZ_counts": [ - 847.0, + "cr_4l_btag_of_counts": [ + 919.0, null ], "cr_4l_btag_sf_offZ_met80_counts": [ 447.0, null ], + "cr_4l_sf_counts": [ + 393.0, + null + ], "sr_4l_sf_A": [ 0.5511977683719258, null @@ -104,14 +96,6 @@ 1.2574913943885722, null ], - "sr_4l_sf_presel": [ - 1.193888668142479, - null - ], - "sr_4l_of_presel": [ - 2.2967307064423976, - null - ], "all_events": [ 44.554542092725235, null @@ -120,25 +104,25 @@ 7.062864594060521, null ], - "cr_4l_btag_of": [ - 0.8712045054150901, - null - ], - "cr_4l_sf": [ - 0.2633144810331567, + "sr_4l_sf_incl": [ + 1.193888668142479, null ], - "cr_4l_btag_sf": [ - 0.8585255699670182, + "sr_4l_of_incl": [ + 2.2967307064423976, null ], - "cr_4l_btag_sf_offZ": [ - 0.7511458992925877, + "cr_4l_btag_of": [ + 0.8712045054150901, null ], "cr_4l_btag_sf_offZ_met80": [ 0.39497905244658593, null + ], + "cr_4l_sf": [ + 0.2633144810331567, + null ] } -} +} \ No newline at end of file diff --git a/analysis/wwz/wwz4l.py b/analysis/wwz/wwz4l.py index fd467075..2a7f045d 100644 --- a/analysis/wwz/wwz4l.py +++ b/analysis/wwz/wwz4l.py @@ -574,6 +574,7 @@ def process(self, events): zeroj = (njets==0) # For WWZ selection + selections.add("sr_4l_sf_A", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & sf_A)) selections.add("sr_4l_sf_B", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & sf_B)) selections.add("sr_4l_sf_C", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & sf_C)) @@ -585,10 +586,15 @@ def process(self, events): selections.add("all_events", (events.is4lWWZ | (~events.is4lWWZ))) # All events.. this logic is a bit roundabout to just get an array of True selections.add("4l_presel", (events.is4lWWZ)) # This matches the VVV looper selection (object selection and event selection) - selections.add("sr_4l_sf_presel", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & (met.pt > 65.0))) - selections.add("sr_4l_of_presel", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_of)) + selections.add("sr_4l_sf_incl", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & (met.pt >= 65.0))) # Inclusive over SF sr (only applying cuts that are applied to all SF SRs), just use for visualization + selections.add("sr_4l_of_incl", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_of)) # Inclusive over OF sr (only applying cuts that are applied to all OF SRs), just use for visualization # For BDT SRs + + selections.add("sr_4l_bdt_sf_presel", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z)) + selections.add("sr_4l_bdt_sf_trn" , (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & mt2_mask)) + selections.add("sr_4l_bdt_of_presel", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_of)) + selections.add("sr_4l_bdt_sf_wwz_sr1", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_of & sf_wwz_sr1)) selections.add("sr_4l_bdt_sf_wwz_sr2", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_of & sf_wwz_sr2)) selections.add("sr_4l_bdt_sf_wwz_sr3", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_of & sf_wwz_sr3)) @@ -612,8 +618,6 @@ def process(self, events): ww_em = ((abs(w_lep0.pdgId) == 11) & (abs(w_lep1.pdgId) == 13)) ww_me = ((abs(w_lep0.pdgId) == 13) & (abs(w_lep1.pdgId) == 11)) selections.add("cr_4l_btag_of", (pass_trg & events.is4lWWZ & bmask_atleast1loose & events.wwz_presel_of)) - selections.add("cr_4l_btag_sf", (pass_trg & events.is4lWWZ & bmask_atleast1loose & events.wwz_presel_sf)) - selections.add("cr_4l_btag_sf_offZ", (pass_trg & events.is4lWWZ & bmask_atleast1loose & events.wwz_presel_sf & w_candidates_mll_far_from_z)) selections.add("cr_4l_btag_sf_offZ_met80", (pass_trg & events.is4lWWZ & bmask_atleast1loose & events.wwz_presel_sf & w_candidates_mll_far_from_z & (met.pt > 80.0))) selections.add("cr_4l_sf", (pass_trg & events.is4lWWZ & bmask_exactly0loose & events.wwz_presel_sf & (~w_candidates_mll_far_from_z))) @@ -639,9 +643,9 @@ def process(self, events): cat_dict = { "lep_chan_lst" : [ "sr_4l_sf_A","sr_4l_sf_B","sr_4l_sf_C","sr_4l_of_1","sr_4l_of_2","sr_4l_of_3","sr_4l_of_4", - "sr_4l_sf_presel", "sr_4l_of_presel", - "all_events","4l_presel", - "cr_4l_btag_of","cr_4l_sf", "cr_4l_btag_sf", "cr_4l_btag_sf_offZ", "cr_4l_btag_sf_offZ_met80", + "all_events","4l_presel", "sr_4l_sf_incl", "sr_4l_of_incl", + "cr_4l_btag_of", "cr_4l_btag_sf_offZ_met80", "cr_4l_sf", + "sr_4l_bdt_sf_presel", "sr_4l_bdt_sf_trn", "sr_4l_bdt_of_presel", ] + bdt_sr_names } @@ -723,7 +727,7 @@ def process(self, events): exclude_var_dict = { "mt2" : ["all_events"], "ptl4" : ["all_events"], - "j0pt" : ["all_events", "4l_presel", "sr_4l_sf_presel", "sr_4l_of_presel", "cr_4l_sf"] + analysis_cats, + "j0pt" : ["all_events", "4l_presel", "sr_4l_sf_incl", "sr_4l_of_incl", "sr_4l_bdt_sf_presel", "sr_4l_bdt_sf_trn", "sr_4l_bdt_of_presel", "cr_4l_sf"] + analysis_cats, "l0pt" : ["all_events"], "mll_01" : ["all_events"], "mllll" : ["all_events"], @@ -764,8 +768,8 @@ def process(self, events): "mll_min_afos" : ["all_events"], "mll_min_sfos" : ["all_events"], - "mlb_min" : ["all_events","4l_presel", "sr_4l_sf_presel", "sr_4l_of_presel", "cr_4l_sf"] + analysis_cats, - "mlb_max" : ["all_events","4l_presel", "sr_4l_sf_presel", "sr_4l_of_presel", "cr_4l_sf"] + analysis_cats, + "mlb_min" : ["all_events","4l_presel", "sr_4l_sf_incl", "sr_4l_of_incl", "sr_4l_bdt_sf_presel", "sr_4l_bdt_sf_trn", "sr_4l_bdt_of_presel", "cr_4l_sf"] + analysis_cats, + "mlb_max" : ["all_events","4l_presel", "sr_4l_sf_incl", "sr_4l_of_incl", "sr_4l_bdt_sf_presel", "sr_4l_bdt_sf_trn", "sr_4l_bdt_of_presel", "cr_4l_sf"] + analysis_cats, "bdt_of_wwz_raw": ["all_events"], "bdt_sf_wwz_raw": ["all_events"], diff --git a/ewkcoffea/modules/objects_wwz.py b/ewkcoffea/modules/objects_wwz.py index c63a7099..4db9a26f 100644 --- a/ewkcoffea/modules/objects_wwz.py +++ b/ewkcoffea/modules/objects_wwz.py @@ -10,7 +10,7 @@ # Clean collection b (e.g. jets) with collection a (e.g. leps) def get_cleaned_collection(obj_collection_a,obj_collection_b,drcut=0.4): - obj_b_nearest_to_any_in_a , dr = obj_collection_b.nearest(obj_collection_a,return_metric=True) + obj_a_nearest_to_any_in_b , dr = obj_collection_b.nearest(obj_collection_a,return_metric=True) mask = ak.fill_none(dr>drcut,True) return obj_collection_b[mask] diff --git a/ewkcoffea/modules/sample_groupings.py b/ewkcoffea/modules/sample_groupings.py new file mode 100644 index 00000000..f523a534 --- /dev/null +++ b/ewkcoffea/modules/sample_groupings.py @@ -0,0 +1,157 @@ +# Dict to keep track of sample groupings, and associated tools + + +######################## Lists ######################## + +PROC_LST = ["WWZ","ZH","ZZ","ttZ","tWZ","WZ","other"] +SIG_LST = ["WWZ","ZH"] +BKG_LST = ["ZZ","ttZ","tWZ","WZ","other"] +CAT_LST_CB = ["sr_4l_sf_A", "sr_4l_sf_B", "sr_4l_sf_C", "sr_4l_of_1", "sr_4l_of_2", "sr_4l_of_3", "sr_4l_of_4"] + + +######################## Dictionaries ######################## + +# Map showing which CR categories are used to calculate NSFs for which SRs for which processes +BKG_TF_MAP = { + + "ZZ" : { + "sr_4l_sf_A" : "cr_4l_sf", + "sr_4l_sf_B" : "cr_4l_sf", + "sr_4l_sf_C" : "cr_4l_sf", + "sr_4l_of_1" : "cr_4l_sf", + "sr_4l_of_2" : "cr_4l_sf", + "sr_4l_of_3" : "cr_4l_sf", + "sr_4l_of_4" : "cr_4l_sf", + + }, + "ttZ" : { + "sr_4l_sf_A" : "cr_4l_btag_sf_offZ_met80", + "sr_4l_sf_B" : "cr_4l_btag_sf_offZ_met80", + "sr_4l_sf_C" : "cr_4l_btag_sf_offZ_met80", + "sr_4l_of_1" : "cr_4l_btag_of", + "sr_4l_of_2" : "cr_4l_btag_of", + "sr_4l_of_3" : "cr_4l_btag_of", + "sr_4l_of_4" : "cr_4l_btag_of", + } +} + + +# The "official" groupings +SAMPLE_DICT_BASE = { + "WWZ" : ["WWZJetsTo4L2Nu"], + "ZH" : ["GluGluZH","qqToZHToZTo2L"], + + #"qqZZ": ["ZZTo4l"], + #"ggZZ": ["ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau"], + "ZZ" : ["ZZTo4l", "ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau"], + + "ttZ" : [ + "TTZToLL_M_1to10", + "TTZToLLNuNu_M_10", + "TTZToQQ", + ], + + "tWZ" : ["tWZ4l"], # Old sample tWll + + "WZ" : ["WZTo3LNu"], + + "other" : [ + + ##"WWZJetsTo4L2Nu", + ##"GluGluZH","qqToZHToZTo2L", + ##"ZZTo4l", "ggToZZTo2e2mu", "ggToZZTo2e2tau", "ggToZZTo2mu2tau", "ggToZZTo4e", "ggToZZTo4mu", "ggToZZTo4tau", + ##"TTZToLL_M_1to10","TTZToLLNuNu_M_10","TTZToQQ", + ##"tWZ4l", + + ##"DYJetsToLL_M_10to50_MLM", + "DYJetsToLL_M_50_MLM", + "SSWW", + "ST_antitop_t-channel", + "ST_top_s-channel", + "ST_top_t-channel", + "tbarW_noFullHad", + "ttHnobb", + "TTTo2L2Nu", + "TTWJetsToLNu", + "TTWJetsToQQ", + "tW_noFullHad", + "tZq", + "VHnobb", + ##"WJetsToLNu", + "WWTo2L2Nu", + #"WZTo3LNu", # Now by itself + + "WWW", + "WZZ", + "ZZZ", + ], +} + +# Processes indiviudally +SAMPLE_DICT_BASE_INDIV = { + "WWZJetsTo4L2Nu": ["WWZJetsTo4L2Nu"], + "GluGluZH": ["GluGluZH"], + "qqToZHToZTo2L": ["qqToZHToZTo2L"], + "ZZTo4l": ["ZZTo4l"], + "ggToZZTo2e2mu": ["ggToZZTo2e2mu"], + "ggToZZTo2e2tau": ["ggToZZTo2e2tau"], + "ggToZZTo2mu2tau": ["ggToZZTo2mu2tau"], + "ggToZZTo4e": ["ggToZZTo4e"], + "ggToZZTo4mu": ["ggToZZTo4mu"], + "ggToZZTo4tau": ["ggToZZTo4tau"], + "TTZToLL_M_1to10": ["TTZToLL_M_1to10"], + "TTZToLLNuNu_M_10": ["TTZToLLNuNu_M_10"], + "TTZToQQ": ["TTZToQQ"], + "tWZ4l" : ["tWZ4l"], # Old sample tWll + + ##"DYJetsToLL_M_10to50_MLM": ["DYJetsToLL_M_10to50_MLM"], + "DYJetsToLL_M_50_MLM": ["DYJetsToLL_M_50_MLM"], + "SSWW": ["SSWW"], + "ST_antitop_t-channel": ["ST_antitop_t-channel"], + "ST_top_s-channel": ["ST_top_s-channel"], + "ST_top_t-channel": ["ST_top_t-channel"], + "tbarW_noFullHad": ["tbarW_noFullHad"], + "ttHnobb": ["ttHnobb"], + "TTTo2L2Nu": ["TTTo2L2Nu"], + "TTWJetsToLNu": ["TTWJetsToLNu"], + "TTWJetsToQQ": ["TTWJetsToQQ"], + "tW_noFullHad": ["tW_noFullHad"], + "tZq": ["tZq"], + "VHnobb": ["VHnobb"], + ##"WJetsToLNu": ["WJetsToLNu"], + "WWTo2L2Nu": ["WWTo2L2Nu"], + "WZTo3LNu": ["WZTo3LNu"], + + "WWW" : ["WWW"], + "WZZ" : ["WZZ"], + "ZZZ" : ["ZZZ"], +} + + +######################## Tools ######################## + +# Pass dictionary with the base names for the samples, and return with full list for 4 years +def create_mc_sample_dict(in_dict,year): + out_dict = {} + if year == "all": + years = ["UL16APV","UL16","UL17","UL18"] + else: + years = [year] + for proc_group in in_dict.keys(): + out_dict[proc_group] = [] + for proc_base_name in in_dict[proc_group]: + for year_str in years: + out_dict[proc_group].append(f"{year_str}_{proc_base_name}") + #out_dict[proc_group].append(f"{proc_base_name}{year_str}") # TOP22006 format + return out_dict + +# Get data sampel dict +def create_data_sample_dict(year): + if year == "all": + grouping_data = {'data': ["UL16APV_data","UL16_data","UL17_data","UL18_data"]} + #grouping_data = {'data': ["dataUL16APV","dataUL16","dataUL17","dataUL18"]} # TOP22006 format + else: + grouping_data = {'data': [f"{year}_data"]} + #grouping_data = {'data': [f"data{year}"]} # TOP22006 format + return grouping_data + diff --git a/ewkcoffea/modules/yield_tools.py b/ewkcoffea/modules/yield_tools.py new file mode 100644 index 00000000..bbe6f640 --- /dev/null +++ b/ewkcoffea/modules/yield_tools.py @@ -0,0 +1,135 @@ +import numpy as np +import copy + +# Yields for getting yields from histograms, and manipulating those yields + +########### General ########### + +# Takes two pairs [val1,var1] and [val2,var2], returns the product or sum with error propagated +# Note the var is like sumw2 i.e. alreayd squared (in both input and output) +def valvar_op(valvar_1, valvar_2, op): + val1 = valvar_1[0] + var1 = valvar_1[1] + val2 = valvar_2[0] + var2 = valvar_2[1] + + if op == "prod": + val = val1*val2 + var = (val**2) * ( (np.sqrt(var1)/val1)**2 + (np.sqrt(var2)/val2)**2 ) + elif op == "div": + val = val1/val2 + var = (val**2) * ( (np.sqrt(var1)/val1)**2 + (np.sqrt(var2)/val2)**2 ) + elif op == "sum": + val = val1 + val2 + var = var1 + var2 + elif op == "diff": + val = val1 - val2 + var = var1 + var2 + else: + raise Exception("Unknown operatation") + + return [val,var] + + +############## Getting yields from a histo ############## + +# Get the yields (nested in the order: year,cat,syst,proc) +def get_yields(histo,sample_dict,blind=True,systematic_name=None): + + yld_dict = {} + + if systematic_name is None: syst_lst = histo.axes["systematic"] + else: syst_lst = [systematic_name] + + # Look at the yields in the histo + for cat_name in histo.axes["category"]: + yld_dict[cat_name] = {} + for syst_name in syst_lst: + yld_dict[cat_name][syst_name ] = {} + for proc_name in sample_dict.keys(): + if blind and (("data" in proc_name) and (not cat_name.startswith("cr_"))): + # If this is data and we're not in a CR category, put placeholder numbers for now + yld_dict[cat_name][syst_name][proc_name] = [-999,-999] + else: + val = sum(sum(histo[{"category":cat_name,"process":sample_dict[proc_name],"systematic":syst_name }].values(flow=True))) + var = sum(sum(histo[{"category":cat_name,"process":sample_dict[proc_name],"systematic":syst_name }].variances(flow=True))) + yld_dict[cat_name][syst_name][proc_name] = [val,var] + + return yld_dict + + +############## Manipulating yields in a yield dict ############## + +# Calculate data-driven background estimation from relevant CRs +def do_tf(yld_mc,yld_data,kappas,tf_map,quiet=True): + + yld_mc_out = copy.deepcopy(yld_mc) + kappas_out = copy.deepcopy(kappas) + gmn_alpha_out = {} + + # Loop over cat and do NSF calculation for each relevant proc in each cat + for cat in yld_mc: + # Just nonimal for now + for proc_of_interest in yld_mc[cat]["nominal"]: + + # Skip procs that do not get TF calculations + if proc_of_interest not in tf_map: continue + elif cat not in tf_map[proc_of_interest]: + #print(f"Warning, cat \"{cat}\" not defined for this proc.") + continue + + # Otherwise we go ahead and do the background estimation stuff + else: + + # Get the nominal mc and data yields in the CR + cr_name = tf_map[proc_of_interest][cat] + valvar_cr_mc = yld_mc[cr_name]["nominal"][proc_of_interest] + valvar_cr_data = yld_data[cr_name]["nominal"]["data"] + + # Sum up all contributions in the CR besides bkg of interest + valvar_bkg_all_but_bkg_of_interest = [0,0] + for p in yld_mc[cr_name]["nominal"]: + if p != proc_of_interest: + valvar_bkg_all_but_bkg_of_interest[0] += yld_mc[cr_name]["nominal"][p][0] + valvar_bkg_all_but_bkg_of_interest[1] += yld_mc[cr_name]["nominal"][p][1] + + # Subtract those extra background contributions from the data + valvar_cr_data_corrected = valvar_op(valvar_cr_data, valvar_bkg_all_but_bkg_of_interest, "diff") + + # Calculate the NSF = N_CR_with_other_bkg_subtracted / MC_CR, use this to scale the yld + valvar_nsf = valvar_op(valvar_cr_data_corrected, valvar_cr_mc, "div") + valvar_bkg = valvar_op(valvar_nsf, yld_mc[cat]["nominal"][proc_of_interest], "prod") + + # Dump NSF value + if not quiet: + relerr = 100*(np.sqrt(valvar_nsf[1])/valvar_nsf[0]) + print(f"NSF for {cat} {proc_of_interest}: {np.round(valvar_nsf[0],2)} +- {np.round(relerr,2)}%") + #print(f"NSF for {cat} {proc_of_interest}: {np.round(valvar_nsf[0],2)} +- {np.round(np.sqrt(valvar_nsf[1]),2)}") + + # Put the old yield times the NSF into the out dict + yld_mc_out[cat]["nominal"][proc_of_interest] = valvar_bkg + + # Get the gmN numbers + valvar_alpha = valvar_op(valvar_bkg,valvar_cr_data, "div") + if cat not in gmn_alpha_out: gmn_alpha_out[cat] = {} + if cr_name not in gmn_alpha_out[cat]: gmn_alpha_out[cat][cr_name] = {"N": valvar_cr_data[0], "proc_alpha": {}} + gmn_alpha_out[cat][cr_name]["proc_alpha"][proc_of_interest] = valvar_alpha[0] + + ### Handle the kappas ### + + if kappas is not None: + + # Loop over syst and replace the kappas with the e.g. MC_SR_up/MC_CR_up + for syst_base_name in kappas[cat]: + + sr_up = kappas[cat][syst_base_name][proc_of_interest]["Up"] + sr_do = kappas[cat][syst_base_name][proc_of_interest]["Down"] + cr_up = kappas[cr_name][syst_base_name][proc_of_interest]["Up"] + cr_do = kappas[cr_name][syst_base_name][proc_of_interest]["Down"] + new_kappa_up = valvar_op(sr_up,cr_up,"div") + new_kappa_do = valvar_op(sr_do,cr_do,"div") + + kappas_out[cat][syst_base_name][proc_of_interest]["Up"] = new_kappa_up + kappas_out[cat][syst_base_name][proc_of_interest]["Down"] = new_kappa_do + + return [yld_mc_out, kappas_out, gmn_alpha_out] diff --git a/ewkcoffea/params/rate_systs.json b/ewkcoffea/params/rate_systs.json new file mode 100644 index 00000000..40947140 --- /dev/null +++ b/ewkcoffea/params/rate_systs.json @@ -0,0 +1,15 @@ +{ + "rate_uncertainties_all_proc" : { + "lumi": 1.016 + }, + "rate_uncertainties_some_proc" : { + "qcd_scale": { + "procs": ["ttZ"], + "val": "0.898/1.117" + }, + "fake_fake": { + "procs": ["WZ"], + "val": "1.3" + } + } +} diff --git a/input_samples/cfgs/wwz_analysis/mc_sig_bkg_samples.cfg b/input_samples/cfgs/wwz_analysis/mc_sig_bkg_samples.cfg index 1885ab2c..bf16fac3 100644 --- a/input_samples/cfgs/wwz_analysis/mc_sig_bkg_samples.cfg +++ b/input_samples/cfgs/wwz_analysis/mc_sig_bkg_samples.cfg @@ -22,6 +22,14 @@ root://redirector.t2.ucsd.edu:1095/ #### Bkg samples ### +# Using the TOP-22-006 skims for the tWZ samples (which are at UF) +root://cmsio2.rc.ufl.edu/ +../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_tWZ4l.json +../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_tWZ4l.json +../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_tWZ4l.json +../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_tWZ4l.json + +# Using Keegan's skims for all other background samples (all at UCSD) root://redirector.t2.ucsd.edu:1095/ ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_TTZToLL_M_1to10.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_TTZToLLNuNu_M_10.json @@ -33,7 +41,6 @@ root://redirector.t2.ucsd.edu:1095/ ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_ggToZZTo4e.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_ggToZZTo4mu.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_ggToZZTo4tau.json -../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_tWll.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_WWW.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_WZZ.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_ZZZ.json @@ -66,7 +73,6 @@ root://redirector.t2.ucsd.edu:1095/ ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_ggToZZTo4e.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_ggToZZTo4mu.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_ggToZZTo4tau.json -../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_tWll.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_WWW.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_WZZ.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_ZZZ.json @@ -99,7 +105,6 @@ root://redirector.t2.ucsd.edu:1095/ ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_ggToZZTo4e.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_ggToZZTo4mu.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_ggToZZTo4tau.json -../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_tWll.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_WWW.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_WZZ.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_ZZZ.json @@ -132,7 +137,6 @@ root://redirector.t2.ucsd.edu:1095/ ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_ggToZZTo4e.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_ggToZZTo4mu.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_ggToZZTo4tau.json -../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_tWll.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_WWW.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_WZZ.json ../../input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_ZZZ.json diff --git a/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_tWZ4l.json b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_tWZ4l.json new file mode 100644 index 00000000..928a2249 --- /dev/null +++ b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16APV_tWZ4l.json @@ -0,0 +1,28 @@ +{ + "xsec": 0.0015, + "year": "2016APV", + "treeName": "Events", + "histAxisName": "UL16APV_tWZ4l", + "options": "", + "WCnames": [], + "files": [ + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16APV_TWZToLL_tlept_Wlept/output_106.root", + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16APV_TWZToLL_tlept_Wlept/output_105.root" + ], + "nEvents": 244910, + "nGenEvents": 284000, + "nSumOfWeights": 426.966403577, + "isData": false, + "path": "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16APV_TWZToLL_tlept_Wlept/", + "nSumOfLheWeights": [ + 442.48136899513287, + 443.2940680693649, + 448.2509118579346, + 424.80109646182194, + 426.966403577, + 431.5109333561428, + 406.6066613731646, + 409.6788521329431, + 413.8732456848023 + ] +} \ No newline at end of file diff --git a/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_tWZ4l.json b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_tWZ4l.json new file mode 100644 index 00000000..1c72bac0 --- /dev/null +++ b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL16_tWZ4l.json @@ -0,0 +1,28 @@ +{ + "xsec": 0.0015, + "year": "2016", + "treeName": "Events", + "histAxisName": "UL16_tWZ4l", + "options": "", + "WCnames": [], + "files": [ + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16_TWZToLL_tlept_Wlept/output_109.root", + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16_TWZToLL_tlept_Wlept/output_108.root" + ], + "nEvents": 276147, + "nGenEvents": 320000, + "nSumOfWeights": 480.738289402, + "isData": false, + "path": "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL16_TWZToLL_tlept_Wlept/", + "nSumOfLheWeights": [ + 496.3102020800668, + 498.3559010428868, + 504.8879244805839, + 477.3600398502298, + 480.738289402, + 486.6363671765537, + 457.5558710690634, + 461.81007904850804, + 467.18622093703095 + ] +} \ No newline at end of file diff --git a/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_tWZ4l.json b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_tWZ4l.json new file mode 100644 index 00000000..5bc8c42c --- /dev/null +++ b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL17_tWZ4l.json @@ -0,0 +1,28 @@ +{ + "xsec": 0.0015, + "year": "2017", + "treeName": "Events", + "histAxisName": "UL17_tWZ4l", + "options": "", + "WCnames": [], + "files": [ + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL17_TWZToLL_tlept_Wlept/output_166.root", + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL17_TWZToLL_tlept_Wlept/output_147.root" + ], + "nEvents": 609454, + "nGenEvents": 708000, + "nSumOfWeights": 1064.3458483420002, + "isData": false, + "path": "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL17_TWZToLL_tlept_Wlept/", + "nSumOfLheWeights": [ + 1099.5862859687265, + 1104.757884751641, + 1119.8829802553514, + 1056.402575836048, + 1064.3458483420002, + 1077.9117287077881, + 1011.7264402952122, + 1021.4784259301069, + 1033.7728601688923 + ] +} \ No newline at end of file diff --git a/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_tWZ4l.json b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_tWZ4l.json new file mode 100644 index 00000000..70f02d55 --- /dev/null +++ b/input_samples/sample_jsons/wwz_analysis_skims_v0/bkg_samples/UL18_tWZ4l.json @@ -0,0 +1,29 @@ +{ + "xsec": 0.0015, + "year": "2018", + "treeName": "Events", + "histAxisName": "UL18_tWZ4l", + "options": "", + "WCnames": [], + "files": [ + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL18_TWZToLL_tlept_Wlept/output_104.root", + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL18_TWZToLL_tlept_Wlept/output_167.root", + "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL18_TWZToLL_tlept_Wlept/output_156.root" + ], + "nEvents": 863439, + "nGenEvents": 1000000, + "nSumOfWeights": 1503.079102063, + "isData": false, + "path": "/store/user/rucio/kmohrman/skims/mc/new-lepMVA-v2/central_bkgd_p7/TWZToLL/v1/UL18_TWZToLL_tlept_Wlept/", + "nSumOfLheWeights": [ + 1552.9181262886564, + 1560.400475432074, + 1581.8311111672774, + 1491.7389786512979, + 1503.079102063, + 1522.2925435913844, + 1428.5885210888646, + 1442.4430747855986, + 1459.8497666766461 + ] +} \ No newline at end of file