CMS 3D CMS Logo

ValidateTausOnZTTFastSim_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import Validation.RecoTau.ValidationUtils as Utils
3 from Validation.RecoTau.RecoTauValidation_cfi import ApplyFunctionToSequence, SetValidationExtention
5 
6 proc = cms.Process('helper')
7 
8 proc.load('Validation.RecoTau.dataTypes.ValidateTausOnZTT_cff')# import *
9 
10 procAttributes = dir(proc) #Takes a snapshot of what there in the process
11 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominatorZTT, 'FastSim') #clones the sequence inside the process with ZTT postfix
12 helpers.cloneProcessingSnippet( proc, proc.TauEfficienciesZTT, 'FastSim') #clones the sequence inside the process with ZTT postfix
13 proc.produceDenominatorZTTFastSim = helpers.cloneProcessingSnippet( proc, proc.produceDenominatorZTT, 'FastSim')
14 
15 #adds to TauValNumeratorAndDenominator modules in the sequence FastSim to the extention name
16 zttLabeler = lambda module : SetValidationExtention(module, 'FastSim')
17 zttModifier = ApplyFunctionToSequence(zttLabeler)
18 proc.TauValNumeratorAndDenominatorZTTFastSim.visit(zttModifier)
19 
20 #Set discriminators
21 discs_to_retain = ['ByDecayModeFinding', 'CombinedIsolationDBSumPtCorr3Hits', 'IsolationMVArun2v1DBoldDMwLT', 'IsolationMVArun2v1DBnewDMwLT', 'MuonRejection', 'ElectronRejection']
22 proc.RunHPSValidationZTTFastSim.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZTTFastSim.discriminators if any(disc in p.discriminator.value() for disc in discs_to_retain) ])
23 
24 #Sets the correct naming to efficiency histograms
25 proc.efficienciesZTTFastSim.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZTTFastSim)
26 proc.efficienciesZTTFastSimSummary = cms.EDProducer("TauDQMHistEffProducer",
27  plots = cms.PSet(
28  Summary = cms.PSet(
29  denominator = cms.string('RecoTauV/hpsPFTauProducerZTTFastSim_Summary/#PAR#PlotDen'),
30  efficiency = cms.string('RecoTauV/hpsPFTauProducerZTTFastSim_Summary/#PAR#Plot'),
31  numerator = cms.string('RecoTauV/hpsPFTauProducerZTTFastSim_Summary/#PAR#PlotNum'),
32  parameter = cms.vstring('summary'),
33  stepByStep = cms.bool(True)
34  ),
35  )
36 )
37 
38 #checks what's new in the process (the cloned sequences and modules in them)
39 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('FastSim') != -1)]
40 
41 #spawns a local variable with the same name as the proc attribute, needed for future process.load
42 for newAttr in newProcAttributes:
43  locals()[newAttr] = getattr(proc,newAttr)
44 
45 produceDenominator = cms.Sequence(produceDenominatorZTTFastSim)
46 
47 runTauValidationBatchMode = cms.Sequence(
48  produceDenominatorZTTFastSim
49  +TauValNumeratorAndDenominatorZTTFastSim
50  )
51 
52 runTauValidation = cms.Sequence(
53  runTauValidationBatchMode
54  +TauEfficienciesZTTFastSim
55  )
56 
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:257
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def SetValidationExtention(module, extension)
dbl *** dir
Definition: mlp_gen.cc:35