From a96044cf9bc66267fda5358d7d2e573fce32624d Mon Sep 17 00:00:00 2001 From: Samuel May Date: Thu, 4 Feb 2021 16:17:55 -0800 Subject: [PATCH] Add tools for running ttH leptonic preselection --- .../data/samples_and_scale1fb_ttH.json | 544 ++++++++++++++++++ Preselection/data/samples_ttH.json | 240 ++++++++ Preselection/data/ttH_Leptonic.json | 42 ++ Preselection/helpers/loop_helper.py | 10 +- .../selections/analysis_selections.py | 24 +- Preselection/selections/jet_selections.py | 27 + Preselection/selections/lepton_selections.py | 2 - Preselection/selections/tau_selections.py | 3 - 8 files changed, 875 insertions(+), 17 deletions(-) create mode 100644 Preselection/data/samples_and_scale1fb_ttH.json create mode 100644 Preselection/data/samples_ttH.json create mode 100644 Preselection/data/ttH_Leptonic.json create mode 100644 Preselection/selections/jet_selections.py diff --git a/Preselection/data/samples_and_scale1fb_ttH.json b/Preselection/data/samples_and_scale1fb_ttH.json new file mode 100644 index 0000000..41a264c --- /dev/null +++ b/Preselection/data/samples_and_scale1fb_ttH.json @@ -0,0 +1,544 @@ +{ + "Data": { + "2016": { + "metadata": {}, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016B-2____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016B____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016C____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016D____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016E____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016F____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016G____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016H____v4/" + ] + }, + "2017": { + "metadata": {}, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017B____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017C____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017D____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017E____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017F____v4/" + ] + }, + "2018": { + "metadata": {}, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018A____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018B____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018C____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018D____v4/" + ] + }, + "fpo": 10, + "process_id": 0, + "resonant": false + }, + "DiPhoton": { + "2016": { + "metadata": { + "n_events": 58902953, + "scale1fb": 0.00302983667564884, + "sumWeights": 27856287, + "xs": 84.4 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/DiPhotonJetsBox_MGG-80toInf_13TeV-Sherpa_16____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 49433922, + "scale1fb": 0.003949300157340305, + "sumWeights": 21370875, + "xs": 84.4 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/DiPhotonJetsBox_MGG-80toInf_13TeV-Sherpa_17____v4/" + ] + }, + "2018": { + "metadata": { + "n_events": 14050520, + "scale1fb": 0.013894682913128929, + "sumWeights": 6074266, + "xs": 84.4 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/DiPhotonJetsBox_MGG-80toInf_13TeV-Sherpa_18____v4/" + ] + }, + "fpo": 5, + "process_id": 3, + "resonant": false + }, + "GJets_HT-100To200": { + "2016": { + "metadata": { + "n_events": 10104155, + "scale1fb": 0.8542030481519731, + "sumWeights": 10104155, + "xs": 8631.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 9959190, + "scale1fb": 0.8668177814647021, + "sumWeights": 9957110, + "xs": 8631.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 9798176, + "scale1fb": 0.8811309347705844, + "sumWeights": 9795366, + "xs": 8631.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4" + ] + }, + "fpo": 5, + "process_id": 8, + "resonant": false + }, + "GJets_HT-200To400": { + "2016": { + "metadata": { + "n_events": 20527506, + "scale1fb": 0.11107048269770327, + "sumWeights": 20527506, + "xs": 2280.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 18536907, + "scale1fb": 0.12308154071097405, + "sumWeights": 18524305, + "xs": 2280.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 17798742, + "scale1fb": 0.1281745764715664, + "sumWeights": 17788239, + "xs": 2280.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4" + ] + }, + "fpo": 5, + "process_id": 8, + "resonant": false + }, + "GJets_HT-400To600": { + "2016": { + "metadata": { + "n_events": 5060070, + "scale1fb": 0.053951822800870346, + "sumWeights": 5060070, + "xs": 273.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 4646958, + "scale1fb": 0.05883458387354831, + "sumWeights": 4640128, + "xs": 273.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 4655985, + "scale1fb": 0.05869757183410991, + "sumWeights": 4650959, + "xs": 273.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4" + ] + }, + "fpo": 5, + "process_id": 8, + "resonant": false + }, + "GJets_HT-600ToInf": { + "2016": { + "metadata": { + "n_events": 5080857, + "scale1fb": 0.018599224500906047, + "sumWeights": 5080857, + "xs": 94.5 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 3289629, + "scale1fb": 0.028828211012742678, + "sumWeights": 3278039, + "xs": 94.5 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 4981121, + "scale1fb": 0.019013835835145012, + "sumWeights": 4970065, + "xs": 94.5 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4" + ] + }, + "fpo": 5, + "process_id": 8, + "resonant": false + }, + "GJets_HT40To100": { + "2016": { + "metadata": { + "n_events": 9326139, + "scale1fb": 2.476909254730173, + "sumWeights": 9326139, + "xs": 23100.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 5570866, + "scale1fb": 4.146699083920573, + "sumWeights": 5570696, + "xs": 23100.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 7949891, + "scale1fb": 2.906092818591748, + "sumWeights": 7948817, + "xs": 23100.0 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4" + ] + }, + "fpo": 5, + "process_id": 8, + "resonant": false + }, + "TTGG": { + "2016": { + "metadata": { + "n_events": 1458516, + "scale1fb": 0.0006896963901506096, + "sumWeights": 25098, + "xs": 0.01731 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGG_0Jets_TuneCUETP8M1_13TeV_amcatnlo_madspin_pythia8_16____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 1496000, + "scale1fb": 0.0006709354120267261, + "sumWeights": 25144, + "xs": 0.01687 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGG_0Jets_TuneCP5_13TeV_amcatnlo_madspin_pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 1497000, + "scale1fb": 0.0006708820488348048, + "sumWeights": 25146, + "xs": 0.01687 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGG_0Jets_TuneCP5_13TeV_amcatnlo_madspin_pythia8_18____v4" + ] + }, + "fpo": 1, + "process_id": 7, + "resonant": false + }, + "TTGamma": { + "2016": { + "metadata": { + "n_events": 11994817, + "scale1fb": 4.649762230226128e-05, + "sumWeights": 82133232, + "xs": 3.819 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8_16____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8_16_2____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 13071164, + "scale1fb": 4.3821521198236424e-05, + "sumWeights": 93059298, + "xs": 4.078 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8_17____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8_17_2____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 4691915, + "scale1fb": 0.00012072678114336493, + "sumWeights": 33778752, + "xs": 4.078 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8_18____v4" + ] + }, + "fpo": 1, + "process_id": 6, + "resonant": false + }, + "TTbar": { + "2016": { + "metadata": { + "n_events": 22716086, + "scale1fb": 1.657386491711463e-05, + "sumWeights": 50185035546, + "xs": 831.76 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTJets_TuneCUETP8M2T4_13TeV-amcatnloFXFX-pythia8_16____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 144201384, + "scale1fb": 2.7922587217479924e-06, + "sumWeights": 297880706226, + "xs": 831.76 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 139357107, + "scale1fb": 2.846263798218455e-06, + "sumWeights": 292228710677, + "xs": 831.76 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8_18____v4" + ] + }, + "fpo": 5, + "process_id": 5, + "resonant": false + }, + "VH": { + "2016": { + "metadata": { + "n_events": 278811, + "scale1fb": 2.7494331979022683e-06, + "sumWeights": 1862202, + "xs": 0.00512 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/VHToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_16____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 565594, + "scale1fb": 1.2487284066932818e-06, + "sumWeights": 4100171, + "xs": 0.00512 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/VHToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 524379, + "scale1fb": 1.3472074652133666e-06, + "sumWeights": 3800454, + "xs": 0.00512 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/VHToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_18____v4" + ] + }, + "fpo": 1, + "process_id": 9, + "resonant": true + }, + "WGamma": { + "2016": { + "metadata": { + "n_events": 23382192, + "scale1fb": 8.50337056371383e-06, + "sumWeights": 22508721520, + "xs": 191.4 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16_2____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16_3____v4", + "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16____v4" + ] + }, + "2017": { + "metadata": { + "n_events": 23178863, + "scale1fb": 2.3134942145066795e-05, + "sumWeights": 8273199855, + "xs": 191.4 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_17____v4" + ] + }, + "2018": { + "metadata": { + "n_events": 26238127, + "scale1fb": 2.046923787200942e-05, + "sumWeights": 9350616823, + "xs": 191.4 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18____v4" + ] + }, + "fpo": 1, + "process_id": 4, + "resonant": false + }, + "ZGamma": { + "2016": { + "metadata": { + "n_events": 13502686, + "scale1fb": 1.7299984676849723e-05, + "sumWeights": 3213875679, + "xs": 55.6 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/ZGTo2LG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16____v4/" + ] + }, + "2017": { + "metadata": { + "n_events": 30400545, + "scale1fb": 1.6831325536518042e-05, + "sumWeights": 3303364306, + "xs": 55.6 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_17____v4/" + ] + }, + "2018": { + "metadata": { + "n_events": 39380131, + "scale1fb": 1.3005396262874823e-05, + "sumWeights": 4275148475, + "xs": 55.6 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18_2____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18_3____v4/", + "/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18____v4/" + ] + }, + "fpo": 1, + "process_id": 2, + "resonant": false + }, + "ttH": { + "2016": { + "metadata": { + "n_events": 414189, + "scale1fb": 2.8125621522831723e-06, + "sumWeights": 409277, + "xs": 0.001151117 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/ttHJetToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_17____v4/" + ] + }, + "2017": { + "metadata": { + "n_events": 414189, + "scale1fb": 2.8125621522831723e-06, + "sumWeights": 409277, + "xs": 0.001151117 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/ttHJetToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_17____v4/" + ] + }, + "2018": { + "metadata": { + "n_events": 260398, + "scale1fb": 4.374874581939799e-06, + "sumWeights": 263120, + "xs": 0.001151117 + }, + "paths": [ + "/hadoop/cms/store/user/legianni/ProjectMetis/ttHJetToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_18____v4/" + ] + }, + "fpo": 1, + "process_id": -1, + "resonant": true + } +} \ No newline at end of file diff --git a/Preselection/data/samples_ttH.json b/Preselection/data/samples_ttH.json new file mode 100644 index 0000000..940094a --- /dev/null +++ b/Preselection/data/samples_ttH.json @@ -0,0 +1,240 @@ +{ + "Data" : { + "resonant" : false, + "fpo" : 10, + "process_id" : 0, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016B-2____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016B____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016C____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016D____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016E____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016F____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016G____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2016H____v4/"], + "metadata" : {} + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017B____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017C____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017D____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017E____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/DoubleEG_Run2017F____v4/"], + "metadata" : {} + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018A____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018B____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018C____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/EGamma_Run2018D____v4/"], + "metadata" : {} + } + }, + "ZGamma" : { + "resonant" : false, + "fpo" : 1, + "process_id" : 2, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/ZGTo2LG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16____v4/"], + "metadata" : { "xs" : 55.6 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_17____v4/"], + "metadata" : { "xs" : 55.6 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18_2____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18_3____v4/", "/hadoop/cms/store/user/legianni/ProjectMetis/ZGToLLG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18____v4/"], + "metadata" : { "xs" : 55.6 } + } + }, + "DiPhoton" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 3, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/DiPhotonJetsBox_MGG-80toInf_13TeV-Sherpa_16____v4"], + "metadata" : { "xs" : 84.4 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/DiPhotonJetsBox_MGG-80toInf_13TeV-Sherpa_17____v4/"], + "metadata" : { "xs" : 84.4 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/DiPhotonJetsBox_MGG-80toInf_13TeV-Sherpa_18____v4/"], + "metadata" : { "xs" : 84.4 } + } + }, + "WGamma" : { + "resonant" : false, + "fpo" : 1, + "process_id" : 4, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16_2____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16_3____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_16____v4"], + "metadata" : { "xs" : 191.4 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_17____v4"], + "metadata" : { "xs" : 191.4 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/WGToLNuG_01J_5f_TuneCP5_13TeV-amcatnloFXFX-pythia8_18____v4"], + "metadata" : { "xs" : 191.4 } + } + }, + "TTbar" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 5, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTJets_TuneCUETP8M2T4_13TeV-amcatnloFXFX-pythia8_16____v4"], + "metadata" : { "xs" : 831.76 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8_17____v4"], + "metadata" : { "xs" : 831.76 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8_18____v4"], + "metadata" : { "xs" : 831.76 } + } + }, + "TTGamma" : { + "resonant" : false, + "fpo" : 1, + "process_id" : 6, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8_16____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8_16_2____v4"], + "metadata" : { "xs" : 3.819 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8_17____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8_17_2____v4"], + "metadata" : { "xs" : 4.078 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTGJets_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8_18____v4"], + "metadata" : { "xs" : 4.078 } + } + }, + "TTGG" : { + "resonant" : false, + "fpo" : 1, + "process_id" : 7, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTGG_0Jets_TuneCUETP8M1_13TeV_amcatnlo_madspin_pythia8_16____v4"], + "metadata" : { "xs" : 0.01731 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTGG_0Jets_TuneCP5_13TeV_amcatnlo_madspin_pythia8_17____v4"], + "metadata" : { "xs" : 0.01687 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/TTGG_0Jets_TuneCP5_13TeV_amcatnlo_madspin_pythia8_18____v4"], + "metadata" : { "xs" : 0.01687 } + } + }, + "GJets_HT40To100" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 8, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4"], + "metadata" : { "xs" : 23100.0 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4"], + "metadata" : { "xs" : 23100.0 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-40To100_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4"], + "metadata" : { "xs" : 23100.0 } + } + }, + "GJets_HT-100To200" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 8, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4"], + "metadata" : { "xs" : 8631.0 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4"], + "metadata" : { "xs" : 8631.0 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4"], + "metadata" : { "xs" : 8631.0 } + } + }, + "GJets_HT-200To400" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 8, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4"], + "metadata" : { "xs" : 2280.0 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4"], + "metadata" : { "xs" : 2280.0 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-200To400_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4"], + "metadata" : { "xs" : 2280.0 } + } + }, + "GJets_HT-400To600" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 8, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4"], + "metadata" : { "xs" : 273.0 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4"], + "metadata" : { "xs" : 273.0 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-400To600_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4"], + "metadata" : { "xs" : 273.0 } + } + }, + "GJets_HT-600ToInf" : { + "resonant" : false, + "fpo" : 5, + "process_id" : 8, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16____v4", "/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_16_2____v4"], + "metadata" : { "xs" : 94.5 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCP5_13TeV-madgraphMLM-pythia8_17____v4"], + "metadata" : { "xs" : 94.5 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/GJets_HT-600ToInf_TuneCP5_13TeV-madgraphMLM-pythia8_18____v4"], + "metadata" : { "xs" : 94.5 } + } + }, + "VH" : { + "resonant" : true, + "fpo" : 1, + "process_id" : 9, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/VHToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_16____v4"], + "metadata" : { "xs" : 0.00512 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/VHToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_17____v4"], + "metadata" : { "xs" : 0.00512 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/VHToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_18____v4"], + "metadata" : { "xs" : 0.00512 } + } + }, + "ttH" : { + "resonant" : true, + "fpo" : 1, + "process_id" : -1, + "2016" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/ttHJetToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_17____v4/"], + "metadata" : { "xs" : 0.001151117 } + }, + "2017" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/ttHJetToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_17____v4/"], + "metadata" : { "xs" : 0.001151117 } + }, + "2018" : { + "paths" : ["/hadoop/cms/store/user/legianni/ProjectMetis/ttHJetToGG_M125_13TeV_amcatnloFXFX_madspin_pythia8_18____v4/"], + "metadata" : { "xs" : 0.001151117 } + } + } +} diff --git a/Preselection/data/ttH_Leptonic.json b/Preselection/data/ttH_Leptonic.json new file mode 100644 index 0000000..ee07f2d --- /dev/null +++ b/Preselection/data/ttH_Leptonic.json @@ -0,0 +1,42 @@ +{ + "branches" : [ + "Photon_pt", "Photon_eta", "Photon_phi", "Photon_mass", "Photon_pixelSeed", "Photon_mvaID", "Photon_electronVeto", + "Muon_pt", "Muon_eta", "Muon_phi", "Muon_mass", "Muon_charge", "Muon_pfRelIso03_all", "Muon_dxy", "Muon_dz", + "Electron_pt", "Electron_eta", "Electron_phi", "Electron_mass", "Electron_charge", "Electron_mvaFall17V2Iso_WP90", "Electron_mvaFall17V2noIso_WP90", "Electron_pfRelIso03_all", "Electron_dxy", "Electron_dz", + "Jet_pt", "Jet_eta", "Jet_phi", "Jet_mass", "Jet_btagDeepFlavB", "Jet_jetId", + "ggMass", "nJet", "MET_pt", "genWeight", "tautauMassAll_SVFit" + ], + "save_branches" : [ + "ggMass", "nJet", "MET_pt", + "lead_pho_ptmgg", "sublead_pho_ptmgg", "lead_pho_eta", "sublead_pho_eta", "lead_pho_idmva", "sublead_pho_idmva", + "ele1_pt", "ele1_eta", "ele2_pt", "ele2_eta", + "muon1_pt", "muon1_eta", "muon2_pt", "muon2_eta", + "n_electrons", "n_muons" + ], + "selection_options" : { + "photons" : { + "idmva_cut" : -0.7 + }, + "electrons" : { + "pt" : 10.0, + "eta" : 2.4, + "ip_xy" : 0.045, + "ip_z" : 0.2, + "dR_pho" : 0.2 + }, + "muons" : { + "pt" : 5.0, + "eta" : 2.4, + "ip_xy" : 0.045, + "ip_z" : 0.2, + "rel_iso" : 0.3, + "dR_pho" : 0.2 + }, + "jets": { + "pt" : 25.0, + "eta" : 2.4, + "dR_pho" : 0.4, + "dR_lep" : 0.4 + } + } +} diff --git a/Preselection/helpers/loop_helper.py b/Preselection/helpers/loop_helper.py index 154ae9b..669241e 100644 --- a/Preselection/helpers/loop_helper.py +++ b/Preselection/helpers/loop_helper.py @@ -13,6 +13,7 @@ import selections.analysis_selections as analysis_selections import selections.lepton_selections as lepton_selections import selections.tau_selections as tau_selections +import selections.jet_selections as jet_selections class LoopHelper(): """ @@ -234,14 +235,17 @@ def select_events(self, events, metadata): events = analysis_selections.tth_leptonic_preselection(events, options, self.debug) events.Electron = events.Electron[lepton_selections.select_electrons(events, events.Photon, options, self.debug)] events.Muon = events.Muon[lepton_selections.select_muons(events, events.Photon, options, self.debug)] + events.Jet = events.Jet[jet_selections.select_jets(events, events.Photon, events.Electron, events.Muon, None, options, self.debug)] return events def trim_events(self, events, data): events = photon_selections.set_photons(events, self.debug) - events = lepton_selections.set_electrons(events, self.debug) - events = lepton_selections.set_muons(events, self.debug) - events = tau_selections.set_taus(events, self.debug) + if self.selections == "HHggTauTau_InclusivePresel" or self.selections == "ttH_LeptonicPresel": + events = lepton_selections.set_electrons(events, self.debug) + events = lepton_selections.set_muons(events, self.debug) + if self.selections == "HHggTauTau_InclusivePresel": + events = tau_selections.set_taus(events, self.debug) if data: branches = self.save_branches_data else: diff --git a/Preselection/selections/analysis_selections.py b/Preselection/selections/analysis_selections.py index 6944378..70a28d7 100644 --- a/Preselection/selections/analysis_selections.py +++ b/Preselection/selections/analysis_selections.py @@ -7,6 +7,7 @@ import selections.lepton_selections as lepton_selections import selections.tau_selections as tau_selections import selections.photon_selections as photon_selections +import selections.jet_selections as jet_selections def ggTauTau_inclusive_preselection(events, options, debug): cut_diagnostics = utils.CutDiagnostics(events = events, debug = debug, cut_set = "[analysis_selections.py : ggTauTau_inclusive_preselection]") @@ -42,18 +43,23 @@ def tth_leptonic_preselection(events, options, debug): cut_diagnostics = utils.CutDiagnostics(events = events, debug = debug, cut_set = "[analysis_selections.py : tth_leptonic_preselection]") # Get number of electrons, muons - n_electrons = awkward.num(events.Electron[lepton_selections.select_electrons(events, debug)]) - n_muons = awkward.num(events.Muon[lepton_selections.select_muons(events, debug)]) - + electron_selection = lepton_selections.select_electrons(events, events.Photon, options, debug) + muon_selection = lepton_selections.select_muons(events, events.Photon, options, debug) + + n_electrons = awkward.num(events.Electron[electron_selection]) + n_muons = awkward.num(events.Muon[muon_selection]) n_leptons = n_electrons + n_muons - # Get number of jets - #TODO - + jet_selection = jet_selections.select_jets(events, events.Photon, events.Electron[electron_selection], events.Muon[muon_selection], None, options, debug) + n_jets = awkward.num(events.Jet[jet_selection]) + lep_cut = n_leptons >= 1 - - events = events[lep_cut] - cut_diagnostics.add_cut(len(events), cut_name = "leptons >= 1 cut") + jet_cut = n_jets >= 1 + + all_cuts = lep_cut & jet_cut + cut_diagnostics.add_cuts([lep_cut, jet_cut, all_cuts], ["N_leptons >= 1", "N_jets >= 1", "all"]) + + events = events[all_cuts] return events diff --git a/Preselection/selections/jet_selections.py b/Preselection/selections/jet_selections.py new file mode 100644 index 0000000..aa1f1fa --- /dev/null +++ b/Preselection/selections/jet_selections.py @@ -0,0 +1,27 @@ +import awkward +import numpy +import numba + +import selections.selection_utils as utils +import selections.object_selections as object_selections + +def select_jets(events, photons, electrons, muons, taus, options, debug): + cut_diagnostics = utils.ObjectCutDiagnostics(objects = events.Jet, cut_set = "[jet_selections.py : select_jets]", debug = debug) + + pt_cut = events.Jet.pt > options["jets"]["pt"] + eta_cut = abs(events.Jet.eta) < options["jets"]["eta"] + + dR_pho_cut = object_selections.select_deltaR(events, events.Jet, photons, options["jets"]["dR_pho"], debug) + dR_ele_cut = object_selections.select_deltaR(events, events.Jet, electrons, options["jets"]["dR_lep"], debug) + dR_muon_cut = object_selections.select_deltaR(events, events.Jet, muons, options["jets"]["dR_lep"], debug) + + if taus is not None: + dR_tau_cut = object_selections.select_deltaR(events, events.Jet, taus, options["jets"]["dR_tau"], debug) + else: + dR_tau_cut = object_selections.select_deltaR(events, events.Jet, photons, 0.0, debug) # dummy cut of all True + + jet_cut = pt_cut & eta_cut & dR_pho_cut & dR_ele_cut & dR_muon_cut & dR_tau_cut + + cut_diagnostics.add_cuts([pt_cut, eta_cut, dR_pho_cut, dR_ele_cut, dR_muon_cut, dR_tau_cut, jet_cut], ["pt > 25", "|eta| < 2.4", "dR_photons", "dR_electrons", "dR_muons", "dR_taus", "all"]) + + return jet_cut diff --git a/Preselection/selections/lepton_selections.py b/Preselection/selections/lepton_selections.py index 6459e66..9fba0ac 100644 --- a/Preselection/selections/lepton_selections.py +++ b/Preselection/selections/lepton_selections.py @@ -5,8 +5,6 @@ import selections.selection_utils as utils import selections.object_selections as object_selections -DR_LEP_PHO = 0.2 - def select_electrons(events, photons, options, debug): cut_diagnostics = utils.ObjectCutDiagnostics(objects = events.Electron, cut_set = "[lepton_selections.py : select_electrons]", debug = debug) diff --git a/Preselection/selections/tau_selections.py b/Preselection/selections/tau_selections.py index 088e1ab..f7d3875 100644 --- a/Preselection/selections/tau_selections.py +++ b/Preselection/selections/tau_selections.py @@ -5,9 +5,6 @@ import selections.selection_utils as utils import selections.object_selections as object_selections -DR_TAU_PHO = 0.2 -DR_TAU_LEP = 0.2 - def select_taus(events, photons, muons, electrons, options, debug): cut_diagnostics = utils.ObjectCutDiagnostics(objects = events.Tau, cut_set = "[tau_selections.py : select_taus]", debug = debug)