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