Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:07:18

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 import PhysicsTools.PatAlgos.tools.helpers as helpers
0009 
0010 kinematicSelectedTauValDenominatorQCD = cms.EDFilter(
0011     "GenJetSelector",
0012     src = cms.InputTag('slimmedGenJets'),
0013     cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi 
0014     filter = cms.bool(False)
0015 )
0016 
0017 procAttributes = dir(proc) #Takes a snapshot of what there in the process
0018 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'QCD') #clones the sequence inside the process with QCD postfix
0019 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'QCD') #clones the sequence inside the process with QCD postfix
0020 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorQCD, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorQCD') #sets the correct input tag
0021 
0022 #adds to TauValNumeratorAndDenominator modules in the sequence QCD to the extention name
0023 zttLabeler = lambda module : SetValidationExtention(module, 'QCD')
0024 zttModifier = ApplyFunctionToSequence(zttLabeler)
0025 proc.TauValNumeratorAndDenominatorQCD.visit(zttModifier)
0026 
0027 #Set discriminators
0028 discs_to_retain = ['ByDecayModeFinding', 'CombinedIsolationDBSumPtCorr3Hits', 'IsolationMVArun2v1DBoldDMwLT', 'IsolationMVArun2v1DBnewDMwLT']
0029 proc.RunHPSValidationQCD.discriminators = cms.VPSet([p for p in proc.RunHPSValidationQCD.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
0030 
0031 #Sets the correct naming to efficiency histograms
0032 proc.efficienciesQCD.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorQCD)
0033 proc.efficienciesQCDSummary = cms.EDProducer("TauDQMHistEffProducer",
0034     plots = cms.PSet(
0035         Summary = cms.PSet(
0036             denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerQCD_Summary/#PAR#PlotDen'),
0037             efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerQCD_Summary/#PAR#Plot'),
0038             numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerQCD_Summary/#PAR#PlotNum'),
0039             parameter = cms.vstring('summary'),
0040             stepByStep = cms.bool(True)
0041         ),
0042     )
0043 )
0044 
0045 #checks what's new in the process (the cloned sequences and modules in them)
0046 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('QCD') != -1)]
0047 
0048 #spawns a local variable with the same name as the proc attribute, needed for future process.load
0049 for newAttr in newProcAttributes:
0050     locals()[newAttr] = getattr(proc,newAttr)
0051 
0052 produceDenominatorQCD = cms.Sequence(
0053     cms.ignore(kinematicSelectedTauValDenominatorQCD)
0054 )
0055 
0056 produceDenominator = cms.Sequence(produceDenominatorQCD)
0057 
0058 runTauValidationBatchMode = cms.Sequence(
0059     produceDenominatorQCD
0060     +TauValNumeratorAndDenominatorQCD
0061     )
0062 
0063 runTauValidation = cms.Sequence(
0064     runTauValidationBatchMode
0065     +TauEfficienciesQCD
0066     )