Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes for tauReco at miniAOD #31330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion RecoTauTag/RecoTau/src/AntiElectronIDMVA6.cc
Expand Up @@ -784,7 +784,7 @@ TauVars AntiElectronIDMVA6<TauType, ElectronType>::getTauVarsTypeSpecific(const
if (patLeadCandiate != nullptr) {
tauVars.leadPFChargedHadrHoP = patLeadCandiate->caloFraction() * patLeadCandiate->energy() *
patLeadCandiate->hcalFraction() / patLeadCandiate->p();
tauVars.leadPFChargedHadrHoP = patLeadCandiate->caloFraction() * patLeadCandiate->energy() *
tauVars.leadPFChargedHadrEoP = patLeadCandiate->caloFraction() * patLeadCandiate->energy() *
(1. - patLeadCandiate->hcalFraction()) / patLeadCandiate->p();
}
}
Expand Down
42 changes: 32 additions & 10 deletions RecoTauTag/RecoTau/test/rerunTauRecoOnMiniAOD.py
Expand Up @@ -7,10 +7,11 @@
######

######
runSignal = True
# runSignal=False
runType = 'signal'
# runType = 'background'
# runType = 'data'
maxEvents = 100
# maxEvents=-1
# maxEvents = -1


# If 'reclusterJets' set true a new collection of uncorrected ak4PFJets is
Expand All @@ -21,13 +22,16 @@
# set true for upgrade studies
phase2 = False
# phase2 = True
if phase2 and runType == 'data':
print('There is not Phase2 data, yet! Setting phase2 to False')
phase2 = False

# Output mode
outMode = 0 # store original MiniAOD and new selectedPatTaus
# outMode = 1 #store original MiniAOD, new selectedPatTaus, and all PFtau products as in AOD (except of unsuported ones)

print('Running Tau reco&id with MiniAOD inputs:')
print('\t Run on signal:', runSignal)
print('\t Run type:', runType)
print('\t Recluster jets:', reclusterJets)
print('\t Use Phase2 settings:', phase2)
print('\t Output mode:', outMode)
Expand Down Expand Up @@ -56,16 +60,24 @@

print('\t Max events:', process.maxEvents.input.value())

if runSignal:
if runType == 'signal':
readFiles.extend([
#'file:patMiniAOD_standard.root'
'/store/relval/CMSSW_10_5_0_pre1/RelValZTT_13/MINIAODSIM/PU25ns_103X_upgrade2018_realistic_v8-v1/20000/EA29017F-9967-3F41-BB8A-22C44A454235.root'
])
else:
elif runType == 'background':
readFiles.extend([
#'file:patMiniAOD_standard.root'
'/store/relval/CMSSW_10_5_0_pre1/RelValQCD_FlatPt_15_3000HS_13/MINIAODSIM/PU25ns_103X_mcRun2_asymptotic_v3-v1/20000/A5CBC261-E3AB-C842-896F-E6AFB38DD22F.root'
])
elif runType == 'data':
readFiles.extend([
#'/store/data/Run2018D/SingleMuon/MINIAOD/12Nov2019_UL2018-v4/710000/B7163712-7B03-D949-91C9-EB5DD2E1D4C3.root' # SingleMuon PD
'/store/data/Run2018D/Tau/MINIAOD/12Nov2019_UL2018-v1/00000/01415E2B-7CE5-B94C-93BD-0796FC40BD97.root' # Tau PD
])
else:
print('Unknown runType =',runType,'; Use \"signal\" or \"background\" or \"data\"')
exit(1)

#####
import RecoTauTag.Configuration.tools.adaptToRunAtMiniAOD as tauAtMiniTools
Expand All @@ -76,29 +88,39 @@
#####
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
if not phase2:
if not phase2 and runType != 'data':
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '')
else:
elif phase2:
process.GlobalTag = GlobalTag(
process.GlobalTag, 'auto:phase2_realistic', '')
else: # data
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')

#####
# mode = 0: store original MiniAOD and new selectedPatTaus
# mode = 1: store original MiniAOD, new selectedPatTaus, and all PFtau products as in AOD (except of unsuported ones)
process.output = tauAtMiniTools.setOutputModule(mode=outMode)
if runSignal:
if runType == 'signal':
process.output.fileName = 'miniAOD_TauReco_ggH.root'
if reclusterJets:
process.output.fileName = 'miniAOD_TauReco_ak4PFJets_ggH.root'
else:
elif runType == 'background':
process.output.fileName = 'miniAOD_TauReco_QCD.root'
if reclusterJets:
process.output.fileName = 'miniAOD_TauReco_ak4PFJets_QCD.root'
else: # data
process.output.fileName = 'miniAOD_TauReco_data.root'
if reclusterJets:
process.output.fileName = 'miniAOD_TauReco_ak4PFJets_data.root'
process.out = cms.EndPath(process.output)

#####
tauAtMiniTools.adaptTauToMiniAODReReco(process, reclusterJets)

if runType == 'data':
from PhysicsTools.PatAlgos.tools.coreTools import runOnData
runOnData(process, names = ['Taus'], outputModules = [])

#####
process.load('FWCore.MessageService.MessageLogger_cfi')
if process.maxEvents.input.value() > 10:
Expand Down