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 import Validation.RecoTau.ValidationUtils as Utils
0003 from Validation.RecoTau.RecoTauValidation_cfi import ApplyFunctionToSequence, SetValidationExtention
0004 import PhysicsTools.PatAlgos.tools.helpers as helpers
0005 
0006 proc = cms.Process('helper')
0007 
0008 proc.load('Validation.RecoTau.dataTypes.ValidateTausOnZTT_cff')# import *
0009 
0010 procAttributes = dir(proc) #Takes a snapshot of what there in the process
0011 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominatorZTT, 'FastSim') #clones the sequence inside the process with ZTT postfix
0012 helpers.cloneProcessingSnippet( proc, proc.TauEfficienciesZTT, 'FastSim') #clones the sequence inside the process with ZTT postfix
0013 proc.produceDenominatorZTTFastSim = helpers.cloneProcessingSnippet( proc, proc.produceDenominatorZTT, 'FastSim')
0014 
0015 #adds to TauValNumeratorAndDenominator modules in the sequence FastSim to the extention name
0016 zttLabeler = lambda module : SetValidationExtention(module, 'FastSim')
0017 zttModifier = ApplyFunctionToSequence(zttLabeler)
0018 proc.TauValNumeratorAndDenominatorZTTFastSim.visit(zttModifier)
0019 
0020 #Set discriminators
0021 discs_to_retain = ['ByDecayModeFinding', 'CombinedIsolationDBSumPtCorr3Hits', 'IsolationMVArun2v1DBoldDMwLT', 'IsolationMVArun2v1DBnewDMwLT', 'MuonRejection', 'ElectronRejection']
0022 proc.RunHPSValidationZTTFastSim.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZTTFastSim.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
0023 
0024 #Sets the correct naming to efficiency histograms
0025 proc.efficienciesZTTFastSim.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZTTFastSim)
0026 proc.efficienciesZTTFastSimSummary = cms.EDProducer("TauDQMHistEffProducer",
0027     plots = cms.PSet(
0028         Summary = cms.PSet(
0029             denominator = cms.string('RecoTauV/hpsPFTauProducerZTTFastSim_Summary/#PAR#PlotDen'),
0030             efficiency = cms.string('RecoTauV/hpsPFTauProducerZTTFastSim_Summary/#PAR#Plot'),
0031             numerator = cms.string('RecoTauV/hpsPFTauProducerZTTFastSim_Summary/#PAR#PlotNum'),
0032             parameter = cms.vstring('summary'),
0033             stepByStep = cms.bool(True)
0034         ),
0035     )
0036 )
0037 
0038 #checks what's new in the process (the cloned sequences and modules in them)
0039 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('FastSim') != -1)]
0040 
0041 #spawns a local variable with the same name as the proc attribute, needed for future process.load
0042 for newAttr in newProcAttributes:
0043     locals()[newAttr] = getattr(proc,newAttr)
0044 
0045 produceDenominator = cms.Sequence(produceDenominatorZTTFastSim)
0046 
0047 runTauValidationBatchMode = cms.Sequence(
0048       produceDenominatorZTTFastSim
0049       +TauValNumeratorAndDenominatorZTTFastSim
0050       )
0051 
0052 runTauValidation = cms.Sequence(
0053       runTauValidationBatchMode
0054       +TauEfficienciesZTTFastSim
0055       )
0056