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