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 MuPrimaryVertexFilter = cms.EDFilter(
00009 "VertexSelector",
00010 src = cms.InputTag("offlinePrimaryVertices"),
00011 cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
00012 filter = cms.bool(False)
00013 )
00014
00015 MuBestPV = cms.EDProducer(
00016 "HighestSumP4PrimaryVertexSelector",
00017 src = cms.InputTag("MuPrimaryVertexFilter")
00018 )
00019
00020 selectedMuons = cms.EDFilter(
00021 "MuonSelector",
00022 src = cms.InputTag('muons'),
00023 cut = cms.string("pt > 20.0 && abs(eta) < 2.1 && isGlobalMuon = 1 && isTrackerMuon = 1"),
00024 filter = cms.bool(False)
00025 )
00026
00027 selectedMuonsIso = cms.EDFilter(
00028 "MuonSelector",
00029 src = cms.InputTag('selectedMuons'),
00030 cut = cms.string('(isolationR03().emEt + isolationR03().hadEt + isolationR03().sumPt)/pt < 0.15'),
00031 filter = cms.bool(False)
00032 )
00033
00034 MuonsFromPV = cms.EDProducer(
00035 "MuonFromPVSelector",
00036 srcMuon = cms.InputTag("selectedMuonsIso"),
00037 srcVertex = cms.InputTag("MuBestPV"),
00038 max_dxy = cms.double(0.01),
00039 max_dz = cms.double(0.1)
00040 )
00041
00042 from SimGeneral.HepPDTESSource.pythiapdt_cfi import *
00043
00044 MuGoodTracks = cms.EDFilter("TrackSelector",
00045 src = cms.InputTag("generalTracks"),
00046 cut = cms.string("pt > 5 && abs(eta) < 2.5"),
00047 filter = cms.bool(False)
00048 )
00049
00050 MuIsoTracks = cms.EDProducer(
00051 "IsoTracks",
00052 src = cms.InputTag("MuGoodTracks"),
00053 radius = cms.double(0.3),
00054 SumPtFraction = cms.double(0.5)
00055 )
00056
00057 MuTrackFromPV = cms.EDProducer(
00058 "TrackFromPVSelector",
00059 srcTrack = cms.InputTag("MuIsoTracks"),
00060 srcVertex = cms.InputTag("MuBestPV"),
00061 max_dxy = cms.double(0.01),
00062 max_dz = cms.double(0.1)
00063 )
00064
00065 MuTrackCands = cms.EDProducer(
00066 "ConcreteChargedCandidateProducer",
00067 src = cms.InputTag("MuTrackFromPV"),
00068 particleType = cms.string("mu+")
00069 )
00070
00071 ZmmCandMuonTrack = cms.EDProducer(
00072 "CandViewShallowCloneCombiner",
00073 decay = cms.string("MuonsFromPV@+ MuTrackCands@-"),
00074 cut = cms.string("80 < mass < 100")
00075 )
00076
00077 BestZmm = cms.EDProducer("BestMassZArbitrationProducer",
00078 ZCandidateCollection = cms.InputTag("ZmmCandMuonTrack")
00079 )
00080
00081 MuZLegs = cms.EDProducer("CollectionFromZLegProducer",
00082 ZCandidateCollection = cms.InputTag("BestZmm"),
00083 )
00084
00085 procAttributes = dir(proc)
00086 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'RealMuonsData')
00087 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'RealMuonsData')
00088 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorRealMuonsData, 'kinematicSelectedTauValDenominator', cms.InputTag("MuZLegs","theProbeLeg"))
00089
00090
00091 zttLabeler = lambda module : SetValidationExtention(module, 'RealMuonsData')
00092 zttModifier = ApplyFunctionToSequence(zttLabeler)
00093 proc.TauValNumeratorAndDenominatorRealMuonsData.visit(zttModifier)
00094
00095 binning = cms.PSet(
00096 pt = cms.PSet( nbins = cms.int32(10), min = cms.double(0.), max = cms.double(100.) ),
00097 eta = cms.PSet( nbins = cms.int32(4), min = cms.double(-3.), max = cms.double(3.) ),
00098 phi = cms.PSet( nbins = cms.int32(4), min = cms.double(-180.), max = cms.double(180.) ),
00099 pileup = cms.PSet( nbins = cms.int32(18), min = cms.double(0.), max = cms.double(72.) ),
00100 )
00101 zttModifier = ApplyFunctionToSequence(lambda m: setBinning(m,binning))
00102 proc.TauValNumeratorAndDenominatorRealMuonsData.visit(zttModifier)
00103
00104
00105
00106 proc.efficienciesRealMuonsData.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorRealMuonsData)
00107
00108
00109 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('RealMuonsData') != -1), dir(proc) )
00110
00111
00112 for newAttr in newProcAttributes:
00113 locals()[newAttr] = getattr(proc,newAttr)
00114
00115 produceDenominatorRealMuonsData = cms.Sequence(
00116 MuPrimaryVertexFilter * MuBestPV *
00117 ( ( selectedMuons * selectedMuonsIso * MuonsFromPV ) +
00118 ( MuGoodTracks * MuIsoTracks * MuTrackFromPV * MuTrackCands ) ) *
00119 ZmmCandMuonTrack *
00120 BestZmm *
00121 MuZLegs
00122 )
00123
00124 produceDenominator = produceDenominatorRealMuonsData
00125
00126 runTauValidationBatchMode = cms.Sequence(
00127 produceDenominator
00128 +TauValNumeratorAndDenominatorRealMuonsData
00129 )
00130
00131 runTauValidation = cms.Sequence(
00132 runTauValidationBatchMode
00133 +TauEfficienciesRealMuonsData
00134 )