Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 from Validation.RecoTau.RecoTauValidation_cfi import *
0003 import copy
0004 
0005 from PhysicsTools.HepMCCandAlgos.genParticles_cfi import *
0006 from RecoJets.Configuration.RecoGenJets_cff import *
0007 from RecoJets.Configuration.GenJetParticles_cff import *
0008 
0009 from SimGeneral.HepPDTESSource.pythiapdt_cfi import *
0010 import PhysicsTools.PatAlgos.tools.helpers as helpers
0011 
0012 selectMuons = cms.EDProducer(
0013     "GenParticlePruner",
0014     src = cms.InputTag("genParticles"),
0015     select = cms.vstring(
0016     "drop  *  ", # this is the default
0017     "keep++ pdgId = 13",
0018     "keep++ pdgId = -13",
0019     )
0020 )
0021 
0022 selectStableMuons = genParticlesForJets.clone(src = cms.InputTag("selectMuons"))
0023 
0024 kinematicSelectedTauValDenominatorZMM = cms.EDFilter(
0025    "CandPtrSelector",
0026    src = cms.InputTag('selectStableMuons'),
0027    cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi 
0028    filter = cms.bool(False)
0029 )
0030 
0031 procAttributes = dir(proc) #Takes a snapshot of what there in the process
0032 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZMM') #clones the sequence inside the process with ZMM postfix
0033 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZMM') #clones the sequence inside the process with ZMM postfix
0034 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZMM, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZMM') #sets the correct input tag
0035 
0036 #adds to TauValNumeratorAndDenominator modules in the sequence ZMM to the extention name
0037 zttLabeler = lambda module : SetValidationExtention(module, 'ZMM')
0038 zttModifier = ApplyFunctionToSequence(zttLabeler)
0039 proc.TauValNumeratorAndDenominatorZMM.visit(zttModifier)
0040 
0041 #Set discriminators
0042 discs_to_retain = ['ByDecayModeFinding', 'MuonRejection']
0043 proc.RunHPSValidationZMM.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZMM.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
0044 
0045 #Sets the correct naming to efficiency histograms
0046 proc.efficienciesZMM.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZMM)
0047 proc.efficienciesZMMSummary = cms.EDProducer("TauDQMHistEffProducer",
0048     plots = cms.PSet(
0049         Summary = cms.PSet(
0050             denominator = cms.string('RecoTauV/hpsPFTauProducerZMM_Summary/#PAR#PlotDen'),
0051             efficiency = cms.string('RecoTauV/hpsPFTauProducerZMM_Summary/#PAR#Plot'),
0052             numerator = cms.string('RecoTauV/hpsPFTauProducerZMM_Summary/#PAR#PlotNum'),
0053             parameter = cms.vstring('summary'),
0054             stepByStep = cms.bool(True)
0055         ),
0056     )
0057 )
0058 
0059 #checks what's new in the process (the cloned sequences and modules in them)
0060 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('ZMM') != -1)]
0061 
0062 #spawns a local variable with the same name as the proc attribute, needed for future process.load
0063 for newAttr in newProcAttributes:
0064     locals()[newAttr] = getattr(proc,newAttr)
0065 
0066 produceDenominatorZMM = cms.Sequence(
0067       selectMuons
0068       +selectStableMuons
0069 #      +objectTypeSelectedTauValDenominatorModule
0070       +kinematicSelectedTauValDenominatorZMM
0071       )
0072 
0073 produceDenominator = cms.Sequence(produceDenominatorZMM)
0074 
0075 runTauValidationBatchMode = cms.Sequence(
0076       produceDenominatorZMM
0077       +TauValNumeratorAndDenominatorZMM
0078       )
0079 
0080 runTauValidation = cms.Sequence(
0081       runTauValidationBatchMode
0082       +TauEfficienciesZMM
0083       )
0084