CMS 3D CMS Logo

ValidateTausOnZMM_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 import copy
4 
8 
11 
12 selectMuons = cms.EDProducer(
13  "GenParticlePruner",
14  src = cms.InputTag("genParticles"),
15  select = cms.vstring(
16  "drop * ", # this is the default
17  "keep++ pdgId = 13",
18  "keep++ pdgId = -13",
19  )
20 )
21 
22 selectStableMuons = genParticlesForJets.clone(src = cms.InputTag("selectMuons"))
23 
24 kinematicSelectedTauValDenominatorZMM = cms.EDFilter(
25  "CandPtrSelector",
26  src = cms.InputTag('selectStableMuons'),
27  cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi
28  filter = cms.bool(False)
29 )
30 
31 procAttributes = dir(proc) #Takes a snapshot of what there in the process
32 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZMM') #clones the sequence inside the process with ZMM postfix
33 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZMM') #clones the sequence inside the process with ZMM postfix
34 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZMM, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZMM') #sets the correct input tag
35 
36 #adds to TauValNumeratorAndDenominator modules in the sequence ZMM to the extention name
37 zttLabeler = lambda module : SetValidationExtention(module, 'ZMM')
38 zttModifier = ApplyFunctionToSequence(zttLabeler)
39 proc.TauValNumeratorAndDenominatorZMM.visit(zttModifier)
40 
41 #Sets the correct naming to efficiency histograms
42 proc.efficienciesZMM.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZMM)
43 
44 #checks what's new in the process (the cloned sequences and modules in them)
45 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('ZMM') != -1), dir(proc) )
46 
47 #spawns a local variable with the same name as the proc attribute, needed for future process.load
48 for newAttr in newProcAttributes:
49  locals()[newAttr] = getattr(proc,newAttr)
50 
51 produceDenominatorZMM = cms.Sequence(
52  selectMuons
53  +selectStableMuons
54 # +objectTypeSelectedTauValDenominatorModule
55  +kinematicSelectedTauValDenominatorZMM
56  )
57 
58 produceDenominator = cms.Sequence(produceDenominatorZMM)
59 
60 runTauValidationBatchMode = cms.Sequence(
61  produceDenominatorZMM
62  +TauValNumeratorAndDenominatorZMM
63  )
64 
65 runTauValidation = cms.Sequence(
66  runTauValidationBatchMode
67  +TauEfficienciesZMM
68  )
69 
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:251
def SetValidationExtention(module, extension)
dbl *** dir
Definition: mlp_gen.cc:35