Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:27

0001 from __future__ import print_function
0002 #Basic example configration file to run the b-tagging validation sequence.
0003 import FWCore.ParameterSet.Config as cms
0004 process = cms.Process("validation")
0005 
0006 # load the full reconstraction configuration, to make sure we're getting all needed dependencies
0007 process.load("Configuration.StandardSequences.MagneticField_cff")
0008 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0009 process.load("Configuration.StandardSequences.Reconstruction_cff")
0010 process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0011 
0012 """
0013 start customization
0014 """
0015 
0016 #Enter here the Global tags
0017 from Configuration.AlCa.GlobalTag import GlobalTag
0018 tag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
0019 #Do you want to apply JEC? For data, no need to add 'Residual', the code is checking if events are Data or MC and add 'Residual' for Data.
0020 applyJEC = True
0021 #Data or MC?
0022 runOnMC    = True
0023 #Flavour plots for MC: "all" = plots for all jets ; "dusg" = plots for d, u, s, dus, g independently ; not mandatory and any combinations are possible 
0024 #b, c, light (dusg), non-identified (NI), PU jets plots are always produced
0025 flavPlots = "allbcldusg"
0026 #Check if jets originate from PU? option recommended (only for MC)
0027 PUid = True
0028 #List of taggers and taginfo to be considered (see example in: DQMOffline/RecoB/python/bTagCommon_cff.py)
0029 from DQMOffline.RecoB.bTagCommon_cff import *
0030 tagConfig = cms.VPSet(
0031         cms.PSet(
0032             bTagGenericAnalysisBlock,
0033             label = cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"),
0034             folder = cms.string("CSVv2")
0035         ),
0036 )
0037 
0038 """
0039 end customization
0040 """
0041 
0042 ###prints###
0043 print("is it MC ? : ", runOnMC)
0044 print("Global Tag : ", tag.globaltag)
0045 ############
0046 
0047 process.load("DQMServices.Components.DQMEnvironment_cfi")
0048 process.load("DQMServices.Core.DQM_cfg")
0049 process.load("JetMETCorrections.Configuration.JetCorrectors_cff")
0050 #keep the logging output to a nice level
0051 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0052 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0053 process.JECseq = cms.Sequence(process.ak4PFCHSL1FastL2L3CorrectorChain)
0054 
0055 if runOnMC:
0056     #for MC jet flavour
0057     process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi")
0058     process.load("PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi")
0059     process.ak4JetFlavourInfos.jets = cms.InputTag("ak4PFJetsCHS")
0060     process.ak4JetFlavourInfos.hadronFlavourHasPriority = cms.bool(True)
0061     process.flavourSeq = cms.Sequence(
0062         process.selectedHadronsAndPartons *
0063         process.ak4JetFlavourInfos
0064     )
0065     #Validation sequence
0066     process.load("Validation.RecoB.bTagAnalysis_cfi")
0067     process.bTagValidation.jetMCSrc = 'ak4JetFlavourInfos'
0068     process.bTagValidation.tagConfig = tagConfig
0069     process.bTagHarvestMC.tagConfig = tagConfig
0070     process.bTagValidation.flavPlots = flavPlots
0071     process.bTagHarvestMC.flavPlots = flavPlots
0072     process.bTagValidation.doPUid = cms.bool(PUid)
0073     process.bTagValidation.doJEC = applyJEC
0074     process.bTagValidation.JECsourceMC = cms.InputTag("ak4PFCHSL1FastL2L3Corrector")
0075     process.ak4GenJetsForPUid = cms.EDFilter("GenJetSelector",
0076                                              src = cms.InputTag("ak4GenJets"),
0077                                              cut = cms.string('pt > 8.'),
0078                                              filter = cms.bool(False)
0079                                              )
0080     process.load("PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi")
0081     process.patJetGenJetMatch.matched = cms.InputTag("ak4GenJetsForPUid")
0082     process.patJetGenJetMatch.maxDeltaR = cms.double(0.25)
0083     process.patJetGenJetMatch.resolveAmbiguities = cms.bool(True)
0084 else :
0085     process.load("DQMOffline.RecoB.bTagAnalysisData_cfi")
0086     process.bTagAnalysis.tagConfig = tagConfig
0087     process.bTagHarvest.tagConfig = tagConfig
0088     process.bTagAnalysis.doJEC = applyJEC
0089     process.bTagAnalysis.JECsourceData = cms.InputTag("ak4PFCHSL1FastL2L3ResidualCorrector")
0090     process.JECseq *= (process.ak4PFCHSResidualCorrector * process.ak4PFCHSL1FastL2L3ResidualCorrector)
0091 
0092 
0093 process.GlobalTag = tag
0094 
0095 process.maxEvents = cms.untracked.PSet(
0096     input = cms.untracked.int32(-1)
0097 )
0098 process.source = cms.Source("PoolSource",
0099     fileNames = cms.untracked.vstring()
0100 )
0101 
0102 if runOnMC:
0103     process.dqmSeq = cms.Sequence(process.ak4GenJetsForPUid * process.patJetGenJetMatch * process.flavourSeq * process.bTagValidation * process.bTagHarvestMC * process.dqmSaver)
0104 else:
0105     process.dqmSeq = cms.Sequence(process.bTagAnalysis * process.bTagHarvest * process.dqmSaver)
0106 
0107 process.plots = cms.Path(process.JECseq*process.dqmSeq)
0108     
0109 process.dqmEnv.subSystemFolder = 'BTAG'
0110 process.dqmSaver.producer = 'DQM'
0111 process.dqmSaver.workflow = '/POG/BTAG/BJET'
0112 process.dqmSaver.convention = 'Offline'
0113 process.dqmSaver.saveByRun = cms.untracked.int32(-1)
0114 process.dqmSaver.saveAtJobEnd =cms.untracked.bool(True) 
0115 process.dqmSaver.forceRunNumber = cms.untracked.int32(1)
0116 process.PoolSource.fileNames = [
0117 
0118 ]
0119