Skip to content

Commit

Permalink
Merge pull request #15 from nurfikri89/eff_analysis_nano_run2
Browse files Browse the repository at this point in the history
Update branch for UL2017 SFs with ULNanoAODv2 input
  • Loading branch information
nurfikri89 authored May 23, 2021
2 parents 0015cfd + 28f5c5d commit ef72f58
Show file tree
Hide file tree
Showing 34 changed files with 1,819 additions and 233 deletions.
4 changes: 4 additions & 0 deletions Analyzer/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
nbinnorj.cc
MakeHistosAtBatch.sh
MakeHistosAtBatch.sh.sub
SkimNtuplesAtBatch.sh
SkimNtuplesAtBatch.sh.sub
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,20 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
df = df.Define("probeJet_eta", probeJetStr+"_eta")
df = df.Define("probeJet_abseta", "fabs("+probeJetStr+"_eta)")
df = df.Define("probeJet_phi", probeJetStr+"_phi")
df = df.Define("probeJet_dilep_dphi", probeJetStr+"_dilep_dphi")
df = df.Define("probeJet_puIdDisc", probeJetStr+"_puIdDisc")
#
# Guide on how to read the pileup ID bitmap variable:
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/PileupJetID#miniAOD_and_nanoAOD
#
df = df.Define("probeJet_puIdFlag_Loose", probeJetStr+"_puId & (1 << 2)")
df = df.Define("probeJet_puIdFlag_Medium",probeJetStr+"_puId & (1 << 1)")
df = df.Define("probeJet_puIdFlag_Tight", probeJetStr+"_puId & (1 << 0)")
df = df.Define("probeJet_dilep_dphi", probeJetStr+"_dilep_dphi")
if isMC:
df = df.Define("probeJet_passGenMatch",probeJetStr+"_gen_match")
if isUL:
df = df.Define("probeJet_puIdDiscOTF", probeJetStr+"_puIdDiscOTF")
if isMC:
df = df.Define("probeJet_passGenMatch",probeJetStr+"_gen_match")

#
#
#
Expand All @@ -121,8 +126,6 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
#
if not isUL: #EOY
#
# Guide on how to read the pileup ID bitmap variable:
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/PileupJetID#miniAOD_and_nanoAOD
# NOTE: The pileup ID decision flag stored in NanoAOD (v7 and earlier) is based on
# the 80X BDT training and working point (as in the parent MiniAOD).
#
Expand All @@ -141,10 +144,14 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
df = df.Define("probeJet_puIdMedium_pass", "PUJetID_80XCut_WPMedium("+argStr+")")
df = df.Define("probeJet_puIdTight_pass", "PUJetID_80XCut_WPTight("+argStr+")")
else: #UL
argStr = "probeJet_pt,probeJet_eta,probeJet_puIdDiscOTF"
df = df.Define("probeJet_puIdLoose_pass", "PUJetID_106XUL17Cut_WPLoose("+argStr+")")
df = df.Define("probeJet_puIdMedium_pass", "PUJetID_106XUL17Cut_WPMedium("+argStr+")")
df = df.Define("probeJet_puIdTight_pass", "PUJetID_106XUL17Cut_WPTight("+argStr+")")
#
# NOTE: In ULNanoAODv2 UL17, the pileup jet ID flag is based on the UL17 training
# and cut values.
#
if not useNewTraining:
df = df.Define("probeJet_puIdLoose_pass", "probeJet_puIdFlag_Loose")
df = df.Define("probeJet_puIdMedium_pass", "probeJet_puIdFlag_Medium")
df = df.Define("probeJet_puIdTight_pass", "probeJet_puIdFlag_Tight")
#
#
#
Expand Down
33 changes: 18 additions & 15 deletions Analyzer/MakeHistogramsHisto3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
df = df.Define("passNJetSel","(nJetSel>=1)&&(nJetSelPt30Eta5p0<=1)&&(nJetSelPt20Eta2p4<=1)")
else:
df = df.Define(systStr+"passNJetSel","("+systStrPre+"nJetSel>=1)&&("+systStrPre+"nJetSelPt30Eta5p0<=1)&&("+systStrPre+"nJetSelPt20Eta2p4<=1)")

