CMS 3D CMS Logo

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