CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Validation/RecoTau/python/dataTypes/ValidateTausOnRealElectronsData_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 ElPrimaryVertexFilter = 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 ElBestPV = cms.EDProducer( 
00016     "HighestSumP4PrimaryVertexSelector",
00017     src = cms.InputTag("ElPrimaryVertexFilter")
00018         )
00019 
00020 selectedElectrons = cms.EDFilter(
00021     "TauValElectronSelector",
00022     src = cms.InputTag('gsfElectrons'),
00023     cut = cms.string("pt > 25.0 && abs(eta) < 2.4 && isElectron"),
00024     filter = cms.bool(False)
00025         )
00026 
00027 ElectronsFromPV = cms.EDProducer(
00028     "GsfElectronFromPVSelector",
00029     srcElectron = cms.InputTag("selectedElectrons"),
00030     srcVertex   = cms.InputTag("ElBestPV"),
00031     max_dxy     = cms.double(0.01),
00032     max_dz      = cms.double(0.1)
00033     )
00034 
00035 idElectrons = cms.EDFilter(
00036     "TauValElectronSelector",
00037     src = cms.InputTag('ElectronsFromPV'),
00038     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)'),
00039     filter = cms.bool(False)
00040 )
00041 
00042 trackElectrons = cms.EDFilter(
00043     "TauValElectronSelector",
00044     src = cms.InputTag('idElectrons'),
00045     cut = cms.string('gsfTrack.isNonnull  && 0.7 < eSuperClusterOverP < 1.5'),
00046 #    cut = cms.string('gsfTrack.isNonnull && gsfTrack.trackerExpectedHitsInner.numberOfHits = 0 && 0.7 < eSuperClusterOverP < 1.5'),
00047     filter = cms.bool(False)
00048 )
00049 
00050 isolatedElectrons = cms.EDFilter(
00051     "TauValElectronSelector",
00052     src = cms.InputTag('trackElectrons'),
00053     cut = cms.string("(isEB & (dr04TkSumPt/pt + max(0.,dr04EcalRecHitSumEt-2.)/pt + dr04HcalTowerSumEt/pt < 0.10)) | (isEE & (dr04TkSumPt/pt + dr04EcalRecHitSumEt/pt + dr04HcalTowerSumEt/pt < 0.09))"),
00054     filter = cms.bool(False)
00055         )
00056 
00057 from SimGeneral.HepPDTESSource.pythiapdt_cfi import *
00058 
00059 ElGoodTracks = cms.EDFilter(
00060     "TrackSelector",
00061     src = cms.InputTag("generalTracks"), 
00062     cut = cms.string("pt > 5 && abs(eta) < 2.5"),
00063     filter = cms.bool(False)
00064         )
00065 
00066 ElIsoTracks = cms.EDProducer(
00067     "IsoTracks",
00068     src           = cms.InputTag("ElGoodTracks"),
00069     radius        = cms.double(0.3),
00070     SumPtFraction = cms.double(0.5)
00071     )
00072 
00073 ElTrackFromPV = cms.EDProducer(
00074     "TrackFromPVSelector",
00075     srcTrack   = cms.InputTag("ElIsoTracks"),
00076     srcVertex  = cms.InputTag("ElBestPV"),
00077     max_dxy    = cms.double(0.01),
00078     max_dz     = cms.double(0.1)
00079     )
00080 
00081 ElTrackCands  = cms.EDProducer(
00082     "ConcreteChargedCandidateProducer", 
00083     src  = cms.InputTag("ElTrackFromPV"),      
00084     particleType = cms.string("e+")     # this is needed to define a mass do not trust the sign, it is dummy
00085         )
00086 
00087 ZeeCandElectronTrack = cms.EDProducer(
00088     "CandViewShallowCloneCombiner",
00089     decay = cms.string("isolatedElectrons@+ ElTrackCands@-"), # it takes opposite sign collection, no matter if +- or -+
00090     cut   = cms.string("80 < mass < 100")
00091         )
00092 
00093 BestZee = cms.EDProducer(
00094     "BestMassZArbitrationProducer", # returns the Z with mass closest to 91.18 GeV
00095         ZCandidateCollection = cms.InputTag("ZeeCandElectronTrack")
00096         )
00097 
00098 ElZLegs  = cms.EDProducer(
00099     "CollectionFromZLegProducer", 
00100     ZCandidateCollection  = cms.InputTag("BestZee"),      
00101         )
00102 
00103 procAttributes = dir(proc) #Takes a snapshot of what there in the process
00104 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'RealElectronsData') #clones the sequence inside the process with RealElectronsData postfix
00105 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'RealElectronsData') #clones the sequence inside the process with RealElectronsData postfix
00106 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorRealElectronsData, 'kinematicSelectedTauValDenominator', cms.InputTag("ElZLegs","theProbeLeg")) #sets the correct input tag
00107 
00108 #adds to TauValNumeratorAndDenominator modules in the sequence RealElectronsData to the extention name
00109 zttLabeler = lambda module : SetValidationExtention(module, 'RealElectronsData')
00110 zttModifier = ApplyFunctionToSequence(zttLabeler)
00111 proc.TauValNumeratorAndDenominatorRealElectronsData.visit(zttModifier)
00112 
00113 binning = cms.PSet(
00114     pt = cms.PSet( nbins = cms.int32(10), min = cms.double(0.), max = cms.double(100.) ), #hinfo(75, 0., 150.)
00115     eta = cms.PSet( nbins = cms.int32(4), min = cms.double(-3.), max = cms.double(3.) ), #hinfo(60, -3.0, 3.0);
00116     phi = cms.PSet( nbins = cms.int32(4), min = cms.double(-180.), max = cms.double(180.) ), #hinfo(36, -180., 180.);
00117     pileup = cms.PSet( nbins = cms.int32(18), min = cms.double(0.), max = cms.double(72.) ),#hinfo(25, 0., 25.0);
00118     )
00119 zttModifier = ApplyFunctionToSequence(lambda m: setBinning(m,binning))
00120 proc.TauValNumeratorAndDenominatorRealElectronsData.visit(zttModifier)
00121 #-----------------------------------------
00122 
00123 #Sets the correct naming to efficiency histograms
00124 proc.efficienciesRealElectronsData.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorRealElectronsData)
00125 
00126 #checks what's new in the process (the cloned sequences and modules in them)
00127 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('RealElectronsData') != -1), dir(proc) )
00128 
00129 #spawns a local variable with the same name as the proc attribute, needed for future process.load
00130 for newAttr in newProcAttributes:
00131     locals()[newAttr] = getattr(proc,newAttr)
00132 
00133 produceDenominatorRealElectronsData = cms.Sequence( ElPrimaryVertexFilter * ElBestPV *
00134                                                     ( (selectedElectrons * ElectronsFromPV * idElectrons * trackElectrons * isolatedElectrons) +
00135                                                       (ElGoodTracks * ElIsoTracks * ElTrackFromPV * ElTrackCands) ) *
00136                                                     ZeeCandElectronTrack *
00137                                                     BestZee *
00138                                                     ElZLegs 
00139                                                   )
00140 
00141 produceDenominator = produceDenominatorRealElectronsData
00142 
00143 runTauValidationBatchMode = cms.Sequence(
00144       produceDenominator
00145       +TauValNumeratorAndDenominatorRealElectronsData
00146       )
00147 
00148 runTauValidation = cms.Sequence(
00149       runTauValidationBatchMode
00150       +TauEfficienciesRealElectronsData
00151       )