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 
13 selectMuons = cms.EDProducer(
14  "GenParticlePruner",
15  src = cms.InputTag("prunedGenParticles"),
16  select = cms.vstring(
17  "drop * ", # this is the default
18  "keep++ pdgId = 13",
19  "keep++ pdgId = -13",
20  )
21 )
22 
23 selectStableMuons = genParticlesForJets.clone(src = "selectMuons")
24 
25 kinematicSelectedTauValDenominatorZMM = cms.EDFilter(
26  "CandPtrSelector",
27  src = cms.InputTag('selectStableMuons'),
28  cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi
29  filter = cms.bool(False)
30 )
31 
32 procAttributes = dir(proc) #Takes a snapshot of what there in the process
33 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZMM') #clones the sequence inside the process with ZMM postfix
34 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZMM') #clones the sequence inside the process with ZMM postfix
35 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZMM, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZMM') #sets the correct input tag
36 
37 #adds to TauValNumeratorAndDenominator modules in the sequence ZMM to the extention name
38 zttLabeler = lambda module : SetValidationExtention(module, 'ZMM')
39 zttModifier = ApplyFunctionToSequence(zttLabeler)
40 proc.TauValNumeratorAndDenominatorZMM.visit(zttModifier)
41 
42 #Set discriminators
43 discs_to_retain = ['ByDecayModeFinding', 'MuonRejection']
44 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) ])
45 
46 #Sets the correct naming to efficiency histograms
47 proc.efficienciesZMM.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZMM)
48 proc.efficienciesZMMSummary = cms.EDProducer("TauDQMHistEffProducer",
49  plots = cms.PSet(
50  Summary = cms.PSet(
51  denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZMM_Summary/#PAR#PlotDen'),
52  efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZMM_Summary/#PAR#Plot'),
53  numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZMM_Summary/#PAR#PlotNum'),
54  parameter = cms.vstring('summary'),
55  stepByStep = cms.bool(True)
56  ),
57  )
58 )
59 
60 #checks what's new in the process (the cloned sequences and modules in them)
61 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('ZMM') != -1)]
62 
63 #spawns a local variable with the same name as the proc attribute, needed for future process.load
64 for newAttr in newProcAttributes:
65  locals()[newAttr] = getattr(proc,newAttr)
66 
67 produceDenominatorZMM = cms.Sequence(
68  selectMuons
69  +cms.ignore(selectStableMuons)
70  +cms.ignore(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  )
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False, verbose=False)
Definition: helpers.py:263
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def SetValidationExtention(module, extension)