CMS 3D CMS Logo

ValidateTausOnZEEFastSim_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.ValidateTausOnZEE_cff')# import *
9 
10 procAttributes = dir(proc) #Takes a snapshot of what there in the process
11 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominatorZEE, 'FastSim') #clones the sequence inside the process with ZEE postfix
12 helpers.cloneProcessingSnippet( proc, proc.TauEfficienciesZEE, 'FastSim') #clones the sequence inside the process with ZEE postfix
13 proc.produceDenominatorZEEFastSim = helpers.cloneProcessingSnippet( proc, proc.produceDenominatorZEE, '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.TauValNumeratorAndDenominatorZEEFastSim.visit(zttModifier)
19 
20 #Set discriminators
21 discs_to_retain = ['ByDecayModeFinding', 'ElectronRejection']
22 proc.RunHPSValidationZEEFastSim.discriminators = cms.VPSet([p for p in proc.RunHPSValidationZEEFastSim.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.efficienciesZEEFastSim.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorZEEFastSim)
26 proc.efficienciesZEEFastSimSummary = cms.EDProducer("TauDQMHistEffProducer",
27  plots = cms.PSet(
28  Summary = cms.PSet(
29  denominator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEEFastSim_Summary/#PAR#PlotDen'),
30  efficiency = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEEFastSim_Summary/#PAR#Plot'),
31  numerator = cms.string('RecoTauV/standardValidation/hpsPFTauProducerZEEFastSim_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(produceDenominatorZEEFastSim)
46 
47 runTauValidationBatchMode = cms.Sequence(
48  produceDenominatorZEEFastSim
49  +TauValNumeratorAndDenominatorZEEFastSim
50  )
51 
52 runTauValidation = cms.Sequence(
53  runTauValidationBatchMode
54  +TauEfficienciesZEEFastSim
55  )
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)