CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Validation/RecoTau/python/dataTypes/ValidateTausOnZTT_cff.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 from Validation.RecoTau.RecoTauValidation_cfi import *
00003 
00004 from PhysicsTools.JetMCAlgos.TauGenJets_cfi import tauGenJets
00005 from PhysicsTools.HepMCCandAlgos.genParticles_cfi import *
00006 import PhysicsTools.PatAlgos.tools.helpers as helpers
00007 
00008 # require generated tau to decay hadronically
00009 objectTypeSelectedTauValDenominatorModuleZTT = cms.EDFilter("TauGenJetDecayModeSelector",
00010      src = cms.InputTag("tauGenJets"),
00011      select = cms.vstring('oneProng0Pi0', 'oneProng1Pi0', 'oneProng2Pi0', 'oneProngOther',
00012                           'threeProng0Pi0', 'threeProng1Pi0', 'threeProngOther', 'rare'),
00013      filter = cms.bool(False)
00014 )
00015 
00016 # require generator level hadrons produced in tau-decay to have transverse momentum above threshold
00017 kinematicSelectedTauValDenominatorZTT = cms.EDFilter(
00018    "GenJetSelector", #"GenJetSelector"
00019    src = cms.InputTag('objectTypeSelectedTauValDenominatorModuleZTT'),
00020    cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi 
00021    filter = cms.bool(False)
00022 )
00023 
00024 procAttributes = dir(proc) #Takes a snapshot of what there in the process
00025 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZTT') #clones the sequence inside the process with ZTT postfix
00026 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZTT') #clones the sequence inside the process with ZTT postfix
00027 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZTT, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZTT') #sets the correct input tag
00028 
00029 #adds to TauValNumeratorAndDenominator modules in the sequence ZTT to the extention name
00030 zttLabeler = lambda module : SetValidationExtention(module, 'ZTT')
00031 zttModifier = ApplyFunctionToSequence(zttLabeler)
00032 proc.TauValNumeratorAndDenominatorZTT.visit(zttModifier)
00033 
00034 #Sets the correct naming to efficiency histograms
00035 proc.efficienciesZTT.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZTT)
00036 
00037 #checks what's new in the process (the cloned sequences and modules in them)
00038 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('ZTT') != -1), dir(proc) )
00039 
00040 #spawns a local variable with the same name as the proc attribute, needed for future process.load
00041 for newAttr in newProcAttributes:
00042     locals()[newAttr] = getattr(proc,newAttr)
00043 
00044 produceDenominatorZTT = cms.Sequence(
00045       tauGenJets
00046       +objectTypeSelectedTauValDenominatorModuleZTT
00047       +kinematicSelectedTauValDenominatorZTT
00048       )
00049 
00050 produceDenominator = produceDenominatorZTT
00051 
00052 runTauValidationBatchMode = cms.Sequence(
00053       produceDenominatorZTT
00054       +TauValNumeratorAndDenominatorZTT
00055       )
00056 
00057 runTauValidation = cms.Sequence(
00058       runTauValidationBatchMode
00059       +TauEfficienciesZTT
00060       )
00061