CMS 3D CMS Logo

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 tauGenJetsForVal = tauGenJets.clone()
9 
10 # require generated tau to decay hadronically
11 objectTypeSelectedTauValDenominatorModuleZTT = cms.EDFilter("TauGenJetDecayModeSelector",
12  src = cms.InputTag("tauGenJetsForVal"),
13  select = cms.vstring('oneProng0Pi0', 'oneProng1Pi0', 'oneProng2Pi0', 'oneProngOther',
14  'threeProng0Pi0', 'threeProng1Pi0', 'threeProngOther', 'rare'),
15  filter = cms.bool(False)
16 )
17 
18 # require generator level hadrons produced in tau-decay to have transverse momentum above threshold
19 kinematicSelectedTauValDenominatorZTT = cms.EDFilter(
20  "GenJetSelector", #"GenJetSelector"
21  src = cms.InputTag('objectTypeSelectedTauValDenominatorModuleZTT'),
22  cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi
23  filter = cms.bool(False)
24 )
25 
26 procAttributes = dir(proc) #Takes a snapshot of what there in the process
27 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'ZTT') #clones the sequence inside the process with ZTT postfix
28 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'ZTT') #clones the sequence inside the process with ZTT postfix
29 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorZTT, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorZTT') #sets the correct input tag
30 
31 #adds to TauValNumeratorAndDenominator modules in the sequence ZTT to the extention name
32 zttLabeler = lambda module : SetValidationExtention(module, 'ZTT')
33 zttModifier = ApplyFunctionToSequence(zttLabeler)
34 proc.TauValNumeratorAndDenominatorZTT.visit(zttModifier)
35 
36 #Set discriminators
37 discs_to_retain = ['ByDecayModeFinding', 'CombinedIsolationDBSumPtCorr3Hits', 'IsolationMVArun2v1DBoldDMwLT', 'IsolationMVArun2v1DBnewDMwLT', 'MuonRejection', 'ElectronRejection']
38 proc.RunHPSValidationZTT.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZTT.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
39 
40 #Sets the correct naming to efficiency histograms
41 proc.efficienciesZTT.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZTT)
42 proc.efficienciesZTTSummary = cms.EDProducer("TauDQMHistEffProducer",
43  plots = cms.PSet(
44  Summary = cms.PSet(
45  denominator = cms.string('RecoTauV/hpsPFTauProducerZTT_Summary/#PAR#PlotDen'),
46  efficiency = cms.string('RecoTauV/hpsPFTauProducerZTT_Summary/#PAR#Plot'),
47  numerator = cms.string('RecoTauV/hpsPFTauProducerZTT_Summary/#PAR#PlotNum'),
48  parameter = cms.vstring('summary'),
49  stepByStep = cms.bool(True)
50  ),
51  )
52 )
53 
54 #checks what's new in the process (the cloned sequences and modules in them)
55 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('ZTT') != -1)]
56 
57 #spawns a local variable with the same name as the proc attribute, needed for future process.load
58 for newAttr in newProcAttributes:
59  locals()[newAttr] = getattr(proc,newAttr)
60 
61 produceDenominatorZTT = cms.Sequence(
62  tauGenJetsForVal
63  +objectTypeSelectedTauValDenominatorModuleZTT
64  +kinematicSelectedTauValDenominatorZTT
65  )
66 
67 produceDenominator = cms.Sequence(produceDenominatorZTT)
68 
69 runTauValidationBatchMode = cms.Sequence(
70  produceDenominatorZTT
71  +TauValNumeratorAndDenominatorZTT
72  )
73 
74 runTauValidation = cms.Sequence(
75  runTauValidationBatchMode
76  +TauEfficienciesZTT
77  )
78 
RecoTauValidation_cfi
any
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:38
genParticles_cfi
helpers
RecoTauValidation_cfi.SetValidationExtention
def SetValidationExtention(module, extension)
Definition: RecoTauValidation_cfi.py:583
TauGenJets_cfi
helpers.cloneProcessingSnippet
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False, verbose=False)
Definition: helpers.py:258
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23