File indexing completed on 2023-03-17 11:22:00
0001 import FWCore.ParameterSet.Config as cms
0002
0003
0004
0005
0006
0007
0008
0009
0010 runType = 'signal'
0011
0012
0013 maxEvents = 100
0014
0015
0016
0017 runBoosted = False
0018
0019
0020
0021 postfix = ''
0022
0023
0024
0025
0026 reclusterJets = True
0027
0028
0029
0030 phase2 = False
0031
0032 if phase2 and runType == 'data':
0033 print('There is not Phase2 data, yet! Setting phase2 to False')
0034 phase2 = False
0035
0036
0037 outMode = 0
0038
0039
0040 print('Running Tau reco&id with MiniAOD inputs:')
0041 print('\t Run type:', runType)
0042 print('\t Recluster jets:', reclusterJets)
0043 print('\t Boosted tau reco:', runBoosted)
0044 print('\t Use Phase2 settings:', phase2)
0045 print('\t Output mode:', outMode)
0046 if not postfix=="":
0047 print('\t Postfix:', postfix)
0048
0049
0050 from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
0051 era = Run2_2018
0052 if phase2:
0053 from Configuration.Eras.Era_Phase2_timing_cff import Phase2_timing
0054 era = Phase2_timing
0055 process = cms.Process("TAURECO", era)
0056
0057 process.load("Configuration.StandardSequences.MagneticField_cff")
0058 if not phase2:
0059 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0060 else:
0061 process.load('Configuration.Geometry.GeometryExtended2023D17Reco_cff')
0062
0063
0064 readFiles = cms.untracked.vstring()
0065 secFiles = cms.untracked.vstring()
0066 process.source = cms.Source(
0067 "PoolSource", fileNames=readFiles, secondaryFileNames=secFiles)
0068
0069 process.maxEvents.input=maxEvents
0070
0071 print('\t Max events:', process.maxEvents.input.value())
0072
0073 if runType == 'signal':
0074 readFiles.extend([
0075
0076 '/store/relval/CMSSW_10_5_0_pre1/RelValZTT_13/MINIAODSIM/PU25ns_103X_upgrade2018_realistic_v8-v1/20000/EA29017F-9967-3F41-BB8A-22C44A454235.root'
0077 ])
0078 elif runType == 'background':
0079 readFiles.extend([
0080
0081 '/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'
0082 ])
0083 elif runType == 'data':
0084 readFiles.extend([
0085
0086 '/store/data/Run2018D/Tau/MINIAOD/12Nov2019_UL2018-v1/00000/01415E2B-7CE5-B94C-93BD-0796FC40BD97.root'
0087 ])
0088 else:
0089 print('Unknown runType =',runType,'; Use \"signal\" or \"background\" or \"data\"')
0090 exit(1)
0091
0092
0093 from RecoTauTag.Configuration.tools.adaptToRunAtMiniAOD import adaptToRunAtMiniAOD
0094
0095
0096 tauAtMiniTools = adaptToRunAtMiniAOD(process,runBoosted,postfix=postfix)
0097 tauAtMiniTools.addTauReReco()
0098
0099
0100 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0101 from Configuration.AlCa.GlobalTag import GlobalTag
0102 if not phase2 and runType != 'data':
0103 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '')
0104 elif phase2:
0105 process.GlobalTag = GlobalTag(
0106 process.GlobalTag, 'auto:phase2_realistic', '')
0107 else:
0108 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0109
0110
0111
0112
0113 process.output = tauAtMiniTools.setOutputModule(mode=outMode)
0114 if runType == 'signal':
0115 process.output.fileName = 'miniAOD_TauReco_ggH.root'
0116 if reclusterJets:
0117 process.output.fileName = 'miniAOD_TauReco_ak4PFJets_ggH.root'
0118 elif runType == 'background':
0119 process.output.fileName = 'miniAOD_TauReco_QCD.root'
0120 if reclusterJets:
0121 process.output.fileName = 'miniAOD_TauReco_ak4PFJets_QCD.root'
0122 else:
0123 process.output.fileName = 'miniAOD_TauReco_data.root'
0124 if reclusterJets:
0125 process.output.fileName = 'miniAOD_TauReco_ak4PFJets_data.root'
0126 process.out = cms.EndPath(process.output)
0127
0128
0129 tauAtMiniTools.adaptTauToMiniAODReReco(reclusterJets)
0130 process.p = cms.Path(
0131 getattr(process,("miniAODTausSequence"+postfix if not runBoosted else "miniAODTausSequenceBoosted"+postfix))
0132 )
0133
0134 if runType == 'data':
0135 from PhysicsTools.PatAlgos.tools.coreTools import runOnData
0136 runOnData(process, names = ['Taus'], outputModules = [], postfix = (postfix if not runBoosted else 'Boosted'+postfix))
0137
0138
0139 process.load('FWCore.MessageService.MessageLogger_cfi')
0140 if process.maxEvents.input.value() > 10:
0141 process.MessageLogger.cerr.FwkReport.reportEvery = process.maxEvents.input.value()//10
0142 if process.maxEvents.input.value() > 10000 or process.maxEvents.input.value() < 0:
0143 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0144
0145
0146 process.options = dict( numberOfThreads = 4,
0147
0148 numberOfStreams = 0,
0149 wantSummary = True
0150 )
0151 print('\t No. of threads:', process.options.numberOfThreads.value(), ', no. of streams:', process.options.numberOfStreams.value())
0152
0153