File indexing completed on 2024-04-06 12:33:18
0001 import FWCore.ParameterSet.Config as cms
0002 from Validation.RecoTau.RecoTauValidation_cfi import *
0003 import copy
0004
0005 from RecoJets.Configuration.RecoPFJets_cff import *
0006 import PhysicsTools.PatAlgos.tools.helpers as helpers
0007
0008 ElPrimaryVertexFilter = cms.EDFilter(
0009 "VertexSelector",
0010 src = cms.InputTag("offlinePrimaryVertices"),
0011 cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
0012 filter = cms.bool(False)
0013 )
0014
0015 ElBestPV = cms.EDProducer(
0016 "HighestSumP4PrimaryVertexSelector",
0017 src = cms.InputTag("ElPrimaryVertexFilter")
0018 )
0019
0020 selectedElectrons = cms.EDFilter(
0021 "TauValElectronSelector",
0022 src = cms.InputTag('gedGsfElectrons'),
0023 cut = cms.string("pt > 25.0 && abs(eta) < 2.4 && isElectron"),
0024 filter = cms.bool(False)
0025 )
0026
0027 ElectronsFromPV = cms.EDProducer(
0028 "GsfElectronFromPVSelector",
0029 srcElectron = cms.InputTag("selectedElectrons"),
0030 srcVertex = cms.InputTag("ElBestPV"),
0031 max_dxy = cms.double(0.01),
0032 max_dz = cms.double(0.1)
0033 )
0034
0035 idElectrons = cms.EDFilter(
0036 "TauValElectronSelector",
0037 src = cms.InputTag('ElectronsFromPV'),
0038 cut = cms.string('ecalDrivenSeed & isGsfCtfScPixChargeConsistent & isGsfScPixChargeConsistent & isGsfCtfChargeConsistent & !isEBEEGap & (isEB & sigmaIetaIeta<0.01 & abs(deltaPhiSuperClusterTrackAtVtx)<0.06 & abs(deltaEtaSuperClusterTrackAtVtx)<0.006 & hadronicOverEm<0.04 | isEE & sigmaIetaIeta<0.03 & abs(deltaPhiSuperClusterTrackAtVtx)<0.04 & abs(deltaEtaSuperClusterTrackAtVtx)<0.007 & hadronicOverEm<0.025)'),
0039 filter = cms.bool(False)
0040 )
0041
0042 trackElectrons = cms.EDFilter(
0043 "TauValElectronSelector",
0044 src = cms.InputTag('idElectrons'),
0045 cut = cms.string('gsfTrack.isNonnull && 0.7 < eSuperClusterOverP < 1.5'),
0046
0047 filter = cms.bool(False)
0048 )
0049
0050 isolatedElectrons = cms.EDFilter(
0051 "TauValElectronSelector",
0052 src = cms.InputTag('trackElectrons'),
0053 cut = cms.string("(isEB & (dr04TkSumPt/pt + max(0.,dr04EcalRecHitSumEt-2.)/pt + dr04HcalTowerSumEt/pt < 0.10)) | (isEE & (dr04TkSumPt/pt + dr04EcalRecHitSumEt/pt + dr04HcalTowerSumEt/pt < 0.09))"),
0054 filter = cms.bool(False)
0055 )
0056
0057 from SimGeneral.HepPDTESSource.pythiapdt_cfi import *
0058
0059 ElGoodTracks = cms.EDFilter(
0060 "TrackSelector",
0061 src = cms.InputTag("generalTracks"),
0062 cut = cms.string("pt > 5 && abs(eta) < 2.5"),
0063 filter = cms.bool(False)
0064 )
0065
0066 ElIsoTracks = cms.EDProducer(
0067 "IsoTracks",
0068 src = cms.InputTag("ElGoodTracks"),
0069 radius = cms.double(0.3),
0070 SumPtFraction = cms.double(0.5)
0071 )
0072
0073 ElTrackFromPV = cms.EDProducer(
0074 "TrackFromPVSelector",
0075 srcTrack = cms.InputTag("ElIsoTracks"),
0076 srcVertex = cms.InputTag("ElBestPV"),
0077 max_dxy = cms.double(0.01),
0078 max_dz = cms.double(0.1)
0079 )
0080
0081 ElTrackCands = cms.EDProducer(
0082 "ConcreteChargedCandidateProducer",
0083 src = cms.InputTag("ElTrackFromPV"),
0084 particleType = cms.string("e+")
0085 )
0086
0087 ZeeCandElectronTrack = cms.EDProducer(
0088 "CandViewShallowCloneCombiner",
0089 decay = cms.string("isolatedElectrons@+ ElTrackCands@-"),
0090 cut = cms.string("80 < mass < 100")
0091 )
0092
0093 BestZee = cms.EDProducer(
0094 "BestMassZArbitrationProducer",
0095 ZCandidateCollection = cms.InputTag("ZeeCandElectronTrack")
0096 )
0097
0098 ElZLegs = cms.EDProducer(
0099 "CollectionFromZLegProducer",
0100 ZCandidateCollection = cms.InputTag("BestZee"),
0101 )
0102
0103 procAttributes = dir(proc)
0104 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'RealElectronsData')
0105 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'RealElectronsData')
0106 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorRealElectronsData, 'kinematicSelectedTauValDenominator', cms.InputTag("ElZLegs","theProbeLeg"))
0107
0108
0109 zttLabeler = lambda module : SetValidationExtention(module, 'RealElectronsData')
0110 zttModifier = ApplyFunctionToSequence(zttLabeler)
0111 proc.TauValNumeratorAndDenominatorRealElectronsData.visit(zttModifier)
0112
0113 binning = cms.PSet(
0114 pt = cms.PSet( nbins = cms.int32(10), min = cms.double(0.), max = cms.double(100.) ),
0115 eta = cms.PSet( nbins = cms.int32(4), min = cms.double(-3.), max = cms.double(3.) ),
0116 phi = cms.PSet( nbins = cms.int32(4), min = cms.double(-180.), max = cms.double(180.) ),
0117 pileup = cms.PSet( nbins = cms.int32(18), min = cms.double(0.), max = cms.double(72.) ),
0118 )
0119 zttModifier = ApplyFunctionToSequence(lambda m: setBinning(m,binning))
0120 proc.TauValNumeratorAndDenominatorRealElectronsData.visit(zttModifier)
0121
0122
0123
0124 discs_to_retain = ['ByDecayModeFinding', 'ElectronRejection']
0125 proc.RunHPSValidationRealElectronsData.discriminators = cms.VPSet([p for p in proc.RunHPSValidationRealElectronsData.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
0126
0127
0128 proc.efficienciesRealElectronsData.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorRealElectronsData)
0129 proc.efficienciesRealElectronsDataSummary = cms.EDProducer("TauDQMHistEffProducer",
0130 plots = cms.PSet(
0131 Summary = cms.PSet(
0132 denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_Summary/#PAR#PlotDen'),
0133 efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_Summary/#PAR#Plot'),
0134 numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_Summary/#PAR#PlotNum'),
0135 parameter = cms.vstring('summary'),
0136 stepByStep = cms.bool(True)
0137 ),
0138 )
0139 )
0140
0141
0142 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('RealElectronsData') != -1)]
0143
0144
0145 for newAttr in newProcAttributes:
0146 locals()[newAttr] = getattr(proc,newAttr)
0147
0148 produceDenominatorRealElectronsData = cms.Sequence( cms.ignore(ElPrimaryVertexFilter) * ElBestPV *
0149 ( (cms.ignore(selectedElectrons) * ElectronsFromPV * cms.ignore(idElectrons) * cms.ignore(trackElectrons) * cms.ignore(isolatedElectrons)) +
0150 (cms.ignore(ElGoodTracks) * ElIsoTracks * ElTrackFromPV * ElTrackCands) ) *
0151 ZeeCandElectronTrack *
0152 BestZee *
0153 ElZLegs
0154 )
0155
0156 produceDenominator = cms.Sequence(produceDenominatorRealElectronsData)
0157
0158 runTauValidationBatchMode = cms.Sequence(
0159 produceDenominatorRealElectronsData
0160 +TauValNumeratorAndDenominatorRealElectronsData
0161 )
0162
0163 runTauValidation = cms.Sequence(
0164 runTauValidationBatchMode
0165 +TauEfficienciesRealElectronsData
0166 )