Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-19 23:20:00

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.bTagMiniDQMTaggers import DeepCSVDiscriminators
0006 from DQMOffline.RecoB.bTagMiniDQMTaggers import DeepFlavourDiscriminators
0007 from DQMOffline.RecoB.bTagMiniDQMTaggers import ParticleNetPuppiCentralDiscriminators
0008 from DQMOffline.RecoB.bTagMiniDQMTaggers import ParticleNetPuppiForwardDiscriminators
0009 from DQMOffline.RecoB.bTagMiniDQMTaggers import UParTDiscriminators
0010 
0011 from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cff import patJets
0012 
0013 # add jets with pfSecondaryVertexTagInfos
0014 patJetsSVInfo = patJets.clone(
0015     tagInfoSources = ['pfSecondaryVertexTagInfos'],
0016     addTagInfos = True
0017 )
0018 patJetsSVInfoTask = cms.Task(patJetsSVInfo)
0019 
0020 
0021 bTagSVDQM = DQMEDAnalyzer('MiniAODSVAnalyzer', cms.PSet(
0022     JetTag = cms.InputTag('patJetsSVInfo'),
0023     svTagInfo = cms.string('pfSecondaryVertex'),
0024     ptMin = cms.double(30.),
0025     etaMax = cms.double(2.5),
0026    )
0027 )
0028 
0029 bTagMiniDQMGlobal = cms.PSet(
0030     JetTag = cms.InputTag('slimmedJetsPuppi'),
0031     MClevel = cms.int32(0),
0032     differentialPlots = cms.bool(True),
0033     ptActive = cms.bool(False),
0034     ptMin = cms.double(30.),
0035     ptMax = cms.double(40000.),
0036 )
0037 bTagMiniValidationGlobal = bTagMiniDQMGlobal.clone(
0038     MClevel = 1 # produce flavour plots for b, c ,light (dusg)
0039 )
0040 bTagMiniValidationGlobalUParT = bTagMiniDQMGlobal.clone(
0041     MClevel = 4 # produce flavour plots for b, c ,light (dusg)
0042 )
0043 
0044 # Eta regions
0045 Etaregions = {
0046     'Global': cms.PSet(
0047         etaActive = cms.bool(False),
0048         etaMin = cms.double(0.),
0049         etaMax = cms.double(2.5),
0050     ),
0051     'Barrel': cms.PSet(
0052         etaActive = cms.bool(True),
0053         etaMin = cms.double(0.),
0054         etaMax = cms.double(1.4),
0055     ),
0056     'Endcap': cms.PSet(
0057         etaActive = cms.bool(True),
0058         etaMin = cms.double(1.4),
0059         etaMax = cms.double(2.5),
0060     ),
0061 }
0062 
0063 
0064 def addSequences(Analyzer, Harvester, discriminators, regions, globalPSet, label='bTag'):
0065     for discr in discriminators.keys():
0066         for region in regions.keys():
0067             name = label + discr + region
0068 
0069             globals()[name + 'Analyzer'] = DQMEDAnalyzer('MiniAODTaggerAnalyzer',    cms.PSet(globalPSet, discriminators[discr], regions[region]))
0070             globals()[name + 'Harvester'] = DQMEDHarvester('MiniAODTaggerHarvester', cms.PSet(globalPSet, discriminators[discr], regions[region]))
0071 
0072             Analyzer.insert(-1, globals()[name + 'Analyzer'])
0073             Harvester.insert(-1, globals()[name + 'Harvester'])
0074 
0075 #
0076 #
0077 #
0078 taggersToAnalyze = {
0079     'bTagDeepFlavour': {
0080         'discriminators': DeepFlavourDiscriminators,
0081         'regions':Etaregions
0082     },
0083     'bTagDeepCSV': {
0084         'discriminators': DeepCSVDiscriminators,
0085         'regions':Etaregions
0086     },
0087     'bTagParticleNetCentral': {
0088         'discriminators': ParticleNetPuppiCentralDiscriminators,
0089         'regions': Etaregions
0090     },
0091     'bTagParticleNetForward': {
0092         'discriminators': ParticleNetPuppiForwardDiscriminators,
0093         'regions': {
0094             'Forward': cms.PSet(
0095                 etaActive = cms.bool(True),
0096                 etaMin = cms.double(2.5),
0097                 etaMax = cms.double(5.0),
0098             ),
0099         },
0100     },
0101     'bTagUParT': {
0102         'discriminators': UParTDiscriminators,
0103         'regions': Etaregions
0104     }
0105 }
0106 
0107 # For DQM
0108 bTagMiniDQMSource = cms.Sequence(bTagSVDQM, patJetsSVInfoTask)
0109 bTagMiniDQMHarvesting = cms.Sequence()
0110 
0111 # For Validation
0112 bTagMiniValidationSource = cms.Sequence(bTagSVDQM, patJetsSVInfoTask)
0113 bTagMiniValidationHarvesting = cms.Sequence()
0114 
0115 for tagger in taggersToAnalyze:
0116 
0117     # DQM
0118     addSequences(bTagMiniDQMSource,
0119                  bTagMiniDQMHarvesting,
0120                  discriminators=taggersToAnalyze[tagger]['discriminators'],
0121                  regions=taggersToAnalyze[tagger]['regions'],
0122                  globalPSet=bTagMiniDQMGlobal,
0123                  label=tagger+'DQM')
0124 
0125     # Validation
0126     addSequences(bTagMiniValidationSource,
0127                  bTagMiniValidationHarvesting,
0128                  discriminators=taggersToAnalyze[tagger]['discriminators'],
0129                  regions=taggersToAnalyze[tagger]['regions'],
0130                  globalPSet=bTagMiniValidationGlobalUParT if "UParT" in tagger else bTagMiniValidationGlobal,
0131                  label=tagger+'Validation')
0132 
0133 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0134 from Configuration.ProcessModifiers.miniAOD_skip_trackExtras_cff import miniAOD_skip_trackExtras
0135 
0136 _mAOD = (pp_on_AA | miniAOD_skip_trackExtras)
0137 _mAOD.toReplaceWith(bTagMiniDQMSource, bTagMiniDQMSource.copyAndExclude([bTagSVDQM, patJetsSVInfoTask]))
0138 _mAOD.toReplaceWith(bTagMiniValidationSource, bTagMiniValidationSource.copyAndExclude([bTagSVDQM, patJetsSVInfoTask]))