CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ValidateTausOnRealData_cff.py
Go to the documentation of this file.
3 import copy
4 
7 
8 kinematicSelectedPFJets = cms.EDFilter(
9  "TauValPFJetSelector",
10  src = cms.InputTag('ak5PFJets'),
11  cut = cms.string("pt > 15 & abs(eta) < 2.5"),
12  filter = cms.bool(False)
13  )
14 
15 PFJetsId = cms.EDFilter(
16  "TauValPFJetSelector",
17  src = cms.InputTag('kinematicSelectedPFJets'),
18  cut = cms.string("chargedHadronEnergyFraction > 0.0 & neutralHadronEnergyFraction < 0.99 & neutralHadronEnergyFraction < 0.99 & chargedEmEnergyFraction < 0.99 & chargedEmEnergyFraction < 0.99 & neutralEmEnergyFraction < 0.99 & chargedMultiplicity > 0 & nConstituents > 1"),
19  filter = cms.bool(False)
20  )
21 
22 CleanedPFJets = cms.EDProducer("TauValJetViewCleaner",
23  srcObject = cms.InputTag( "kinematicSelectedPFJets" ),
24  srcObjectsToRemove = cms.VInputTag( cms.InputTag("muons"), cms.InputTag("gsfElectrons") ),
25  deltaRMin = cms.double(0.15)
26 )
27 
28 procAttributes = dir(proc) #Takes a snapshot of what there in the process
29 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'RealData') #clones the sequence inside the process with RealData postfix
30 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'RealData') #clones the sequence inside the process with RealData postfix
31 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorRealData, 'kinematicSelectedTauValDenominator', 'CleanedPFJets') #sets the correct input tag
32 
33 #adds to TauValNumeratorAndDenominator modules in the sequence RealData to the extention name
34 zttLabeler = lambda module : SetValidationExtention(module, 'RealData')
35 zttModifier = ApplyFunctionToSequence(zttLabeler)
36 proc.TauValNumeratorAndDenominatorRealData.visit(zttModifier)
37 
38 binning = cms.PSet(
39  pt = cms.PSet( nbins = cms.int32(25), min = cms.double(0.), max = cms.double(250.) ), #hinfo(75, 0., 150.)
40  eta = cms.PSet( nbins = cms.int32(4), min = cms.double(-3.), max = cms.double(3.) ), #hinfo(60, -3.0, 3.0);
41  phi = cms.PSet( nbins = cms.int32(4), min = cms.double(-180.), max = cms.double(180.) ), #hinfo(36, -180., 180.);
42  pileup = cms.PSet( nbins = cms.int32(18), min = cms.double(0.), max = cms.double(72.) ),#hinfo(25, 0., 25.0);
43  )
44 zttModifier = ApplyFunctionToSequence(lambda m: setBinning(m,binning))
45 proc.TauValNumeratorAndDenominatorRealData.visit(zttModifier)
46 #-----------------------------------------
47 
48 #Sets the correct naming to efficiency histograms
49 proc.efficienciesRealData.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorRealData)
50 
51 #checks what's new in the process (the cloned sequences and modules in them)
52 newProcAttributes = filter( lambda x: (x not in procAttributes) and (x.find('RealData') != -1), dir(proc) )
53 
54 #spawns a local variable with the same name as the proc attribute, needed for future process.load
55 for newAttr in newProcAttributes:
56  locals()[newAttr] = getattr(proc,newAttr)
57 
58 
59 produceDenominatorRealData = cms.Sequence(
60  kinematicSelectedPFJets *
61  PFJetsId *
62  CleanedPFJets
63  )
64 
65 produceDenominator = produceDenominatorRealData
66 
67 runTauValidationBatchMode = cms.Sequence(
68  produceDenominator
69  +TauValNumeratorAndDenominatorRealData
70  )
71 
72 runTauValidation = cms.Sequence(
73  runTauValidationBatchMode
74  +TauEfficienciesRealData
75  )
def cloneProcessingSnippet
Definition: helpers.py:262
def massSearchReplaceAnyInputTag
Definition: helpers.py:218
dbl *** dir
Definition: mlp_gen.cc:35