#
# Define flags for lepton channels if need to check by channel
#
Expand All @@ -166,15 +165,19 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
df = df.Define("probeJet_eta", probeJetStr+"_eta")
df = df.Define("probeJet_abseta", "fabs("+probeJetStr+"_eta)")
df = df.Define("probeJet_phi", probeJetStr+"_phi")
df = df.Define("probeJet_dilep_dphi", probeJetStr+"_dilep_dphi")
df = df.Define("probeJet_puIdDisc", probeJetStr+"_puIdDisc")
#
# Guide on how to read the pileup ID bitmap variable:
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/PileupJetID#miniAOD_and_nanoAOD
#
df = df.Define("probeJet_puIdFlag_Loose", probeJetStr+"_puId & (1 << 2)")
df = df.Define("probeJet_puIdFlag_Medium",probeJetStr+"_puId & (1 << 1)")
df = df.Define("probeJet_puIdFlag_Tight", probeJetStr+"_puId & (1 << 0)")
df = df.Define("probeJet_dilep_dphi", probeJetStr+"_dilep_dphi")
if isMC:
df = df.Define("probeJet_passGenMatch", probeJetStr+"_gen_match")
if isUL:
df = df.Define("probeJet_puIdDiscOTF", probeJetStr+"_puIdDiscOTF")
if isMC:
df = df.Define("probeJet_passGenMatch", probeJetStr+"_gen_match")
#
#
#
Expand All @@ -185,8 +188,6 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
#
if not isUL: #EOY
#
# Guide on how to read the pileup ID bitmap variable:
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/PileupJetID#miniAOD_and_nanoAOD
# NOTE: The pileup ID decision flag stored in NanoAOD (v7 and earlier) is based on
# the 80X BDT training and working point (as in the parent MiniAOD).
#
Expand All @@ -205,11 +206,13 @@ def main(sample_name, useSkimNtuples, systStr, useNewTraining=False):
df = df.Define("probeJet_puIdMedium_pass", "PUJetID_80XCut_WPMedium("+argStr+")")
df = df.Define("probeJet_puIdTight_pass", "PUJetID_80XCut_WPTight("+argStr+")")
else: #UL
if useNewTraining:
argStr = "probeJet_pt,probeJet_eta,probeJet_puIdDiscOTF"
df = df.Define("probeJet_puIdLoose_pass", "PUJetID_106XUL17Cut_WPLoose("+argStr+")")
df = df.Define("probeJet_puIdMedium_pass", "PUJetID_106XUL17Cut_WPMedium("+argStr+")")
df = df.Define("probeJet_puIdTight_pass", "PUJetID_106XUL17Cut_WPTight("+argStr+")")
#
# NOTE: In ULNanoAODv2 UL17, the pileup jet ID flag is based on the UL17 training
# and cut values.
#
df = df.Define("probeJet_puIdLoose_pass", "probeJet_puIdFlag_Loose")
df = df.Define("probeJet_puIdMedium_pass", "probeJet_puIdFlag_Medium")
df = df.Define("probeJet_puIdTight_pass", "probeJet_puIdFlag_Tight")
#
#
#
Expand Down Expand Up @@ -394,10 +397,10 @@ def ProjectTH3(h3, HistoDict, systStrPost):
ak4Systematics=[]
if isMC:
ak4Systematics=[
# "jesTotalUp",
# "jesTotalDown",
# "jerUp",
# "jerDown"
"jesTotalUp",
"jesTotalDown",
"jerUp",
"jerDown"
]
# Don't do ak4Systematics for MG+HW and AMCNLO
if "MG_HW" in args.sample: ak4Systematics=[]
Expand Down
63 changes: 12 additions & 51 deletions Analyzer/RunLocal_MakeHistograms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,26 @@
NCORES=4

