Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:18

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.ValidateTausOnZEE_cff')# import *
0009 
0010 procAttributes = dir(proc) #Takes a snapshot of what there in the process
0011 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominatorZEE, 'FastSim') #clones the sequence inside the process with ZEE postfix
0012 helpers.cloneProcessingSnippet( proc, proc.TauEfficienciesZEE, 'FastSim') #clones the sequence inside the process with ZEE postfix
0013 proc.produceDenominatorZEEFastSim = helpers.cloneProcessingSnippet( proc, proc.produceDenominatorZEE, '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.TauValNumeratorAndDenominatorZEEFastSim.visit(zttModifier)
0019 
0020 #Set discriminators
0021 discs_to_retain = ['ByDecayModeFinding', 'ElectronRejection']
0022 proc.RunHPSValidationZEEFastSim.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZEEFastSim.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.efficienciesZEEFastSim.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZEEFastSim)
0026 proc.efficienciesZEEFastSimSummary = cms.EDProducer("TauDQMHistEffProducer",
0027     plots = cms.PSet(
0028         Summary = cms.PSet(
0029             denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEEFastSim_Summary/#PAR#PlotDen'),
0030             efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEEFastSim_Summary/#PAR#Plot'),
0031             numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEEFastSim_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(produceDenominatorZEEFastSim)
0046 
0047 runTauValidationBatchMode = cms.Sequence(
0048       produceDenominatorZEEFastSim
0049       +TauValNumeratorAndDenominatorZEEFastSim
0050       )
0051 
0052 runTauValidation = cms.Sequence(
0053       runTauValidationBatchMode
0054       +TauEfficienciesZEEFastSim
0055       )