diff --git a/Analysis/HiggsTauTauRun2/input/recoilfits/embed_fake_met_corrections.root b/Analysis/HiggsTauTauRun2/input/recoilfits/embed_fake_met_corrections.root new file mode 100644 index 000000000..d534f20af Binary files /dev/null and b/Analysis/HiggsTauTauRun2/input/recoilfits/embed_fake_met_corrections.root differ diff --git a/Analysis/HiggsTauTauRun2/interface/HTTCategories.h b/Analysis/HiggsTauTauRun2/interface/HTTCategories.h index e9a27458b..1bab69ad5 100644 --- a/Analysis/HiggsTauTauRun2/interface/HTTCategories.h +++ b/Analysis/HiggsTauTauRun2/interface/HTTCategories.h @@ -167,10 +167,17 @@ class HTTCategories : public ModuleBase { double newmet_dphi_1_; double newmet_dphi_2_; + double fake_met_dphi_1_; double fake_met_dphi_2_; double newmet_; double fake_met_; double gen_met_; + + double fake_tau_met_dphi_1_; + double fake_tau_met_dphi_2_; + double fake_tau_met_; + double gen_tau_met_; + double qcd_frac_score_, w_frac_score_; double w_frac_, qcd_frac_, ttbar_frac_; @@ -1064,12 +1071,7 @@ class HTTCategories : public ModuleBase { double gen_nu_eta_1_; double gen_nu_eta_2_; - double met_noscale_; double pf_met_; - double pf_met_fix_; - double met_fix_; - double pf_met_and_taus_; - double pf_met_and_taus_2_; public: HTTCategories(std::string const& name); diff --git a/Analysis/HiggsTauTauRun2/interface/HTTPairGenInfo.h b/Analysis/HiggsTauTauRun2/interface/HTTPairGenInfo.h index 44c7b2816..c57f62af8 100644 --- a/Analysis/HiggsTauTauRun2/interface/HTTPairGenInfo.h +++ b/Analysis/HiggsTauTauRun2/interface/HTTPairGenInfo.h @@ -6,7 +6,7 @@ #include "PhysicsTools/FWLite/interface/TFileService.h" #include "UserCode/ICHiggsTauTau/Analysis/Utilities/interface/HistoSet.h" #include "UserCode/ICHiggsTauTau/Analysis/HiggsTauTauRun2/interface/HTTConfig.h" - +#include "TGraph.h" #include @@ -18,9 +18,16 @@ class HTTPairGenInfo : public ModuleBase { CLASS_MEMBER(HTTPairGenInfo, fwlite::TFileService*, fs) CLASS_MEMBER(HTTPairGenInfo, bool, write_plots) CLASS_MEMBER(HTTPairGenInfo, bool, ngenjets) + CLASS_MEMBER(HTTPairGenInfo, bool, is_embedded) CLASS_MEMBER(HTTPairGenInfo, ic::channel, channel) + CLASS_MEMBER(HTTPairGenInfo, ic::era, era) std::vector hists_; + TFile *embed_corr_; + TGraph *gr_met_corr_; + TGraph *gr_met_corr_up_; + TGraph *gr_met_corr_down_; + public: HTTPairGenInfo(std::string const& name); virtual ~HTTPairGenInfo(); diff --git a/Analysis/HiggsTauTauRun2/scripts/HiggsTauTauPlot.py b/Analysis/HiggsTauTauRun2/scripts/HiggsTauTauPlot.py index bc7e0294f..53279a6de 100644 --- a/Analysis/HiggsTauTauRun2/scripts/HiggsTauTauPlot.py +++ b/Analysis/HiggsTauTauRun2/scripts/HiggsTauTauPlot.py @@ -402,10 +402,12 @@ # discrete x labels discrete_x_axis = False plot_var = options.var -discrete_x_labels = plot_var.split('[')[1].split(']')[0].split(',') -for i in discrete_x_labels: - if ">=" in i: - discrete_x_axis = True +discrete_x_labels=None +if '[' in plot_var and ']' in plot_var: + discrete_x_labels = plot_var.split('[')[1].split(']')[0].split(',') + for i in discrete_x_labels: + if ">=" in i: + discrete_x_axis = True if discrete_x_axis: run_bins = '[' @@ -1494,7 +1496,7 @@ data_samples = ['SingleMuonB','SingleMuonC','SingleMuonD','SingleMuonE','SingleMuonF','SingleMuonG','SingleMuonHv2','SingleMuonHv3'] if options.era == "legacy16": data_samples = ['SingleMuonB','SingleMuonC','SingleMuonD','SingleMuonE','SingleMuonF','SingleMuonG','SingleMuonH'] - if options.analysis=='mssmrun2': data_samples += ['TauB','TauC','TauD','TauE','TauF','TauG','TauH'] + if options.analysis=='mssmrun2' and options.channel == 'mt': data_samples += ['TauB','TauC','TauD','TauE','TauF','TauG','TauH'] if options.channel == 'em': data_samples = ['MuonEGB','MuonEGC','MuonEGD','MuonEGE','MuonEGF','MuonEGG','MuonEGHv2','MuonEGHv3'] if options.era == "legacy16": data_samples = ['MuonEGB','MuonEGC','MuonEGD','MuonEGE','MuonEGF','MuonEGG','MuonEGH'] @@ -1502,7 +1504,7 @@ data_samples = ['SingleElectronB','SingleElectronC','SingleElectronD','SingleElectronE','SingleElectronF','SingleElectronG','SingleElectronHv2','SingleElectronHv3'] if options.era == "legacy16": data_samples = ['SingleElectronB','SingleElectronC','SingleElectronD','SingleElectronE','SingleElectronF','SingleElectronG','SingleElectronH'] - if options.analysis=='mssmrun2': data_samples += ['TauB','TauC','TauD','TauE','TauF','TauG','TauH'] + if options.analysis=='mssmrun2' and options.channel == 'et': data_samples += ['TauB','TauC','TauD','TauE','TauF','TauG','TauH'] if options.channel == 'tt': data_samples = ['TauB','TauC','TauD','TauE','TauF','TauG','TauHv2','TauHv3'] if options.era == "legacy16": data_samples = ['TauB','TauC','TauD','TauE','TauF','TauG','TauH'] @@ -1588,12 +1590,13 @@ if options.channel in ['mt','zmm','mj']: data_samples = ['SingleMuonB','SingleMuonC','SingleMuonD','SingleMuonE','SingleMuonF'] - if options.analysis=='mssmrun2': data_samples += ['TauB','TauC','TauD','TauE','TauF'] + if options.analysis=='mssmrun2' and options.channel == 'mt': data_samples += ['TauB','TauC','TauD','TauE','TauF'] + if options.channel == 'em': data_samples = ['MuonEGB','MuonEGC','MuonEGD','MuonEGE','MuonEGF'] if options.channel == 'et' or options.channel == 'zee': data_samples = ['SingleElectronB','SingleElectronC','SingleElectronD','SingleElectronE','SingleElectronF'] - if options.analysis=='mssmrun2': data_samples += ['TauB','TauC','TauD','TauE','TauF'] + if options.analysis=='mssmrun2' and options.channel == 'et': data_samples += ['TauB','TauC','TauD','TauE','TauF'] if options.channel == 'tt': data_samples = ['TauB','TauC','TauD','TauE','TauF'] @@ -1637,12 +1640,12 @@ if options.channel in ['mt','zmm','mj']: data_samples = ['SingleMuonA','SingleMuonB','SingleMuonC','SingleMuonD'] - if options.analysis=='mssmrun2': data_samples += ['TauA','TauB','TauC','TauD'] + if options.analysis=='mssmrun2' and options.channel == 'mt': data_samples += ['TauA','TauB','TauC','TauD'] if options.channel == 'em': data_samples = ['MuonEGA','MuonEGB','MuonEGC','MuonEGD'] if options.channel == 'et' or options.channel == 'zee': data_samples = ['EGammaA','EGammaB','EGammaC','EGammaD'] - if options.analysis=='mssmrun2': data_samples += ['TauA','TauB','TauC','TauD'] + if options.analysis=='mssmrun2' and options.channel == 'et': data_samples += ['TauA','TauB','TauC','TauD'] if options.channel == 'tt': data_samples = ['TauA','TauB','TauC','TauD'] @@ -2690,15 +2693,9 @@ def GetEmbeddedNode(ana, add_name='', samples=[], plot='', wt='', sel='', cat='' if get_os: OSSS = 'os' else: OSSS = '!os' wt_ = wt - #wt_+='*((pt_2>100)*0.93*0.93/(idisoweight_1*idisoweight_2) + (pt_1>100&&pt_2<100)*0.93/idisoweight_1 + (pt_1<100))' - #if options.channel == 'et': wt_+='*(((tau_decay_mode_2==0)*0.975 + (tau_decay_mode_2==1)*0.975*1.051 + (tau_decay_mode_2==10)*0.927 + (tau_decay_mode_2==11)*0.926*1.051)*0.965600)/idisoweight_2' - #if options.channel == 'et': wt_+='*((pt_2>=40)*(0.983) + (pt_2<40)*(1.018))/idisoweight_2' - #if options.channel == 'mt': wt_+='*((pt_2>=40)*(0.983) + (pt_2<40)*(1.018))/idisoweight_2' -#'*0.98' # this is a tempoary fix for the different rates at which embedded taus pass the tight anti electron discriminator! -# if options.channel == 'et': wt_+='*((fabs(eta_1)<1.479) + (fabs(eta_1)>=1.479)/1.16)'#'*0.98' # this is a tempoary fix for the different rates at which embedded taus pass the tight anti electron discriminator! -# if options.channel == 'em' and options.era in ['cpsummer16','cpdecay16',"legacy16",'mvadm2016']: wt_+='*1.05' -# elif options.channel != 'em' and options.era in ['cpsummer16','cpdecay16',"legacy16",'mvadm2016']: wt_+='*1.05' -# elif options.era == 'cpsummer17': wt_+='*0.97' + if options.analysis=='mssmrun2': + if options.channel == 'tt': wt_+='*(pt_1/gen_match_1_pt<1.5&&pt_2/gen_match_2_pt<1.5)' + if options.channel in ['et','mt']: wt_+='*(pt_2/gen_match_2_pt<1.5)' if options.channel == 'em': #for em channel there are non-closures wrt data and MC which are corrected here with these additional correction factors if options.era in ['cpsummer16','cpdecay16',"legacy16",'mvadm2016']: wt_+='*1.106' @@ -4131,9 +4128,9 @@ def RunPlotting(ana, cat='',cat_data='', sel='', add_name='', wt='wt', do_data=T residual_cat=cat+"&&"+add_fake_factor_selection if 'EmbedZTT' not in samples_to_skip and options.embedding: GenerateEmbedded(ana, add_name, embed_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss) - if do_data: GenerateZTT(ana, add_name, ztt_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss) + if do_data: GenerateZTT(ana, add_name, ztt_samples+top_samples+vv_samples+ewkz_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss) if 'ZTT' not in samples_to_skip and not options.embedding: - GenerateZTT(ana, add_name, ztt_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss) + GenerateZTT(ana, add_name, ztt_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss) if 'ZLL' not in samples_to_skip: GenerateZLL(ana, add_name, zll_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss,doZL,False) if 'TT' not in samples_to_skip: @@ -4142,8 +4139,8 @@ def RunPlotting(ana, cat='',cat_data='', sel='', add_name='', wt='wt', do_data=T GenerateVV(ana, add_name, vv_samples, plot, wt, sel, residual_cat, vv_sels, not options.do_ss, doVVT, doVVJ) #if 'EWKZ' not in samples_to_skip and options.era in ['smsummer16','cpsummer16','cpdecay16',"legacy16",'tauid2016','cpsummer17','tauid2017','cp18','mvadm2016']: #GenerateEWKZ(ana, add_name, ewkz_samples, plot, wt, sel, residual_cat, z_sels, not options.do_ss) - #if 'ggH_hww' not in samples_to_skip and 'qqH_hww' not in samples_to_skip and options.analysis == 'cpprod': - # GenerateHWW(ana, add_name, gghww_samples, qqhww_samples, plot, wt, sel, cat, not options.do_ss, True, True) + if 'ggH_hww' not in samples_to_skip and 'qqH_hww' not in samples_to_skip and options.analysis == 'cpprod': + GenerateHWW(ana, add_name, gghww_samples, qqhww_samples, plot, wt, sel, cat, not options.do_ss, True, True) if 'W' not in samples_to_skip and options.channel=='tt' and options.analysis in ['cpprod','cpdecay','mssmrun2'] and 'VV' not in samples_to_skip and 'ZTT' not in samples_to_skip: GenerateW(ana, 'fakes'+add_name, ztt_samples+vv_samples+wjets_samples+ewkz_samples+top_samples, data_samples, wgam_samples, plot, plot_unmodified, wt, sel+'&&gen_match_1!=6&&gen_match_2==6', cat, cat_data, 8, qcd_os_ss_ratio, not options.do_ss) if options.channel in ['mt','et']: @@ -4846,7 +4843,7 @@ def MergeXBins(hist): outfile.Close() - +if options.do_unrolling==0: exit(0) if is_2d and not options.do_unrolling: exit(0) # add options for is_3d as well! plot_file = ROOT.TFile(output_name, 'READ') diff --git a/Analysis/HiggsTauTauRun2/scripts/config_mssm_2016.json b/Analysis/HiggsTauTauRun2/scripts/config_mssm_2016.json index 1eba368a4..82aaaf807 100644 --- a/Analysis/HiggsTauTauRun2/scripts/config_mssm_2016.json +++ b/Analysis/HiggsTauTauRun2/scripts/config_mssm_2016.json @@ -4,8 +4,8 @@ "file_prefix" : "root://gfe02.grid.hep.ph.ic.ac.uk:1097/store/user/guttley/Sep18_MC_102X_2016/", "max_events": -1, "timings": true, - "channels": ["tt","mt","et"], - //"channels": ["et"], + "channels": ["em","mt","et","tt"], + //"channels": ["tt"], "sequences": { "all": ["default"] //,"scale_met_high,""scale_met_lo","res_met_high","res_met_lo"] @@ -59,7 +59,8 @@ "do_ff_systematics": false, "do_pdf_wts": false, "do_qcd_scale_wts": false, - "output_folder" : "/vols/cms/gu18/Offline/output/MSSM/mssm_2016_v7/", + "output_folder" : "/vols/cms/dw515/Offline/output/MSSM/mssm_2016_v7_embed_met_fix/", + //"output_folder" : "output/", "svfit_from_grid" : true, "read_all_svfit_files" : true, "svfit_folder" : "/vols/cms/gu18/Offline/output/SUSY/Jan24_2016_svfit_output/", diff --git a/Analysis/HiggsTauTauRun2/scripts/config_mssm_2017.json b/Analysis/HiggsTauTauRun2/scripts/config_mssm_2017.json index 45d463e06..0059e3d9f 100644 --- a/Analysis/HiggsTauTauRun2/scripts/config_mssm_2017.json +++ b/Analysis/HiggsTauTauRun2/scripts/config_mssm_2017.json @@ -4,8 +4,8 @@ "file_prefix" : "root://gfe02.grid.hep.ph.ic.ac.uk:1097/store/user/dwinterb/Sep18_MC_102X_2017/", "max_events": -1, "timings": true, - "channels": ["tt","mt","et"], - //"channels": ["et"], + "channels": ["em","et","mt","tt"], + //"channels": ["tt"], "sequences": { "all": ["default"] //,"scale_met_high,""scale_met_lo","res_met_high","res_met_lo"] @@ -60,7 +60,7 @@ "do_pdf_wts": false, "do_qcd_scale_wts": false, //"output_folder" : "output/", - "output_folder" : "/vols/cms/gu18/Offline/output/MSSM/mssm_2017_v7/", + "output_folder" : "/vols/cms/dw515/Offline/output/MSSM/mssm_2017_v7_embed_met_fix/", "svfit_from_grid" : true, "read_all_svfit_files" : true, "svfit_folder" : "/vols/cms/gu18/Offline/output/SUSY/Jan24_2017_svfit_output/", @@ -71,7 +71,7 @@ "svfit_override" : "", "mela_folder" : "/vols/cms/dw515/Offline/output/SM/Mar19_MELA/", "mela_mode" : 0, - // "event_check_file":"checkfile.dat", + //"event_check_file":"checkfile.dat", "pu_id_training": 4, "bjet_regr_correction" : false, "new_svfit_mode" : 0, diff --git a/Analysis/HiggsTauTauRun2/scripts/config_mssm_2018.json b/Analysis/HiggsTauTauRun2/scripts/config_mssm_2018.json index a3a28dae4..028f71edd 100644 --- a/Analysis/HiggsTauTauRun2/scripts/config_mssm_2018.json +++ b/Analysis/HiggsTauTauRun2/scripts/config_mssm_2018.json @@ -4,8 +4,8 @@ "file_prefix" : "root://gfe02.grid.hep.ph.ic.ac.uk:1097/store/user/guttley/Sep18_MC_102X_2018/", "max_events": -1, "timings": true, - "channels": ["tt","mt","et"], - //"channels": ["et"], + "channels": ["et","mt","em","tt"], + //"channels": ["tt"], "sequences": { "all": ["default"] //,"scale_met_high,""scale_met_lo","res_met_high","res_met_lo"] @@ -64,7 +64,8 @@ "do_ff_systematics": false, "do_pdf_wts": false, "do_qcd_scale_wts": false, - "output_folder" : "/vols/cms/gu18/Offline/output/MSSM/mssm_2018_v7/", + //"output_folder" : "output/", + "output_folder" : "/vols/cms/dw515/Offline/output/MSSM/mssm_2018_v7_embed_met_fix/", "svfit_from_grid" : true, "read_all_svfit_files" : true, "svfit_folder" : "/vols/cms/gu18/Offline/output/SUSY/Jan24_2018_svfit_output/", diff --git a/Analysis/HiggsTauTauRun2/scripts/control_plots_ff_tt.py b/Analysis/HiggsTauTauRun2/scripts/control_plots_ff_tt.py index 7847302e3..a07b1b7a1 100644 --- a/Analysis/HiggsTauTauRun2/scripts/control_plots_ff_tt.py +++ b/Analysis/HiggsTauTauRun2/scripts/control_plots_ff_tt.py @@ -1,7 +1,7 @@ import os #years = ['2016','2017']#,'2018'] -years = ['2017']#,'2018'] +years = ['2016'] variables = [ 'met[0,10,20,30,40,50,60,70,80,90,100,120,140,200,400]', @@ -10,10 +10,11 @@ 'n_deepbjets(4,0,4)', 'pt_1[40,45,50,55,60,65,70,80,90,100,120,140,200,400]', 'pt_2[40,45,50,55,60,65,70,80,90,100,120,140,200,400]', - #'mt_1(20,0,200)', - #'mt_2(20,0,200)', - #'mt_lep(20,0,200)', + 'mt_1(30,0,300)', + 'mt_2(30,0,300)', + 'mt_lep(30,0,300)', 'm_vis(50,0,500)', + 'met_dphi_1(20,0,3.1415927)', 'mt_tot[80,100,120,140,160,180,200,250,300,350,400,500,700,3900]' ] diff --git a/Analysis/HiggsTauTauRun2/scripts/control_plots_tt.py b/Analysis/HiggsTauTauRun2/scripts/control_plots_tt.py index e3c9c95df..4545125c0 100644 --- a/Analysis/HiggsTauTauRun2/scripts/control_plots_tt.py +++ b/Analysis/HiggsTauTauRun2/scripts/control_plots_tt.py @@ -4,11 +4,9 @@ #years = ['2017'] variables = [ - 'mt_tot[80,100,120,140,160,180,200,250,300,350,400,500,700,3900]', + 'met[0,10,20,30,40,50,60,70,80,90,100,120,140,200,400]', - #'n_jets(4,0,4)', - #'n_prebjets(4,0,4)', - 'n_deepbjets(4,0,4)', + 'n_jets(4,0,4)', 'pt_1[40,45,50,55,60,65,70,80,90,100,120,140,200,400]', 'pt_2[40,45,50,55,60,65,70,80,90,100,120,140,200,400]', 'mt_1(30,0,300)', @@ -17,8 +15,9 @@ 'm_vis(50,0,500)', 'met_dphi_1(20,0,3.1415927)', 'met_dphi_2(20,0,3.1415927)', + 'mt_tot[50,60,70,80,100,120,140,160,180,200,250,300,350,400,500,700,900,3900]', 'dphi(20,0,3.1415927)', - #'mt_tot[80,100,120,140,160,180,200,250,300,350,400,500,700,3900]' + 'n_deepbjets(4,0,4)', ] @@ -40,7 +39,7 @@ extra+=' --ratio_range=\"0.6,1.4\" ' # add systematic bands - extra += ' --do_custom_uncerts --add_stat_to_syst --syst_tau_trg_diff="trg_syst_*" --syst_tau_id_diff="id_syst_*" --do_ff_systs --syst_tquark="syst_ttbar_pt" --syst_embedding_tt="syst_embed_tt" --syst_tau_scale_grouped="tes_*group" ' + extra += ' --do_custom_uncerts --add_stat_to_syst --syst_tau_trg_diff="trg_syst_*" --syst_tau_id_diff="id_syst_*" --do_ff_systs --syst_tquark="syst_ttbar_pt" --syst_embedding_tt="syst_embed_tt" ' #--syst_tau_scale_grouped="tes_*group" ' os.system('python scripts/HiggsTauTauPlot.py --cfg=scripts/plot_mssm_%(yp)s.cfg --method=17 --channel=tt --var=\"%(v_tt)s\" --outputfolder=mssm_control/ %(extra)s --embedding ' % vars()) os.system('python scripts/HiggsTauTauPlot.py --cfg=scripts/plot_mssm_%(yp)s.cfg --method=17 --channel=tt --var=\"%(v_tt)s\" --outputfolder=mssm_control/ %(extra)s --datacard=mc ' % vars()) diff --git a/Analysis/HiggsTauTauRun2/scripts/hadd_legacy16_output.py b/Analysis/HiggsTauTauRun2/scripts/hadd_legacy16_output.py index 33eca974e..3df9a38e3 100755 --- a/Analysis/HiggsTauTauRun2/scripts/hadd_legacy16_output.py +++ b/Analysis/HiggsTauTauRun2/scripts/hadd_legacy16_output.py @@ -329,7 +329,7 @@ def list_paths(path): print sample_list #channel = ['em','et','mt','tt','zee','zmm','wmnu','tpzee','tpzmm','tpmt','tpem'] -channel = ['et','em','mt','tt'] +channel = ['et','em','mt','tt','zmm'] with open("%(samplelist)s"%vars(),"r") as inf: lines = inf.readlines() diff --git a/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer17_output.py b/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer17_output.py index 0e4abf5fd..32526ca6e 100755 --- a/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer17_output.py +++ b/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer17_output.py @@ -321,7 +321,7 @@ def list_paths(path): sample_list = list(set(sample_list)) # channel = ['em','et','mt','tt','zee','zmm','wmnu','tpzee','tpzmm','tpmt','tpem'] -channel = ['et','em','mt','tt'] +channel = ['et','em','mt','tt','zmm'] with open("%(samplelist)s"%vars(),"r") as inf: lines = inf.readlines() diff --git a/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer18_output.py b/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer18_output.py index acae0e20e..f5416c019 100755 --- a/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer18_output.py +++ b/Analysis/HiggsTauTauRun2/scripts/hadd_smsummer18_output.py @@ -298,9 +298,10 @@ def list_paths(path): 'ttHToTauTau', ] + sample_list = list(set(sample_list)) -channel = ['tt','mt','et','em'] +channel = ['tt','mt','et','em','zmm'] with open("%(samplelist)s"%vars(),"r") as inf: lines = inf.readlines() @@ -391,7 +392,3 @@ def FindMissingFiles(outf, d, samp, chan, infiles): if remove: file.write("\n%s" % rm_command) file.write('\nEnd of job') os.system('%(JOBSUBMIT)s %(JOB)s' % vars()) - if not batch and remove: - # if all channels and systematics were hadded sucsessfully then remove the input files - for x in to_remove: - os.system(x) diff --git a/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2016.py b/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2016.py index 551b2dade..16326cab9 100755 --- a/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2016.py +++ b/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2016.py @@ -317,7 +317,7 @@ def getParaJobSubmit(N): - EMBEDFILELISTZMM="./filelists/Sep18_MC_102X_2016" + EMBEDFILELISTZMM="./filelists/Sep18_2016_MC_102X" EMBEDFILELIST="./filelists/Sep18_2016_MC_102X" diff --git a/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2018.py b/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2018.py index b3f914c90..6e2af5a59 100755 --- a/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2018.py +++ b/Analysis/HiggsTauTauRun2/scripts/htt_mssm_2018.py @@ -136,6 +136,7 @@ def getParaJobSubmit(N): output.close() input.close() +n_channels=4 with open("config_for_python_channels.json") as config_file: cfg = json.load(config_file) n_channels=len(cfg["job"]["channels"]) @@ -360,7 +361,7 @@ def getParaJobSubmit(N): nperjob = 300 if n_scales*n_channels>=28: nperjob = 150 if n_scales*n_channels>=56: nperjob=75 - if 'MuTau' in sa: nperjob = int(math.ceil(float(nperjob)/5)) + if 'MuTau' in sa: nperjob = int(math.ceil(float(nperjob)/10)) if 'ElTau' in sa and 'ElTauD' not in sa: nperjob = int(math.ceil(float(nperjob)/5)) # nperjob = int(math.ceil(float(nperjob)/max(1.,float(n_scales-8)*float(n_channels)/10.))) nfiles = sum(1 for line in open('%(EMBEDFILELIST)s_%(sa)s.dat' % vars())) @@ -449,6 +450,7 @@ def getParaJobSubmit(N): if options.jetmetuncerts and 'default' in FLATJSONPATCH: nperjob = int(math.ceil(float(nperjob)/2)) #if 'TTTo' in sa: nperjob = int(math.ceil(float(nperjob)/2)) + if 'TTTo' in sa: nperjob = int(math.ceil(float(nperjob)/2)) #nperjob = int(math.ceil(float(nperjob)/max(1.,float(n_scales)*float(n_channels)/10.))) nfiles = sum(1 for line in open('%(FILELIST)s_%(sa)s.dat' % vars())) for i in range (0,int(math.ceil(float(nfiles)/float(nperjob)))) : diff --git a/Analysis/HiggsTauTauRun2/scripts/htt_smsummer18.py b/Analysis/HiggsTauTauRun2/scripts/htt_smsummer18.py index 25173ba1a..05d2b7a96 100755 --- a/Analysis/HiggsTauTauRun2/scripts/htt_smsummer18.py +++ b/Analysis/HiggsTauTauRun2/scripts/htt_smsummer18.py @@ -246,7 +246,7 @@ def getParaJobSubmit(N): 'ZHiggs0PHToTauTau', 'ZHiggs0PHf05ph0ToTauTau', 'ZHiggs0PMToTauTau', - 'VBFHToTauTau_M125_withDipoleRecoil' + 'VBFHToTauTau_M125_withDipoleRecoil' ] diff --git a/Analysis/HiggsTauTauRun2/src/HTTCategories.cc b/Analysis/HiggsTauTauRun2/src/HTTCategories.cc index e44501b59..964caa91a 100644 --- a/Analysis/HiggsTauTauRun2/src/HTTCategories.cc +++ b/Analysis/HiggsTauTauRun2/src/HTTCategories.cc @@ -850,11 +850,6 @@ namespace ic { outtree_->Branch("extramuon_veto", &extramuon_veto_); outtree_->Branch("met", &met_.var_double); outtree_->Branch("pf_met", &pf_met_); - outtree_->Branch("pf_met_fix", &pf_met_fix_); - outtree_->Branch("pf_met_and_taus", &pf_met_and_taus_); - outtree_->Branch("pf_met_and_taus_2", &pf_met_and_taus_2_); - outtree_->Branch("met_fix", &met_fix_); - outtree_->Branch("met_noscale", &met_noscale_); outtree_->Branch("n_jets", &n_jets_); outtree_->Branch("n_bjets", &n_bjets_); outtree_->Branch("n_deepbjets", &n_deepbjets_); @@ -970,14 +965,23 @@ namespace ic { outtree_->Branch("beta_2", &beta_2_.var_float); outtree_->Branch("bcsv_1", &bcsv_1_.var_float); outtree_->Branch("bcsv_2", &bcsv_2_); + outtree_->Branch("uncorrmet", &uncorrmet_.var_float, "met/F"); + outtree_->Branch("uncorrmetphi", &uncorrmet_phi_.var_float, "met_phi/F"); outtree_->Branch("met_dphi_1", &met_dphi_1_); outtree_->Branch("met_dphi_2", &met_dphi_2_); outtree_->Branch("newmet_dphi_1", &newmet_dphi_1_); outtree_->Branch("newmet_dphi_2", &newmet_dphi_2_); + outtree_->Branch("fake_met_dphi_1", &fake_met_dphi_1_); outtree_->Branch("fake_met_dphi_2", &fake_met_dphi_2_); outtree_->Branch("newmet", &newmet_); outtree_->Branch("fake_met", &fake_met_); outtree_->Branch("gen_met", &gen_met_); + + outtree_->Branch("fake_tau_met_dphi_1", &fake_tau_met_dphi_1_); + outtree_->Branch("fake_tau_met_dphi_2", &fake_tau_met_dphi_2_); + outtree_->Branch("fake_tau_met", &fake_tau_met_); + outtree_->Branch("gen_tau_met", &gen_tau_met_); + outtree_->Branch("qcd_frac_score", &qcd_frac_score_); outtree_->Branch("w_frac_score", &w_frac_score_); @@ -2553,10 +2557,22 @@ namespace ic { newmet_dphi_2_=std::fabs(ROOT::Math::VectorUtil::DeltaPhi(newmet->vector(),lep2->vector())); ROOT::Math::PtEtaPhiEVector fake_met_vec; event->Exists("fake_met_vec") ? fake_met_vec = event->Get("fake_met_vec") : fake_met_vec; + fake_met_dphi_1_=std::fabs(ROOT::Math::VectorUtil::DeltaPhi(fake_met_vec,lep1->vector())); fake_met_dphi_2_=std::fabs(ROOT::Math::VectorUtil::DeltaPhi(fake_met_vec,lep2->vector())); + + + ROOT::Math::PtEtaPhiEVector fake_tau_met_vec; + event->Exists("fake_tau_met_vec") ? fake_tau_met_vec = event->Get("fake_tau_met_vec") : fake_tau_met_vec; + fake_tau_met_dphi_1_=std::fabs(ROOT::Math::VectorUtil::DeltaPhi(fake_tau_met_vec,lep1->vector())); + fake_tau_met_dphi_2_=std::fabs(ROOT::Math::VectorUtil::DeltaPhi(fake_tau_met_vec,lep2->vector())); + event->Exists("fake_met") ? fake_met_ = event->Get("fake_met") : 0.; - event->Exists("fake_met") ? gen_met_ = event->Get("gen_met") : 0.; + event->Exists("gen_met") ? gen_met_ = event->Get("gen_met") : 0.; + + event->Exists("fake_tau_met") ? fake_tau_met_ = event->Get("fake_tau_met") : 0.; + event->Exists("gen_tau_met") ? gen_tau_met_ = event->Get("gen_tau_met") : 0.; + if(channel_ == channel::zmm || channel_ == channel::zee) pt_tt_ = (ditau->vector()).pt(); m_vis_ = ditau->M(); pt_vis_ = ditau->pt(); @@ -2569,6 +2585,11 @@ namespace ic { met_dphi_1_ = std::fabs(ROOT::Math::VectorUtil::DeltaPhi(mets->vector(),lep1->vector())); met_dphi_2_ = std::fabs(ROOT::Math::VectorUtil::DeltaPhi(mets->vector(),lep2->vector())); + + + + + mt_1_ = MT(lep1, mets); mt_2_ = MT(lep2, mets); mt_tot_ = sqrt(pow(mt_lep_.var_double,2)+pow(mt_2_.var_double,2)+pow(mt_1_.var_double,2)); @@ -2621,11 +2642,10 @@ namespace ic { if (event->Exists("met_norecoil")) uncorrmet_ = event->Get("met_norecoil"); uncorrmet_phi_ = met_phi_; if (event->Exists("met_phi_norecoil")) uncorrmet_phi_ = event->Get("met_phi_norecoil"); - if (event->Exists("met_noscale")) met_noscale_ = event->Get("met_noscale"); - else met_noscale_ = met_.var_double; + std::vector pfMet_vec = event->GetPtrVec("pfMetFromSlimmed"); pf_met_ = pfMet_vec[0]->pt(); - Met *pf_met = pfMet_vec[0]; + metCov00_ = mets->xx_sig(); metCov10_ = mets->yx_sig(); @@ -2836,7 +2856,6 @@ namespace ic { } else { tau_decay_mode_2_ = 0; } - //std::cout << tau_decay_mode_2_ << std::endl; n_jets_ = jets.size(); n_lowpt_jets_ = lowpt_jets.size(); @@ -2879,37 +2898,7 @@ namespace ic { if(jets.size() > 0) { jet_flav_3_ = jets[0]->parton_flavour(); } else jet_flav_3_ = -9999; - - ROOT::Math::PxPyPzEVector shift = shift_after - shift_before; - - ROOT::Math::PxPyPzEVector shift_taus = (ROOT::Math::PxPyPzEVector)(lep1->vector() + lep2->vector()); - - Met * puppi_met = new Met(); - - //std::cout << "!!!!!!!" << std::endl; - puppi_met->set_vector(mets->vector()); - //std::cout << puppi_met->vector().Px() << " " << puppi_met->vector().Py() << std::endl; - //std::cout << shift.Px() << " " << shift.Py() << std::endl; - //std::cout << shift_before.Px() << " " << shift_before.Py() << std::endl; - // undo jec corrections for jets matched to taus - - Met * pfmet_new = new Met(); - pfmet_new->set_vector(pf_met->vector()); - this->CorrectMETForShift(pfmet_new, shift_taus); - pf_met_and_taus_ = pfmet_new->pt(); - - this->CorrectMETForShift(pfmet_new, -shift_taus); - this->CorrectMETForShift(pfmet_new, -shift_taus); - pf_met_and_taus_2_ = pfmet_new->pt(); - - this->CorrectMETForShift(puppi_met, shift); - this->CorrectMETForShift(pf_met, shift); - //std::cout << puppi_met->vector().Px() << " " << puppi_met->vector().Py() << std::endl; - //std::cout << met_.var_double << " " << mets->pt() << " " << puppi_met->pt() << std::endl; - met_fix_ = puppi_met->pt(); - pf_met_fix_ = pf_met->pt(); - //std::cout << pt_1_.var_double << " " << jet_pt_1_ << " " << pt_2_.var_double << " " << jet_pt_2_ << std::endl; if (n_lowpt_jets_ >= 1) { jpt_1_ = lowpt_jets[0]->pt(); diff --git a/Analysis/HiggsTauTauRun2/src/HTTPairGenInfo.cc b/Analysis/HiggsTauTauRun2/src/HTTPairGenInfo.cc index 79b968cc5..f297f4be1 100644 --- a/Analysis/HiggsTauTauRun2/src/HTTPairGenInfo.cc +++ b/Analysis/HiggsTauTauRun2/src/HTTPairGenInfo.cc @@ -32,12 +32,13 @@ TVector3 GenIP (ic::GenParticle *h, ic::GenParticle *t) { return gen_ip; } - HTTPairGenInfo::HTTPairGenInfo(std::string const& name) : ModuleBase(name), channel_(channel::mt) { + HTTPairGenInfo::HTTPairGenInfo(std::string const& name) : ModuleBase(name), channel_(channel::mt), era_(era::data_2018) { ditau_label_ = "ditau"; fs_ = NULL; write_plots_ = false; hists_.resize(1); ngenjets_=false; + is_embedded_=false; } HTTPairGenInfo::~HTTPairGenInfo() { @@ -55,6 +56,31 @@ TVector3 GenIP (ic::GenParticle *h, ic::GenParticle *t) { } } + if(is_embedded_&& (channel_==channel::em || channel_==channel::et || channel_==channel::mt || channel_==channel::tt) && (era_ == era::data_2016 || era_ == era::data_2017 || era_ == era::data_2018)) { + + // Retrieve file with TGraphs of corrections + std::string file = "input/recoilfits/embed_fake_met_corrections.root"; + embed_corr_ = new TFile(file.c_str()); + embed_corr_->cd(); + std::string graph_name = "rms_corr"; + if(channel_==channel::em) graph_name+="_em"; + if(channel_==channel::et) graph_name+="_et"; + if(channel_==channel::mt) graph_name+="_mt"; + if(channel_==channel::tt) graph_name+="_tt"; + + + if(era_ == era::data_2016) graph_name+="_2016"; + if(era_ == era::data_2017) graph_name+="_2017"; + if(era_ == era::data_2018) graph_name+="_2018"; + + gr_met_corr_ = (TGraph*)gDirectory->Get(graph_name.c_str()); + std::cout << "Input TGraph for embedded MET correction: " << graph_name << std::endl; + //gr_met_corr_up_ = (TGraph*)gDirectory->Get((graph_name+"_up").c_str()); + //gr_met_corr_down_ = (TGraph*)gDirectory->Get((graph_name+"_down").c_str()); + + embed_corr_->Close(); + } + return 0; } @@ -78,6 +104,9 @@ TVector3 GenIP (ic::GenParticle *h, ic::GenParticle *t) { double gen_match_undecayed_1_eta = -1; double gen_match_undecayed_2_eta = -1; double gen_met=0.; + GenParticle *gen_match_undecayed_1_; + GenParticle *gen_match_undecayed_2_; + TVector3 gen_ip_1(0.,0.,0.); TVector3 gen_ip_2(0.,0.,0.); @@ -85,38 +114,62 @@ TVector3 GenIP (ic::GenParticle *h, ic::GenParticle *t) { GenParticle *h = new GenParticle(); ROOT::Math::PtEtaPhiEVector neutrinos; + ROOT::Math::PtEtaPhiEVector tau_neutrinos; for (unsigned i=0; i < particles.size(); ++i){ std::vector status_flags_start = particles[i]->statusFlags(); if ( ((abs(particles[i]->pdgid()) == 11 )||(abs(particles[i]->pdgid()) == 13 /*&& particles[i]->status()==1*/)) && particles[i]->pt() > 8. && (status_flags_start[IsPrompt] || status_flags_start[IsDirectPromptTauDecayProduct] /*|| status_flags_start[IsDirectHadronDecayProduct]*/)){ sel_particles.push_back(particles[i]); } - if ( ((abs(particles[i]->pdgid()) == 12 )||(abs(particles[i]->pdgid()) == 14 /*&& particles[i]->status()==1*/)||(abs(particles[i]->pdgid()) == 16)) && particles[i]->pt() > 8. && (status_flags_start[IsPrompt] || status_flags_start[IsDirectPromptTauDecayProduct] /*|| status_flags_start[IsDirectHadronDecayProduct]*/)) neutrinos+=particles[i]->vector(); + if ( ((abs(particles[i]->pdgid()) == 12 )||(abs(particles[i]->pdgid()) == 14)||(abs(particles[i]->pdgid()) == 16)) && (status_flags_start[IsPrompt] || status_flags_start[IsDirectPromptTauDecayProduct] /*|| status_flags_start[IsDirectHadronDecayProduct]*/)) neutrinos+=particles[i]->vector(); + if ( ((abs(particles[i]->pdgid()) == 12 )||(abs(particles[i]->pdgid()) == 14)||(abs(particles[i]->pdgid()) == 16)) && (status_flags_start[IsDirectPromptTauDecayProduct])) tau_neutrinos+=particles[i]->vector(); if(channel_!=channel::zmm&&status_flags_start[IsPrompt] && status_flags_start[IsLastCopy] && abs(particles[i]->pdgid()) == 15) undecayed_taus.push_back(particles[i]); if(channel_==channel::zmm&&status_flags_start[IsPrompt] && status_flags_start[IsLastCopy] && abs(particles[i]->pdgid()) == 13) undecayed_taus.push_back(particles[i]); - if(status_flags_start[IsLastCopy] && (abs(particles[i]->pdgid()) == 23 || abs(particles[i]->pdgid()) == 24 || abs(particles[i]->pdgid()) == 25 || abs(particles[i]->pdgid()) == 35 || abs(particles[i]->pdgid()) == 6) ) {h = particles[i]; foundboson=true; } } + gen_met=neutrinos.Pt(); + double gen_tau_met=tau_neutrinos.Pt(); event->Add("gen_met",gen_met); - Met const* mets = NULL; + event->Add("gen_tau_met",gen_tau_met); + Met *mets = NULL; mets = event->GetPtr("pfMET"); + double fake_met = (mets->vector() - neutrinos).Pt(); + double fake_tau_met = (mets->vector() - tau_neutrinos).Pt(); event->Add("fake_met",fake_met); - ROOT::Math::PtEtaPhiEVector fake_met_vec = (mets->vector() - neutrinos); + event->Add("fake_tau_met",fake_tau_met); + ROOT::Math::PtEtaPhiEVector fake_met_vec = (mets->vector() - neutrinos); + ROOT::Math::PtEtaPhiEVector fake_tau_met_vec = (mets->vector() - tau_neutrinos); event->Add("fake_met_vec",fake_met_vec); + event->Add("fake_tau_met_vec",fake_tau_met_vec); + + if(is_embedded_&& (channel_==channel::em || channel_==channel::et || channel_==channel::mt || channel_==channel::tt) && (era_ == era::data_2016 || era_ == era::data_2017 || era_ == era::data_2018)) { + Met *old_met = new Met(*mets); + event->Add("pfMET_uncorr", old_met); + double scale = gr_met_corr_->Eval(min(mets->pt(),300.)); + fake_met_vec*=scale; + double new_pt = (fake_met_vec + neutrinos).Pt(); + double new_phi = (fake_met_vec + neutrinos).Phi(); + ROOT::Math::PtEtaPhiEVector new_met_vec(new_pt,0., new_phi, new_pt); + mets->set_vector(new_met_vec); + } if(undecayed_taus.size()>0){ gen_match_undecayed_1_pt = undecayed_taus[0]->pt(); gen_match_undecayed_1_eta = undecayed_taus[0]->eta(); + gen_match_undecayed_1_=undecayed_taus[0]; + event->Add("gen_match_undecayed_1", gen_match_undecayed_1_); } if(undecayed_taus.size()>1){ gen_match_undecayed_2_pt = undecayed_taus[1]->pt(); gen_match_undecayed_2_eta = undecayed_taus[1]->eta(); + gen_match_undecayed_2_=undecayed_taus[1]; + event->Add("gen_match_undecayed_2", gen_match_undecayed_2_); } int tauFlag1 = 0; diff --git a/Analysis/HiggsTauTauRun2/src/HTTSequence.cc b/Analysis/HiggsTauTauRun2/src/HTTSequence.cc index 1dcd734fb..1dfc62ff4 100644 --- a/Analysis/HiggsTauTauRun2/src/HTTSequence.cc +++ b/Analysis/HiggsTauTauRun2/src/HTTSequence.cc @@ -340,13 +340,14 @@ void HTTSequence::BuildSequence(){ { }; if(strcmp((js["event_check_file"].asString()).c_str(),"")!=0){ - std::ifstream file; - file.open((js["event_check_file"].asString()).c_str()); + std::ifstream file((js["event_check_file"].asString()).c_str()); if (!file.is_open()) { std::cerr << "Warning: File " << js["event_check_file"].asString() << " cannot be opened." << std::endl; } int nums; - while(file >> nums){ + std::string line; + while(std::getline(file, line)){ + nums = std::atoi(line.c_str()); to_check.push_back(nums); std::cout << nums << std::endl; } @@ -582,7 +583,7 @@ if(do_met_filters){ "Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter","Flag_EcalDeadCellTriggerPrimitiveFilter", "Flag_goodVertices","badMuonFilter", "Flag_globalSuperTightHalo2016Filter" }; - if (era_type == era::data_2016 || era_type == era::data_2017) { + if (era_type == era::data_2016) { met_filters.pop_back(); met_filters.push_back("Flag_globalTightHalo2016Filter"); } @@ -662,6 +663,7 @@ if(!is_data) { .set_write_plots(false) .set_ditau_label("ditau") .set_channel(channel) + .set_is_embedded(is_embedded) .set_ngenjets((do_ngenjets||true) && !is_data && !is_embedded)); } @@ -1035,6 +1037,7 @@ for (unsigned i=0; i 0 || jer_mode_ > 0) && do_recoil ? 0 : new_svfit_mode; diff --git a/Analysis/HiggsTauTauRun2/src/HTTWeights.cc b/Analysis/HiggsTauTauRun2/src/HTTWeights.cc index 0bb66e067..196cfe0bf 100644 --- a/Analysis/HiggsTauTauRun2/src/HTTWeights.cc +++ b/Analysis/HiggsTauTauRun2/src/HTTWeights.cc @@ -1927,6 +1927,13 @@ int HTTWeights::Execute(TreeEvent *event) { extra="_embed"; } + if(era_ == era::data_2017){ + // in 2017 these is an additional factor recommended by the EGammas POG to correct electron triggers + xtrg_OR_sf*=0.991; + single_e_sf*=0.991; + xtrg_et_sf*=0.991; + } + std::vector systs = {"_crosslep_up","_crosslep_down","_singlelep_up","_singlelep_down","_singletau_up","_singletau_down","_dm0_up","_dm0_down","_dm1_up","_dm1_down","_dm10_up","_dm10_down","_dm11_up","_dm11_down"}; double wt_tau_trg_mssm = fns_["et_trg"+extra+"_ratio"]->eval(args_etau.data()); @@ -2057,13 +2064,6 @@ int HTTWeights::Execute(TreeEvent *event) { event->Add("trigweight_up", trigweight_up); event->Add("trigweight_down", trigweight_down); - if(era_ == era::data_2017){ - // in 2017 these is an additional factor recommended by the EGammas POG to correct electron triggers - xtrg_OR_sf*=0.991; - single_e_sf*=0.991; - xtrg_et_sf*=0.991; - } - // have xtrg OR as default but save others to check event->Add("single_l_sf", xtrg_OR_sf==0 ? single_e_sf : single_e_sf/xtrg_OR_sf ); event->Add("xtrg_sf", xtrg_OR_sf==0 ? xtrg_et_sf : xtrg_et_sf/xtrg_OR_sf); diff --git a/Analysis/HiggsTauTauRun2/test/HTT.cpp b/Analysis/HiggsTauTauRun2/test/HTT.cpp index d111ef5e0..4f6b5bbd1 100644 --- a/Analysis/HiggsTauTauRun2/test/HTT.cpp +++ b/Analysis/HiggsTauTauRun2/test/HTT.cpp @@ -156,6 +156,8 @@ int main(int argc, char* argv[]) { output_name.find("EmbeddingElTau") == output_name.npos ) || (channel_str.find("tt") != channel_str.npos && output_name.find("EmbeddingTauTau") == output_name.npos) || + (channel_str.find("zmm") != channel_str.npos && + output_name.find("EmbeddingMuMu") == output_name.npos ) || (channel_str.find("tpzmm") != channel_str.npos && output_name.find("EmbeddingMuMu") == output_name.npos ) || (channel_str.find("tpzee") != channel_str.npos && diff --git a/Analysis/HiggsTauTauRun2/test/TauSpinnerMasters.cpp b/Analysis/HiggsTauTauRun2/test/TauSpinnerMasters.cpp new file mode 100644 index 000000000..6fc934c88 --- /dev/null +++ b/Analysis/HiggsTauTauRun2/test/TauSpinnerMasters.cpp @@ -0,0 +1,34 @@ +#include +#include "TFile.h" +#include "TTree.h" +#include "Tauola/Tauola.h" +#include "TauSpinner/SimpleParticle.h" +#include "TauSpinner/tau_reweight_lib.h" + +int main(/*int argc, char* argv[]*/) { + + + // Initalise here (open input file, create output, initalise tauspinner etc...) + + std::string TauSpinnerSettingsPDF="NNPDF30_nlo_as_0118"; + bool Ipp=true; + int Ipol=0; + int nonSM2=0; + int nonSMN=0; + double CMSENE=13000.0; + + Tauolapp::Tauola::setNewCurrents(0); + Tauolapp::Tauola::initialize(); + LHAPDF::initPDFSetByName(TauSpinnerSettingsPDF); + TauSpinner::initialize_spinner(Ipp, Ipol, nonSM2, nonSMN, CMSENE); + + // Do event loop here + // for (...){ + // + // + // } + + // Write new trees here + + return 0; +} diff --git a/Analysis/mk/makefile b/Analysis/mk/makefile index 0656edfda..2f4b01291 100644 --- a/Analysis/mk/makefile +++ b/Analysis/mk/makefile @@ -66,7 +66,10 @@ USERLIBS += -L$(BOOSTSYS)/lib -lboost_regex -lboost_program_options -lboost_file # Can set CMSSW=0 to disable include/linking to CMSSW ifneq ($(CMSSW), 0) -# USERINCLUDES += -I$(CMSSW_BASE)/src + USERINCLUDES += -I$(shell scram tool tag tauolapp INCLUDE) + USERINCLUDES += -I$(shell scram tool tag lhapdf INCLUDE) + USERLIBS += -L$(shell scram tool tag tauolapp LIBDIR) -lTauolaCxxInterface -lTauolaTauSpinner + USERLIBS += -L$(shell scram tool tag lhapdf LIBDIR) -lLHAPDF USERINCLUDES += -isystem $(CMSSW_RELEASE_BASE)/src # CMSSW user area USERLIBS += -L$(CMSSW_BASE)/lib/$(SCRAM_ARCH) @@ -83,7 +86,7 @@ USERINCLUDES += -isystem $(PYSYS) CXX=g++ LD=g++ #CXXFLAGS= -Wall -Wextra -Werror -O2 --param max-vartrack-size=100000000 -std=c++0x -g -CXXFLAGS= -Wall -Wextra -Werror -O2 --param max-vartrack-size=100000000 -std=c++17 -g +CXXFLAGS= -Wall -Wextra -Werror -O2 --param max-vartrack-size=100000000 -std=c++17 -g -Wno-unused-parameter -Wno-ignored-qualifiers LDFLAGS= -shared -Wall -Wextra CXXFLAGS += $(EXTRAFLAGS) diff --git a/interface/Jet.hh b/interface/Jet.hh index 1ba6859cc..50e7d6b9c 100644 --- a/interface/Jet.hh +++ b/interface/Jet.hh @@ -37,7 +37,7 @@ class Jet : public Candidate { * depends on the jet four-momentum already being corrected to the previous * level. */ - inline std::map const& jec_factors() const { + inline std::map const& jec_factors() const { return jec_factors_; } @@ -107,7 +107,7 @@ class Jet : public Candidate { /// @name Setters /**@{*/ /// @copybrief jec_factors() - inline void set_jec_factors(std::map const& jec_factors) { + inline void set_jec_factors(std::map const& jec_factors) { jec_factors_ = jec_factors; } @@ -172,7 +172,7 @@ class Jet : public Candidate { /**@}*/ private: - UFmap jec_factors_; + std::map jec_factors_; UFmap b_discriminators_; std::vector gen_particles_; std::vector secondary_vertices_; @@ -189,7 +189,7 @@ class Jet : public Candidate { #ifndef SKIP_CINT_DICT public: - ClassDef(Jet, 4); + ClassDef(Jet, 5); #endif }; diff --git a/plugins/ICPFJetProducerFromPatNew.cc b/plugins/ICPFJetProducerFromPatNew.cc index 30ebac0dd..9078efc74 100644 --- a/plugins/ICPFJetProducerFromPatNew.cc +++ b/plugins/ICPFJetProducerFromPatNew.cc @@ -64,6 +64,12 @@ void ICPFJetProducerFromPatNew::constructSpecificWithSmear( dest.set_jerup_shift(1.); dest.set_jerdown_shift(1.); + std::map jec_factors; + for (auto s : src.availableJECLevels()) { + jec_factors.insert(std::pair((std::string)s,src.jecFactor(s,"NONE"))); + } + dest.set_jec_factors(jec_factors); + if (doSmear_) { // Find nominal smear jet matching for (unsigned j = 0; j < smearjets_handle->size(); ++j) { diff --git a/plugins/ICTauProducer.hh b/plugins/ICTauProducer.hh index 111906fc7..67cbcd7d1 100644 --- a/plugins/ICTauProducer.hh +++ b/plugins/ICTauProducer.hh @@ -212,7 +212,7 @@ void ICTauProducer::constructSpecific( //reco::PFTau const& src = taus_handle->at(i); ic::Tau& dest = taus_->at(i); reco::PFTauRef const& ref = taus_handle->refAt(i).castTo(); - if(taus_handle->at(i).decayMode()==1) std::cout << "N pi0s = " << taus_handle->at(i).signalPiZeroCandidates().size() << std::endl; + //if(taus_handle->at(i).decayMode()==1) std::cout << "N pi0s = " << taus_handle->at(i).signalPiZeroCandidates().size() << std::endl; for (unsigned j = 0; j < tau_ids_.size(); ++j) { dest.SetTauID(tau_ids_[j].first, (*(id_handles[j]))[ref]); observed_id_[tau_ids_[j].first] = CityHash64(tau_ids_[j].first); diff --git a/plugins/ICTauSpinnerProducer.cc b/plugins/ICTauSpinnerProducer.cc index ab6dceb9f..23214b4e9 100644 --- a/plugins/ICTauSpinnerProducer.cc +++ b/plugins/ICTauSpinnerProducer.cc @@ -171,7 +171,7 @@ TauSpinner::SimpleParticle ICTauSpinnerProducer::ConvertToSimplePart(reco::GenPa } void ICTauSpinnerProducer::initialize(){ - Tauolapp::Tauola::setNewCurrents(1); + Tauolapp::Tauola::setNewCurrents(0); Tauolapp::Tauola::initialize(); LHAPDF::initPDFSetByName(TauSpinnerSettingsPDF); TauSpinner::initialize_spinner(Ipp, Ipol, nonSM2, nonSMN, CMSENE); diff --git a/python/default_producers_cfi.py b/python/default_producers_cfi.py index 828c766d6..8f249e2db 100644 --- a/python/default_producers_cfi.py +++ b/python/default_producers_cfi.py @@ -250,9 +250,10 @@ metsig = cms.InputTag("METSignificance","METSignificance"), metsigcov = cms.InputTag("METSignificance","METCovariance") ), - includeMetCorrections = cms.bool(False), + includeMetCorrections = cms.bool(True), + #includeMetCorrections = cms.bool(False), metcorrections = cms.vstring( - 'Raw','Type1','Type01','TypeXY','Type1XY','Type01XY','Type1Smear','Type01Smear','Type1SmearXY','Type01SmearXY','RawCalo'), + 'Raw','Type1','Type01','TypeXY','Type1XY','Type01XY','Type1Smear','Type01Smear','Type1SmearXY','Type01SmearXY','RawCalo','RawChs','RawTrk'), includeMetUncertainties = cms.bool(False), metuncertainties = cms.vstring( 'JetResUp','JetResDown','JetEnUp','JetEnDown','MuonEnUp','MuonEnDown','ElectronEnUp','ElectronEnDown','TauEnUp','TauEnDown','UnclusteredEnUp','UnclusteredEnDown','PhotonEnUp','PhotonEnDown','NoShift') diff --git a/src/Jet.cc b/src/Jet.cc index 39b31e31f..337baec30 100644 --- a/src/Jet.cc +++ b/src/Jet.cc @@ -19,19 +19,19 @@ Jet::~Jet() {} void Jet::Print() const { Candidate::Print(); std::cout << "--JEC Factors--" << std::endl; - UFmap::const_iterator uf_it; + std::map::const_iterator uf_it; for (uf_it = jec_factors_.begin(); uf_it != jec_factors_.end(); ++uf_it) { std::cout << boost::format("%-30s %-30s\n") % - UnHashJecFactor(uf_it->first) % uf_it->second; + uf_it->first % uf_it->second; } } void Jet::SetJecFactor(std::string const& name, float const& factor) { - jec_factors_[CityHash64(name)] = factor; + jec_factors_[name] = factor; } float Jet::GetJecFactor(std::string const& name) const { - UFmap::const_iterator iter = jec_factors_.find(CityHash64(name)); + std::map::const_iterator iter = jec_factors_.find(name); if (iter != jec_factors_.end()) { return iter->second; } else { diff --git a/src/PFJet.cc b/src/PFJet.cc index 124f8b50d..3703bc9c1 100644 --- a/src/PFJet.cc +++ b/src/PFJet.cc @@ -32,4 +32,5 @@ PFJet::PFJet() PFJet::~PFJet() {} void PFJet::Print() const { Candidate::Print(); } + } diff --git a/test/crab_higgstautau_2017_miniAOD.py b/test/crab_higgstautau_2017_miniAOD.py index bf8d1eddd..ebe9fb3f5 100755 --- a/test/crab_higgstautau_2017_miniAOD.py +++ b/test/crab_higgstautau_2017_miniAOD.py @@ -7,7 +7,7 @@ config = config() config.General.transferOutputs = True -config.General.workArea='May21_MC_102X_2017' +config.General.workArea='Jan11_MC_102X_2017' config.JobType.psetName = 'higgstautau_cfg_102X_Aug19_2017.py' config.JobType.pluginName = 'Analysis' diff --git a/test/crab_higgstautau_2017_miniAOD_embedding.py b/test/crab_higgstautau_2017_miniAOD_embedding.py index 65eac58b8..d737f55dd 100755 --- a/test/crab_higgstautau_2017_miniAOD_embedding.py +++ b/test/crab_higgstautau_2017_miniAOD_embedding.py @@ -4,7 +4,7 @@ config = config() config.General.transferOutputs = True -config.General.workArea='May21_MC_102X_2017' +config.General.workArea='Jan11_MC_102X_2017' config.JobType.psetName = 'higgstautau_cfg_102X_Aug19_2017.py' config.JobType.pluginName = 'Analysis'