SAMPLES=(
# MC16_DY_MG
# MC17_DY_MG
# MC18_DY_MG
# MC16_DY_AMCNLO
# MC17_DY_AMCNLO
# MC18_DY_AMCNLO
# MC16_DY_MG_HW
# MC17_DY_MG_HW
# MC18_DY_MG_HW
# Data16B_DoubleMuon
# Data16C_DoubleMuon
# Data16D_DoubleMuon
# Data16E_DoubleMuon
# Data16F_DoubleMuon
# Data16G_DoubleMuon
# Data16H_DoubleMuon
# Data17B_DoubleMuon
# Data17C_DoubleMuon
# Data17D_DoubleMuon
# Data17E_DoubleMuon
# Data17F_DoubleMuon
# Data18A_DoubleMuon
# Data18B_DoubleMuon
# Data18C_DoubleMuon
# Data18D_DoubleMuon
# Data16B_DoubleEG
# Data16C_DoubleEG
# Data16D_DoubleEG
# Data16E_DoubleEG
# Data16F_DoubleEG
# Data16G_DoubleEG
# Data16H_DoubleEG
# Data17B_DoubleEG
# Data17C_DoubleEG
# Data17D_DoubleEG
# Data17E_DoubleEG
# Data17F_DoubleEG
# Data18A_EGamma
# Data18B_EGamma
# Data18C_EGamma
# Data18D_EGamma
)
SAMPLES=(
MCUL17_DY_MG
# MCUL17_DY_AMCNLO
# DataUL17B_DoubleMuon
# DataUL17C_DoubleMuon
# DataUL17D_DoubleMuon
# DataUL17E_DoubleMuon
DataUL17B_DoubleMuon
DataUL17C_DoubleMuon
DataUL17D_DoubleMuon
DataUL17E_DoubleMuon
DataUL17F_DoubleMuon
DataUL17B_DoubleEG
DataUL17C_DoubleEG
DataUL17D_DoubleEG
DataUL17E_DoubleEG
DataUL17F_DoubleEG
MCUL17_DY_MG
MCUL17_DY_AMCNLO
)

#
# Make histograms from ntuples
#
for SAMPLE in ${SAMPLES[@]}
do
python MakeHistograms.py --sample $SAMPLE --cores $NCORES --useSkimNtuples --useNewTraining
# python MakeHistogramsHisto3D.py --sample $SAMPLE --cores $NCORES --useSkimNtuples --useNewTraining
python MakeHistogramsHisto3D.py --sample $SAMPLE --cores $NCORES --useSkimNtuples --useNewTraining
done


Expand Down
68 changes: 12 additions & 56 deletions Analyzer/RunLocal_SkimNtuples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,18 @@
NCORES=4

SAMPLES=(
# MC16_DY_MG
# MC17_DY_MG
# MC18_DY_MG
# MC16_DY_AMCNLO
# MC17_DY_AMCNLO
# MC18_DY_AMCNLO
# MC16_DY_MG_HW
# MC17_DY_MG_HW
# MC18_DY_MG_HW
# Data16B_DoubleMuon
# Data16C_DoubleMuon
# Data16D_DoubleMuon
# Data16E_DoubleMuon
# Data16F_DoubleMuon
# Data16G_DoubleMuon
# Data16H_DoubleMuon
# Data16B_DoubleEG
# Data16C_DoubleEG
# Data16D_DoubleEG
# Data16E_DoubleEG
# Data16F_DoubleEG
# Data16G_DoubleEG
# Data16H_DoubleEG
# Data17B_DoubleMuon
# Data17C_DoubleMuon
# Data17D_DoubleMuon
# Data17E_DoubleMuon
# Data17F_DoubleMuon
# Data17B_DoubleEG
# Data17C_DoubleEG
# Data17D_DoubleEG
# Data17E_DoubleEG
# Data17F_DoubleEG
# Data18A_DoubleMuon
# Data18B_DoubleMuon
# Data18C_DoubleMuon
# Data18D_DoubleMuon
# Data18A_EGamma
# Data18B_EGamma
# Data18C_EGamma
# Data18D_EGamma
# DataUL17B_DoubleMuon
# DataUL17C_DoubleMuon
# DataUL17D_DoubleMuon
# DataUL17E_DoubleMuon
# DataUL17F_DoubleMuon
)

SAMPLES=(
# MCUL17_DY_MG
# MCUL17_DY_AMCNLO
# DataUL17B_DoubleMuon
# DataUL17C_DoubleMuon
# DataUL17D_DoubleMuon
# DataUL17E_DoubleMuon
# DataUL17F_DoubleMuon
DataUL17B_DoubleMuon
DataUL17C_DoubleMuon
DataUL17D_DoubleMuon
DataUL17E_DoubleMuon
DataUL17F_DoubleMuon
DataUL17B_DoubleEG
DataUL17C_DoubleEG
DataUL17D_DoubleEG
DataUL17E_DoubleEG
DataUL17F_DoubleEG
MCUL17_DY_MG
MCUL17_DY_AMCNLO
)

#
Expand Down
Loading

0 comments on commit ef72f58

Please sign in to comment.