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 
13 selectElectrons = cms.EDProducer(
14  "GenParticlePruner",
15  src = cms.InputTag("prunedGenParticles"),
16  select = cms.vstring(
17  "drop * ", # this is the default
18  "keep++ pdgId = 11",
19  "keep++ pdgId = -11",
20  )
21 )
22 
23 selectStableElectrons = genParticlesForJets.clone(src = "selectElectrons")
24 
25 #objectTypeSelectedTauValDenominatorModule = copy.deepcopy(iterativeCone5GenJets)
26 #objectTypeSelectedTauValDenominatorModule.src = cms.InputTag("selectElectronsForGenJets")
27 
28 kinematicSelectedTauValDenominatorZEE = cms.EDFilter(
29  "CandPtrSelector",
30  src = cms.InputTag('selectStableElectrons'),
31  cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi
32  filter = cms.bool(False)
33 )
34 
35 procAttributes = dir(proc) #Takes a snapshot of what there in the process
36 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZEE') #clones the sequence inside the process with ZEE postfix
37 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZEE') #clones the sequence inside the process with ZEE postfix
38 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZEE, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZEE') #sets the correct input tag
39 
40 #adds to TauValNumeratorAndDenominator modules in the sequence ZEE to the extention name
41 zttLabeler = lambda module : SetValidationExtention(module, 'ZEE')
42 zttModifier = ApplyFunctionToSequence(zttLabeler)
43 proc.TauValNumeratorAndDenominatorZEE.visit(zttModifier)
44 
45 #Set discriminators
46 discs_to_retain = ['ByDecayModeFinding', 'ElectronRejection']
47 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) ])
48 
49 #Sets the correct naming to efficiency histograms
50 proc.efficienciesZEE.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZEE)
51 proc.efficienciesZEESummary = cms.EDProducer("TauDQMHistEffProducer",
52  plots = cms.PSet(
53  Summary = cms.PSet(
54  denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEE_Summary/#PAR#PlotDen'),
55  efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEE_Summary/#PAR#Plot'),
56  numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEE_Summary/#PAR#PlotNum'),
57  parameter = cms.vstring('summary'),
58  stepByStep = cms.bool(True)
59  ),
60  )
61 )
62 
63 #checks what's new in the process (the cloned sequences and modules in them)
64 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('ZEE') != -1)]
65 
66 #spawns a local variable with the same name as the proc attribute, needed for future process.load
67 for newAttr in newProcAttributes:
68  locals()[newAttr] = getattr(proc,newAttr)
69 
70 produceDenominatorZEE = cms.Sequence(
71  selectElectrons
72  +cms.ignore(selectStableElectrons)
73  +cms.ignore(kinematicSelectedTauValDenominatorZEE)
74  )
75 
76 produceDenominator = cms.Sequence(produceDenominatorZEE)
77 
78 runTauValidationBatchMode = cms.Sequence(
79  produceDenominatorZEE*
80  TauValNumeratorAndDenominatorZEE
81  )
82 
83 runTauValidation = cms.Sequence(
84  runTauValidationBatchMode*
85  TauEfficienciesZEE
86  )
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:36
def SetValidationExtention(module, extension)