CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 from Validation.RecoTau.RecoTauValidation_cfi import *
00003 import copy
00004 
00005 from RecoJets.Configuration.RecoPFJets_cff import *
00006 import PhysicsTools.PatAlgos.tools.helpers as helpers
00007 
00008 kinematicSelectedPFJets = cms.EDFilter(
00009     "TauValPFJetSelector",
00010     src = cms.InputTag('ak5PFJets'),
00011     cut = cms.string("pt > 15 & abs(eta) < 2.5"),
00012     filter = cms.bool(False)
00013         )
00014 
00015 PFJetsId = cms.EDFilter(
00016     "TauValPFJetSelector",
00017     src = cms.InputTag('kinematicSelectedPFJets'),
00018     cut = cms.string("chargedHadronEnergyFraction > 0.0 & neutralHadronEnergyFraction < 0.99 & neutralHadronEnergyFraction < 0.99 & chargedEmEnergyFraction < 0.99 & chargedEmEnergyFraction < 0.99 & neutralEmEnergyFraction < 0.99 & chargedMultiplicity > 0 & nConstituents > 1"),
00019     filter = cms.bool(False)
00020         )
00021 
00022 CleanedPFJets = cms.EDProducer("TauValJetViewCleaner",
00023     srcObject            = cms.InputTag( "kinematicSelectedPFJets" ),
00024     srcObjectsToRemove   = cms.VInputTag( cms.InputTag("muons"), cms.InputTag("gsfElectrons") ),
00025     deltaRMin            = cms.double(0.15)
00026 )
00027 
00028 procAttributes = dir(proc) #Takes a snapshot of what there in the process
00029 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'RealData') #clones the sequence inside the process with RealData postfix
00030 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'RealData') #clones the sequence inside the process with RealData postfix
00031 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorRealData, 'kinematicSelectedTauValDenominator', 'CleanedPFJets') #sets the correct input tag
00032 
00033 #adds to TauValNumeratorAndDenominator modules in the sequence RealData to the extention name
00034 zttLabeler = lambda module : SetValidationExtention(module, 'RealData')
00035 zttModifier = ApplyFunctionToSequence(zttLabeler)
00036 proc.TauValNumeratorAndDenominatorRealData.visit(zttModifier)
00037 
00038 binning = cms.PSet(
00039         pt = cms.PSet( nbins = cms.int32(25), min = cms.double(0.), max = cms.double(250.) ), #hinfo(75, 0., 150.)
00040         eta = cms.PSet( nbins = cms.int32(4), min = cms.double(-3.), max = cms.double(3.) ), #hinfo(60, -3.0, 3.0);
00041         phi = cms.PSet( nbins = cms.int32(4), min = cms.double(-180.), max = cms.double(180.) ), #hinfo(36, -180., 180.);
00042         pileup = cms.PSet( nbins = cms.int32(18), min = cms.double(0.), max = cms.double(72.) ),#hinfo(25, 0., 25.0);
00043         )
00044 zttModifier = ApplyFunctionToSequence(lambda m: setBinning(m,binning))
00045 proc.TauValNumeratorAndDenominatorRealData.visit(zttModifier)
00046 #-----------------------------------------
00047 
00048 #Sets the correct naming to efficiency histograms
00049 proc.efficienciesRealData.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorRealData)
00050 
00051 #checks what's new in the process (the cloned sequences and modules in them)
00052 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('RealData') != -1), dir(proc) )
00053 
00054 #spawns a local variable with the same name as the proc attribute, needed for future process.load
00055 for newAttr in newProcAttributes:
00056     locals()[newAttr] = getattr(proc,newAttr)
00057 
00058 
00059 produceDenominatorRealData = cms.Sequence(
00060       kinematicSelectedPFJets * 
00061       PFJetsId * 
00062       CleanedPFJets
00063       )
00064 
00065 produceDenominator = cms.Sequence(produceDenominatorRealData)
00066 
00067 runTauValidationBatchMode = cms.Sequence(
00068       produceDenominatorRealData
00069       +TauValNumeratorAndDenominatorRealData
00070       )
00071 
00072 runTauValidation = cms.Sequence(
00073       runTauValidationBatchMode
00074       +TauEfficienciesRealData
00075       )