CMS 3D CMS Logo

ValidateTausOnQCD_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 import copy
4 
9 
10 kinematicSelectedTauValDenominatorQCD = cms.EDFilter(
11  "GenJetSelector",
12  src = cms.InputTag('slimmedGenJets'),
13  cut = kinematicSelectedTauValDenominatorCut,#cms.string('pt > 5. && abs(eta) < 2.5'), #Defined: Validation.RecoTau.RecoTauValidation_cfi
14  filter = cms.bool(False)
15 )
16 
17 procAttributes = dir(proc) #Takes a snapshot of what there in the process
18 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'QCD') #clones the sequence inside the process with QCD postfix
19 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'QCD') #clones the sequence inside the process with QCD postfix
20 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorQCD, 'kinematicSelectedTauValDenominator', 'kinematicSelectedTauValDenominatorQCD') #sets the correct input tag
21 
22 #adds to TauValNumeratorAndDenominator modules in the sequence QCD to the extention name
23 zttLabeler = lambda module : SetValidationExtention(module, 'QCD')
24 zttModifier = ApplyFunctionToSequence(zttLabeler)
25 proc.TauValNumeratorAndDenominatorQCD.visit(zttModifier)
26 
27 #Set discriminators
28 discs_to_retain = ['ByDecayModeFinding', 'CombinedIsolationDBSumPtCorr3Hits', 'IsolationMVArun2v1DBoldDMwLT', 'IsolationMVArun2v1DBnewDMwLT']
29 proc.RunHPSValidationQCD.discriminators = cms.VPSet([p for p in proc.RunHPSValidationQCD.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
30 
31 #Sets the correct naming to efficiency histograms
32 proc.efficienciesQCD.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorQCD)
33 proc.efficienciesQCDSummary = cms.EDProducer("TauDQMHistEffProducer",
34  plots = cms.PSet(
35  Summary = cms.PSet(
36  denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerQCD_Summary/#PAR#PlotDen'),
37  efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerQCD_Summary/#PAR#Plot'),
38  numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerQCD_Summary/#PAR#PlotNum'),
39  parameter = cms.vstring('summary'),
40  stepByStep = cms.bool(True)
41  ),
42  )
43 )
44 
45 #checks what's new in the process (the cloned sequences and modules in them)
46 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('QCD') != -1)]
47 
48 #spawns a local variable with the same name as the proc attribute, needed for future process.load
49 for newAttr in newProcAttributes:
50  locals()[newAttr] = getattr(proc,newAttr)
51 
52 produceDenominatorQCD = cms.Sequence(
53  cms.ignore(kinematicSelectedTauValDenominatorQCD)
54 )
55 
56 produceDenominator = cms.Sequence(produceDenominatorQCD)
57 
58 runTauValidationBatchMode = cms.Sequence(
59  produceDenominatorQCD
60  +TauValNumeratorAndDenominatorQCD
61  )
62 
63 runTauValidation = cms.Sequence(
64  runTauValidationBatchMode
65  +TauEfficienciesQCD
66  )
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)