CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ValidateTausOnZTT_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 
4 from PhysicsTools.JetMCAlgos.TauGenJets_cfi import tauGenJets
7 
8 # require generated tau to decay hadronically
9 objectTypeSelectedTauValDenominatorModuleZTT = cms.EDFilter("TauGenJetDecayModeSelector",
10  src = cms.InputTag("tauGenJets"),
11  select = cms.vstring('oneProng0Pi0', 'oneProng1Pi0', 'oneProng2Pi0', 'oneProngOther',
12  'threeProng0Pi0', 'threeProng1Pi0', 'threeProngOther', 'rare'),
13  filter = cms.bool(False)
14 )
15 
16 # require generator level hadrons produced in tau-decay to have transverse momentum above threshold
17 kinematicSelectedTauValDenominatorZTT = cms.EDFilter(
18  "GenJetSelector", #"GenJetSelector"
19  src = cms.InputTag('objectTypeSelectedTauValDenominatorModuleZTT'),
20  cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi
21  filter = cms.bool(False)
22 )
23 
24 procAttributes = dir(proc) #Takes a snapshot of what there in the process
25 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZTT') #clones the sequence inside the process with ZTT postfix
26 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZTT') #clones the sequence inside the process with ZTT postfix
27 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZTT, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZTT') #sets the correct input tag
28 
29 #adds to TauValNumeratorAndDenominator modules in the sequence ZTT to the extention name
30 zttLabeler = lambda module : SetValidationExtention(module, 'ZTT')
31 zttModifier = ApplyFunctionToSequence(zttLabeler)
32 proc.TauValNumeratorAndDenominatorZTT.visit(zttModifier)
33 
34 #Sets the correct naming to efficiency histograms
35 proc.efficienciesZTT.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZTT)
36 
37 #checks what's new in the process (the cloned sequences and modules in them)
38 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('ZTT') != -1), dir(proc) )
39 
40 #spawns a local variable with the same name as the proc attribute, needed for future process.load
41 for newAttr in newProcAttributes:
42  locals()[newAttr] = getattr(proc,newAttr)
43 
44 produceDenominatorZTT = cms.Sequence(
45  tauGenJets
46  +objectTypeSelectedTauValDenominatorModuleZTT
47  +kinematicSelectedTauValDenominatorZTT
48  )
49 
50 produceDenominator = cms.Sequence(produceDenominatorZTT)
51 
52 runTauValidationBatchMode = cms.Sequence(
53  produceDenominatorZTT
54  +TauValNumeratorAndDenominatorZTT
55  )
56 
57 runTauValidation = cms.Sequence(
58  runTauValidationBatchMode
59  +TauEfficienciesZTT
60  )
61 
def cloneProcessingSnippet
Definition: helpers.py:306
def massSearchReplaceAnyInputTag
Definition: helpers.py:262
dbl *** dir
Definition: mlp_gen.cc:35