Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:59

0001 import FWCore.ParameterSet.Config as cms
0002 from Validation.RecoTau.RecoTauValidation_cfi import *
0003 import copy
0004 
0005 from PhysicsTools.HepMCCandAlgos.genParticles_cfi import *
0006 from RecoJets.Configuration.RecoGenJets_cff import *
0007 from RecoJets.Configuration.GenJetParticles_cff import *
0008 
0009 from SimGeneral.HepPDTESSource.pythiapdt_cfi import *
0010 import PhysicsTools.PatAlgos.tools.helpers as helpers
0011 
0012 selectElectrons = cms.EDProducer(
0013     "GenParticlePruner",
0014     src = cms.InputTag("genParticles"),
0015     select = cms.vstring(
0016     "drop  *  ", # this is the default
0017     "keep++ pdgId = 11",
0018     "keep++ pdgId = -11",
0019     )
0020 )
0021 
0022 selectStableElectrons = genParticlesForJets.clone(src = cms.InputTag("selectElectrons"))
0023 
0024 #objectTypeSelectedTauValDenominatorModule = copy.deepcopy(iterativeCone5GenJets)
0025 #objectTypeSelectedTauValDenominatorModule.src = cms.InputTag("selectElectronsForGenJets")
0026 
0027 kinematicSelectedTauValDenominatorZEE = cms.EDFilter(
0028    "CandPtrSelector",
0029    src = cms.InputTag('selectStableElectrons'),
0030    cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi 
0031    filter = cms.bool(False)
0032 )
0033 
0034 procAttributes = dir(proc) #Takes a snapshot of what there in the process
0035 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZEE') #clones the sequence inside the process with ZEE postfix
0036 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZEE') #clones the sequence inside the process with ZEE postfix
0037 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZEE, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZEE') #sets the correct input tag
0038 
0039 #adds to TauValNumeratorAndDenominator modules in the sequence ZEE to the extention name
0040 zttLabeler = lambda module : SetValidationExtention(module, 'ZEE')
0041 zttModifier = ApplyFunctionToSequence(zttLabeler)
0042 proc.TauValNumeratorAndDenominatorZEE.visit(zttModifier)
0043 
0044 #Set discriminators
0045 discs_to_retain = ['ByDecayModeFinding', 'ElectronRejection']
0046 proc.RunHPSValidationZEE.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZEE.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
0047 
0048 #Sets the correct naming to efficiency histograms
0049 proc.efficienciesZEE.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZEE)
0050 proc.efficienciesZEESummary = cms.EDProducer("TauDQMHistEffProducer",
0051     plots = cms.PSet(
0052         Summary = cms.PSet(
0053             denominator = cms.string('RecoTauV/hpsPFTauProducerZEE_Summary/#PAR#PlotDen'),
0054             efficiency = cms.string('RecoTauV/hpsPFTauProducerZEE_Summary/#PAR#Plot'),
0055             numerator = cms.string('RecoTauV/hpsPFTauProducerZEE_Summary/#PAR#PlotNum'),
0056             parameter = cms.vstring('summary'),
0057             stepByStep = cms.bool(True)
0058         ),
0059     )
0060 )
0061 
0062 #checks what's new in the process (the cloned sequences and modules in them)
0063 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('ZEE') != -1)]
0064 
0065 #spawns a local variable with the same name as the proc attribute, needed for future process.load
0066 for newAttr in newProcAttributes:
0067     locals()[newAttr] = getattr(proc,newAttr)
0068 
0069 produceDenominatorZEE = cms.Sequence(
0070     selectElectrons*
0071     selectStableElectrons*
0072     kinematicSelectedTauValDenominatorZEE
0073     )
0074 
0075 produceDenominator = cms.Sequence(produceDenominatorZEE)
0076 
0077 runTauValidationBatchMode = cms.Sequence(
0078       produceDenominatorZEE*
0079       TauValNumeratorAndDenominatorZEE
0080       )
0081 
0082 runTauValidation = cms.Sequence(
0083       runTauValidationBatchMode*
0084       TauEfficienciesZEE
0085       )
0086