Skip to content

Commit

Permalink
Set of improvements proposed during review
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluj committed Mar 30, 2021
1 parent ea87067 commit 2039e7b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 32 deletions.
51 changes: 21 additions & 30 deletions RecoTauTag/RecoTau/python/tools/runTauIdMVA.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,17 @@ def runTauID(self):

wp_to_eff_match = {
"VVLoose" : "WPEff95",
"VLoose" : "WPEff90",
"Loose" : "WPEff80",
"Medium" : "WPEff70",
"Tight" : "WPEff60",
"VTight" : "WPEff50",
"VVTight" : "WPEff40"
}
for wp in ["VVLoose","Loose","Medium","Tight","VTight","VVTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "rerunDiscriminationByIsolationOldDMMVArun2017v1"+wp+self.postfix
setattr(self.process,_aWP,_byIsolationOldDMMVArun2017v1VLooseProd.clone())
_aWPProd = getattr(self.process,_aWP)
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_"+wp_to_eff_match[wp])
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_"+wpEff)
_rerunIsolationOldDMMVArun2017v1Task.add(_aWPProd)
setattr(tauIDSources,"by"+wp+"IsolationMVArun2017v1DBoldDMwLT2017",self.cms.InputTag(_aWP))

Expand Down Expand Up @@ -265,18 +264,17 @@ def runTauID(self):

wp_to_eff_match = {
"VVLoose" : "WPEff95",
"VLoose" : "WPEff90",
"Loose" : "WPEff80",
"Medium" : "WPEff70",
"Tight" : "WPEff60",
"VTight" : "WPEff50",
"VVTight" : "WPEff40"
}
for wp in ["VVLoose","Loose","Medium","Tight","VTight","VVTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "rerunDiscriminationByIsolationOldDMMVArun2017v2"+wp+self.postfix
setattr(self.process,_aWP,_byIsolationOldDMMVArun2017v2VLooseProd.clone())
_aWPProd = getattr(self.process,_aWP)
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_"+wp_to_eff_match[wp])
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_"+wpEff)
_rerunIsolationOldDMMVArun2017v2Task.add(_aWPProd)
setattr(tauIDSources,"by"+wp+"IsolationMVArun2017v2DBoldDMwLT2017",self.cms.InputTag(_aWP))

Expand Down Expand Up @@ -342,18 +340,17 @@ def runTauID(self):

wp_to_eff_match = {
"VVLoose" : "WPEff95",
"VLoose" : "WPEff90",
"Loose" : "WPEff80",
"Medium" : "WPEff70",
"Tight" : "WPEff60",
"VTight" : "WPEff50",
"VVTight" : "WPEff40"
}
for wp in ["VVLoose","Loose","Medium","Tight","VTight","VVTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "rerunDiscriminationByIsolationNewDMMVArun2017v2"+wp+self.postfix
setattr(self.process,_aWP,_byIsolationNewDMMVArun2017v2VLooseProd.clone())
_aWPProd = getattr(self.process,_aWP)
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_"+wp_to_eff_match[wp])
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_"+wpEff)
_rerunIsolationNewDMMVArun2017v2Task.add(_aWPProd)
setattr(tauIDSources,"by"+wp+"IsolationMVArun2017v2DBnewDMwLT2017",self.cms.InputTag(_aWP))

Expand Down Expand Up @@ -423,18 +420,17 @@ def runTauID(self):

wp_to_eff_match = {
"VVLoose" : "WPEff95",
"VLoose" : "WPEff90",
"Loose" : "WPEff80",
"Medium" : "WPEff70",
"Tight" : "WPEff60",
"VTight" : "WPEff50",
"VVTight" : "WPEff40"
}
for wp in ["VVLoose","Loose","Medium","Tight","VTight","VVTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2"+wp+self.postfix
setattr(self.process,_aWP,_byIsolationOldDMdR0p3MVArun2017v2VLooseProd.clone())
_aWPProd = getattr(self.process,_aWP)
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_"+wp_to_eff_match[wp])
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_"+wpEff)
_rerunIsolationOldDMdR0p3MVArun2017v2Task.add(_aWPProd)
setattr(tauIDSources,"by"+wp+"IsolationMVArun2017v2DBoldDMdR0p3wLT2017",self.cms.InputTag(_aWP))

Expand Down Expand Up @@ -505,19 +501,17 @@ def runTauID(self):
tauIDSources.byVLooseIsolationMVArun2v2DBoldDMwLT2016 = self.cms.InputTag(_byIsolationOldDMMVArun2016v1VLoose)

wp_to_eff_match = {
"VVLoose" : "WPEff95",
"VLoose" : "WPEff90",
"Loose" : "WPEff80",
"Medium" : "WPEff70",
"Tight" : "WPEff60",
"VTight" : "WPEff50",
"VVTight" : "WPEff40"
}
for wp in ["Loose","Medium","Tight","VTight","VVTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "rerunDiscriminationByIsolationOldDMMVArun2v1"+wp+self.postfix
setattr(self.process,_aWP,_byIsolationOldDMMVArun2016v1VLooseProd.clone())
_aWPProd = getattr(self.process,_aWP)
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_"+wp_to_eff_match[wp])
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_"+wpEff)
_rerunIsolationOldDMMVArun2016v1Task.add(_aWPProd)
setattr(tauIDSources,"by"+wp+"IsolationMVArun2v1DBoldDMwLT2016",self.cms.InputTag(_aWP))

Expand Down Expand Up @@ -562,19 +556,17 @@ def runTauID(self):
tauIDSources.byVLooseIsolationMVArun2v2DBnewDMwLT2016 = self.cms.InputTag(_byIsolationNewDMMVArun2016v1VLoose)

wp_to_eff_match = {
"VVLoose" : "WPEff95",
"VLoose" : "WPEff90",
"Loose" : "WPEff80",
"Medium" : "WPEff70",
"Tight" : "WPEff60",
"VTight" : "WPEff50",
"VVTight" : "WPEff40"
}
for wp in ["Loose","Medium","Tight","VTight","VVTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "rerunDiscriminationByIsolationNewDMMVArun2v1"+wp+self.postfix
setattr(self.process,_aWP,_byIsolationNewDMMVArun2016v1VLooseProd.clone())
_aWPProd = getattr(self.process,_aWP)
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_"+wp_to_eff_match[wp])
_aWPProd.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_"+wpEff)
_rerunIsolationNewDMMVArun2016v1Task.add(_aWPProd)
setattr(tauIDSources,"by"+wp+"IsolationMVArun2v1DBnewDMwLT2016",self.cms.InputTag(_aWP))

Expand Down Expand Up @@ -901,54 +893,53 @@ def runTauID(self):
)
# Other WPs
wp_to_eff_match = {
"VLoose" : "WPeff98",
"Loose" : "WPeff90",
"Medium" : "WPeff80",
"Tight" : "WPeff70",
"VTight" : "WPeff60",
}
for wp in ["Loose", "Medium", "Tight", "VTight"]:
for wp,wpEff in wp_to_eff_match.items():
_aWP = "patTauDiscriminationBy"+wp+"ElectronRejectionMVA62018"+self.postfix
setattr(self.process,_aWP,_byElectronRejectionMVA62018VLooseProd.clone(
mapping = self.cms.VPSet(
self.cms.PSet(
category = self.cms.uint32(0),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(2),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(5),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(7),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(8),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(10),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(13),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_'+wpEff),
variable = self.cms.string('pt')
),
self.cms.PSet(
category = self.cms.uint32(15),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_'+wp_to_eff_match[wp]),
cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_'+wpEff),
variable = self.cms.string('pt')
)
)
Expand Down
4 changes: 2 additions & 2 deletions RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

# Input source
process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring(
# File from dataset DY1JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8
' /store/mc/RunIIFall17MiniAODv2/TTToHadronic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/40000/A256C80D-0943-E811-998E-7CD30AB0522C.root'
# File from dataset TTToHadronic_TuneCP5_13TeV-powheg-pythia8
'/store/mc/RunIISummer20UL18MiniAOD/TTToHadronic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/001FF3B9-3186-7246-BBD3-1531BFE6AD28.root'
))

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) )
Expand Down

0 comments on commit 2039e7b

Please sign in to comment.