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 #Set discriminators
42 discs_to_retain = ['ByDecayModeFinding', 'MuonRejection']
43 proc.RunHPSValidationZMM.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZMM.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
44 
45 #Sets the correct naming to efficiency histograms
46 proc.efficienciesZMM.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZMM)
47 proc.efficienciesZMMSummary = cms.EDProducer("TauDQMHistEffProducer",
48  plots = cms.PSet(
49  Summary = cms.PSet(
50  denominator = cms.string('RecoTauV/hpsPFTauProducerZMM_Summary/#PAR#PlotDen'),
51  efficiency = cms.string('RecoTauV/hpsPFTauProducerZMM_Summary/#PAR#Plot'),
52  numerator = cms.string('RecoTauV/hpsPFTauProducerZMM_Summary/#PAR#PlotNum'),
53  parameter = cms.vstring('summary'),
54  stepByStep = cms.bool(True)
55  ),
56  )
57 )
58 
59 #checks what's new in the process (the cloned sequences and modules in them)
60 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('ZMM') != -1)]
61 
62 #spawns a local variable with the same name as the proc attribute, needed for future process.load
63 for newAttr in newProcAttributes:
64  locals()[newAttr] = getattr(proc,newAttr)
65 
66 produceDenominatorZMM = cms.Sequence(
67  selectMuons
68  +selectStableMuons
69 # +objectTypeSelectedTauValDenominatorModule
70  +kinematicSelectedTauValDenominatorZMM
71  )
72 
73 produceDenominator = cms.Sequence(produceDenominatorZMM)
74 
75 runTauValidationBatchMode = cms.Sequence(
76  produceDenominatorZMM
77  +TauValNumeratorAndDenominatorZMM
78  )
79 
80 runTauValidation = cms.Sequence(
81  runTauValidationBatchMode
82  +TauEfficienciesZMM
83  )
84 
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:257
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def SetValidationExtention(module, extension)
dbl *** dir
Definition: mlp_gen.cc:35