Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-18 23:23:11

0001 import FWCore.ParameterSet.Config as cms
0002 from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
0003 from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
0004 
0005 from DQMOffline.RecoB.bTagMiniDQMDeepFlavour import *
0006 from DQMOffline.RecoB.bTagMiniDQMDeepCSV import *
0007 
0008 from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cff import patJets
0009 
0010 
0011 
0012 # add jets with pfSecondaryVertexTagInfos
0013 patJetsSVInfo = patJets.clone(
0014     tagInfoSources = ['pfSecondaryVertexTagInfos'],
0015     addTagInfos = True
0016 )
0017 patJetsSVInfoTask = cms.Task(patJetsSVInfo)
0018 
0019 
0020 bTagSVDQM = DQMEDAnalyzer('MiniAODSVAnalyzer',
0021                           cms.PSet(JetTag = cms.InputTag('patJetsSVInfo'),
0022                                    svTagInfo = cms.string('pfSecondaryVertex'),
0023                                    ptMin = cms.double(30.),
0024                                    etaMax = cms.double(2.5),
0025                                    )
0026                           )
0027 
0028 
0029 bTagMiniDQMGlobal = cms.PSet(
0030     JetTag = cms.InputTag('slimmedJets'),
0031     MClevel = cms.int32(0),
0032     differentialPlots = cms.bool(True),
0033 
0034     ptActive = cms.bool(False),
0035     ptMin = cms.double(30.),
0036     ptMax = cms.double(40000.),
0037 )
0038 
0039 
0040 # Eta regions
0041 Etaregions = {
0042     'Global': cms.PSet(
0043         etaActive = cms.bool(False),
0044         etaMin = cms.double(0.),
0045         etaMax = cms.double(2.5),
0046     ),
0047 
0048     'Barrel': cms.PSet(
0049         etaActive = cms.bool(True),
0050         etaMin = cms.double(0.),
0051         etaMax = cms.double(1.4),
0052     ),
0053 
0054     'Endcap': cms.PSet(
0055         etaActive = cms.bool(True),
0056         etaMin = cms.double(1.4),
0057         etaMax = cms.double(2.5),
0058     ),
0059 }
0060 
0061 
0062 def addSequences(Analyzer, Harvester, discriminators, regions, globalPSet, label='bTag'):
0063     for discr in discriminators.keys():
0064         for region in regions.keys():
0065             name = label + discr + region
0066 
0067             globals()[name + 'Analyzer'] = DQMEDAnalyzer('MiniAODTaggerAnalyzer',    cms.PSet(globalPSet, discriminators[discr], regions[region]))
0068             globals()[name + 'Harvester'] = DQMEDHarvester('MiniAODTaggerHarvester', cms.PSet(globalPSet, discriminators[discr], regions[region]))
0069 
0070             Analyzer.insert(-1, globals()[name + 'Analyzer'])
0071             Harvester.insert(-1, globals()[name + 'Harvester'])
0072 
0073 
0074 
0075 bTagMiniDQMSource = cms.Sequence(bTagSVDQM, patJetsSVInfoTask)
0076 bTagMiniDQMHarvesting = cms.Sequence()
0077 
0078 addSequences(bTagMiniDQMSource,
0079              bTagMiniDQMHarvesting,
0080              discriminators=DeepFlavourDiscriminators,
0081              regions=Etaregions,
0082              globalPSet=bTagMiniDQMGlobal,
0083              label='bTagDeepFlavourDQM')
0084 
0085 addSequences(bTagMiniDQMSource,
0086              bTagMiniDQMHarvesting,
0087              discriminators=DeepCSVDiscriminators,
0088              regions=Etaregions,
0089              globalPSet=bTagMiniDQMGlobal,
0090              label='bTagDeepCSVDQM')
0091 
0092 
0093 
0094 # Validation addSequences
0095 
0096 bTagMiniValidationGlobal = bTagMiniDQMGlobal.clone(
0097     MClevel = 1 # produce flavour plots for b, c ,light (dusg)
0098 )
0099 
0100 bTagMiniValidationSource = cms.Sequence(bTagSVDQM, patJetsSVInfoTask)
0101 bTagMiniValidationHarvesting = cms.Sequence()
0102 
0103 
0104 addSequences(bTagMiniValidationSource,
0105              bTagMiniValidationHarvesting,
0106              discriminators=DeepFlavourDiscriminators,
0107              regions={'Global': Etaregions['Global']}, # only for global Eta range
0108              globalPSet=bTagMiniValidationGlobal,
0109              label='bTagDeepFlavourValidation')
0110 
0111 addSequences(bTagMiniValidationSource,
0112              bTagMiniValidationHarvesting,
0113              discriminators=DeepCSVDiscriminators,
0114              regions={'Global': Etaregions['Global']}, # only for global Eta range
0115              globalPSet=bTagMiniValidationGlobal,
0116              label='bTagDeepCSVValidation')
0117 
0118 
0119 
0120 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0121 from Configuration.ProcessModifiers.miniAOD_skip_trackExtras_cff import miniAOD_skip_trackExtras
0122 from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
0123 
0124 _mAOD = (pp_on_AA | miniAOD_skip_trackExtras | run2_miniAOD_94XFall17)
0125 _mAOD.toReplaceWith(bTagMiniDQMSource, bTagMiniDQMSource.copyAndExclude([bTagSVDQM, patJetsSVInfoTask]))
0126 _mAOD.toReplaceWith(bTagMiniValidationSource, bTagMiniValidationSource.copyAndExclude([bTagSVDQM, patJetsSVInfoTask]))