Skip to content

Commit

Permalink
Extend example config for tauRecoAtMini to run on real data
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluj committed Sep 2, 2020
1 parent 95ebf85 commit 3655bf9
Showing 1 changed file with 32 additions and 10 deletions.
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

0 comments on commit 3655bf9

Please sign in to comment.