1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
3 import Validation.RecoTau.ValidationUtils
as Utils
16 RecoTauValidation_cfi.py
18 Contains the standard tau validation parameters. It is organized into
19 the following sections.
23 Set common kinematic cuts (pt > 5 and eta < 2.5) on the denominator source.
24 Note that the denominator depends on the type of test (signal/background/e etc)
26 The denominator kinematic cutter requires that
30 Produce numerator and denominator histgorams used to produce
34 TauValNumeratorAndDenominator
36 tauValSelectedDenominator (filtered GenJet collection)
40 Using numerator and denominators, calculate and store
46 TauValNumeratorAndDenominator
50 Plot curves calculated in efficiency, in both an overlay mode
51 showing overall performance for a release, and the indvidual
52 discriminator efficiency compared to a given release
57 loadAndPlotTauValidation
60 TauEfficiencies, external root file to compare to
62 Plotting must be executed in a separate cmsRun job!
66 Various scripts to automate things...
77 kinematicSelectedTauValDenominatorCut = cms.string(
'pt > 5. && abs(eta) < 2.5')
78 denominator = cms.InputTag(
"kinematicSelectedTauValDenominator")
84 Plot the pt/eta/energy/phi spectrum of PFTaus that pass
85 a series of PFTauDiscriminator cuts.
87 These will be used as the numerator/denominators of the
88 efficiency calculations
92 proc = cms.Process(
'helper')
94 StandardMatchingParameters = cms.PSet(
95 DataType = cms.string(
'Leptons'),
96 MatchDeltaR_Leptons = cms.double(0.15),
97 MatchDeltaR_Jets = cms.double(0.3),
98 SaveOutputHistograms = cms.bool(
False),
100 RefCollection = denominator,
101 TauPtCut = cms.double(0.),
102 recoCuts = cms.string(
''),
103 genCuts = cms.string(
''),
104 chainCuts = cms.bool(
False)
107 GenericTriggerSelectionParameters = cms.PSet(
108 andOr = cms.bool(
False ),
109 dbLabel = cms.string(
"PFTauDQMTrigger"),
110 andOrHlt = cms.bool(
True),
111 hltInputTag = cms.InputTag(
"TriggerResults::HLT"),
113 hltPaths = cms.vstring(
'HLT_IsoMu*_eta*_LooseIsoPFTau*_v*',
'HLT_DoubleIsoPFTau*_Trk*_eta*_v*'),
114 errorReplyHlt = cms.bool(
False),
115 verbosityLevel = cms.uint32(0)
118 from DQMServices.Core.DQMEDAnalyzer
import DQMEDAnalyzer
121 StandardMatchingParameters,
122 GenericTriggerSelection = GenericTriggerSelectionParameters,
123 ExtensionName = cms.string(
""),
124 TauProducer = cms.InputTag(
''),
125 discriminators = cms.VPSet(
130 proc.RunHPSValidation = proc.templateAnalyzer.clone()
133 from Configuration.Eras.Modifier_fastSim_cff
import fastSim
135 proc.RunHPSValidation,
136 hltInputTag = cms.InputTag(
""),
137 GenericTriggerSelection=dict(hltInputTag = cms.InputTag(
""))
140 proc.RunHPSValidation.ExtensionName =
""
142 proc.RunHPSValidation.TauProducer = cms.InputTag(
'hpsPFTauProducer')
145 return {
"container" : cms.string(module),
"workingPointIndex" : cms.int32(-1
if wp==
"raw" else getattr(RecoModules, module).workingPoints.index(wp))}
147 index = RecoModules.getBasicTauDiscriminatorRawIndex(getattr(RecoModules, module), wp,
True)
149 index = RecoModules.getBasicTauDiscriminatorWPIndex(getattr(RecoModules, module), wp,
True)
153 return {
"container" : cms.string(module),
"workingPointIndex" : cms.int32(index)}
154 print (
"Basic Tau Discriminator <{}> <{}> for Validation configuration not found!".
format(module, wp))
157 proc.RunHPSValidation.discriminators = cms.VPSet(
158 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByDecayModeFinding"),plotStep = cms.bool(
True),selectionCut = cms.double(0.5),container = cms.string(
"")),
159 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByDecayModeFindingNewDMs"),plotStep = cms.bool(
True),selectionCut = cms.double(0.5),container = cms.string(
"")),
160 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByDecayModeFindingOldDMs"),plotStep = cms.bool(
True),selectionCut = cms.double(0.5),container = cms.string(
"")),
161 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminators"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByLooseCombinedIsolationDBSumPtCorr3Hits")),
162 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminators"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByMediumCombinedIsolationDBSumPtCorr3Hits")),
163 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminators"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByTightCombinedIsolationDBSumPtCorr3Hits")),
172 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseMuonRejection3"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauDiscriminationByMuonRejection3"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByLooseMuonRejection3")),
173 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightMuonRejection3"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauDiscriminationByMuonRejection3"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByTightMuonRejection3")),
174 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6VLooseElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
175 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6LooseElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
176 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6MediumElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
177 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6TightElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
178 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6VTightElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
179 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
180 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
181 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
182 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
183 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
184 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VVTight")),
185 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
186 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
187 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
188 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
189 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
190 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VVTight")),
191 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3HitsdR03"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminatorsdR03"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByLooseCombinedIsolationDBSumPtCorr3HitsdR03")),
192 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3HitsdR03"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminatorsdR03"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByMediumCombinedIsolationDBSumPtCorr3HitsdR03")),
193 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3HitsdR03"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminatorsdR03"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByTightCombinedIsolationDBSumPtCorr3HitsdR03")),
194 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVLooseIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
195 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
196 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
197 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
198 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVTightIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
199 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVVTightIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VVTight")),
202 proc.TauValNumeratorAndDenominator = cms.Sequence(
203 proc.RunHPSValidation
210 Tau efficiency calculations
212 Define the Efficiency curves to produce. Each
213 efficiency producer takes the numberator and denominator
214 histograms and the dependent variables.
217 plotPset = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominator)
218 from DQMServices.Core.DQMEDHarvester
import DQMEDHarvester
220 "TauDQMHistEffProducer",
231 proc.normalizePlots = cms.EDAnalyzer(
233 plotNamesToNormalize = cms.vstring(
'*_pTRatio_*',
'*_Size_*',
'*_SumPt_*',
'*_dRTauRefJet*'),
234 reference = cms.string(
'*_pTRatio_allHadronic')
237 proc.TauEfficiencies = cms.Sequence(
246 loadTau: load two separate TauVal root files into the DQM
247 so the plotter can access them
254 inputFileNames = cms.vstring(
'/opt/sbg/cms/ui4_data1/dbodin/CMSSW_3_5_1/src/TauID/QCD_recoFiles/TauVal_CMSSW_3_6_0_QCD.root'),
255 scaleFactor = cms.double(1.),
256 dqmDirectory_store = cms.string(
'test')
258 reference = cms.PSet(
259 inputFileNames = cms.vstring(
'/opt/sbg/cms/ui4_data1/dbodin/CMSSW_3_5_1/src/TauID/QCD_recoFiles/TauVal_CMSSW_3_6_0_QCD.root'),
260 scaleFactor = cms.double(1.),
261 dqmDirectory_store = cms.string(
'reference')
268 xAxisStuff = cms.PSet(
269 xAxisTitle = cms.string(
'P_{T} / GeV'),
270 xAxisTitleOffset = cms.double(0.9),
271 xAxisTitleSize = cms.double(0.05)
273 xModifiers = [[
'pt',[
'xAxisTitle'],[
'P_{T} / GeV']],[
'eta',[
'xAxisTitle'],[
'#eta']],[
'phi',[
'xAxisTitle'],[
'#phi']],[
'pileup',[
'xAxisTitle'],[
'# of Reco Vertices']]]
275 yAxisStuff =cms.PSet(
276 yScale = cms.string(
'linear'),
277 minY_linear = cms.double(0.),
278 maxY_linear = cms.double(1.6),
279 minY_log = cms.double(0.001),
280 maxY_log = cms.double(1.8),
281 yAxisTitle = cms.string(
'#varepsilon'),
282 yAxisTitleOffset = cms.double(1.1),
283 yAxisTitleSize = cms.double(0.05)
285 yModifiers = [[
'efficiency',[
'yScale',
'yAxisTitle'],[
'linear',
'#varepsilon']],[
'fakeRate',[
'yScale',
'yAxisTitle'],[
'log',
'Fake rate']]]
288 posX = cms.double(0.50),
289 posY = cms.double(0.72),
290 sizeX = cms.double(0.39),
291 sizeY = cms.double(0.17),
292 header = cms.string(
''),
293 option = cms.string(
'brNDC'),
294 borderSize = cms.int32(0),
295 fillColor = cms.int32(0)
297 legModifiers = [[
'efficiency',[
'posY',
'sizeY'],[0.72,0.17]],[
'efficiency_overlay',[
'posY',
'sizeY'],[0.66,0.23]]]
299 drawOptStuff = cms.PSet(
300 markerColor = cms.int32(1),
301 markerSize = cms.double(1.),
302 markerStyle = cms.int32(20),
303 lineColor = cms.int32(1),
304 lineStyle = cms.int32(1),
305 lineWidth = cms.int32(2),
306 drawOption = cms.string(
'ex0'),
307 drawOptionLegend = cms.string(
'p')
309 drawOptModifiers = [[
'eff_overlay01',[
'markerColor',
'lineColor'],[1,1]],[
'eff_overlay02',[
'markerColor',
'lineColor'],[2,2]],[
'eff_overlay03',[
'markerColor',
'lineColor'],[3,3]],[
'eff_overlay04',[
'markerColor',
'lineColor'],[4,4]],[
'eff_overlay05',[
'markerColor',
'lineColor'],[6,6]],[
'eff_overlay06',[
'markerColor',
'lineColor'],[5,5]],[
'eff_overlay07',[
'markerColor',
'lineColor'],[7,7]],[
'eff_overlay08',[
'markerColor',
'lineColor'],[28,28]],[
'eff_overlay09',[
'markerColor',
'lineColor',
'markerStyle'],[2,2,29]],[
'eff_overlay010',[
'markerColor',
'lineColor',
'markerStyle'],[4,4,29]],[
'eff_overlay011',[
'markerColor',
'lineColor',
'markerStyle'],[6,6,29]]]
311 standardDrawingStuff = cms.PSet(
312 canvasSizeX = cms.int32(640),
313 canvasSizeY = cms.int32(640),
314 indOutputFileName = cms.string(
'#PLOT#.png'),
315 xAxes = Utils.SpawnPSet(xModifiers,xAxisStuff),
316 yAxes = Utils.SpawnPSet(yModifiers,yAxisStuff),
317 legends = Utils.SpawnPSet(legModifiers,legStuff),
320 posX = cms.double(0.19),
321 posY = cms.double(0.77),
322 sizeX = cms.double(0.12),
323 sizeY = cms.double(0.04),
324 option = cms.string(
'brNDC'),
325 borderSize = cms.int32(0),
326 fillColor = cms.int32(0),
327 textColor = cms.int32(1),
328 textSize = cms.double(0.04),
329 textAlign = cms.int32(22),
330 text = cms.vstring(
'P_{T} > 5 GeV')
333 posX = cms.double(0.19),
334 posY = cms.double(0.83),
335 sizeX = cms.double(0.12),
336 sizeY = cms.double(0.04),
337 option = cms.string(
'brNDC'),
338 borderSize = cms.int32(0),
339 fillColor = cms.int32(0),
340 textColor = cms.int32(1),
341 textSize = cms.double(0.04),
342 textAlign = cms.int32(22),
343 text = cms.vstring(
'-2.5 < #eta < +2.5')
346 drawOptionSets = cms.PSet(
347 efficiency = cms.PSet(
349 markerColor = cms.int32(4),
350 markerSize = cms.double(1.),
351 markerStyle = cms.int32(20),
352 lineColor = cms.int32(1),
353 lineStyle = cms.int32(1),
354 lineWidth = cms.int32(1),
355 drawOption = cms.string(
'ep'),
356 drawOptionLegend = cms.string(
'p')
358 reference = cms.PSet(
359 lineColor = cms.int32(1),
360 lineStyle = cms.int32(1),
361 lineWidth = cms.int32(1),
362 fillColor = cms.int32(41),
363 drawOption = cms.string(
'eBand'),
364 drawOptionLegend = cms.string(
'l')
368 drawOptionEntries = Utils.SpawnPSet(drawOptModifiers,drawOptStuff)
371 standardCompareTestAndReference = cms.PSet(
372 processes = cms.PSet(
374 dqmDirectory = cms.string(
'test'),
375 legendEntry = cms.string(
'no test label'),
376 type = cms.string(
'smMC')
378 reference = cms.PSet(
379 dqmDirectory = cms.string(
'reference'),
380 legendEntry = cms.string(
'no ref label'),
381 type = cms.string(
'smMC')
442 """ Helper class that applies a given function to all modules
452 input = re.sub(
'fixedConePFTauProducer',
'pfRecoTauProducer', input)
454 fixedDiscriminationRegex = re.compile(
'fixedConePFTauDiscrimination(\w*)')
455 input = fixedDiscriminationRegex.sub(
r'pfRecoTauDiscrimination\1', input)
456 input = re.sub(
'shrinkingConePFTauProducer',
'pfRecoTauProducerHighEfficiency', input)
457 shrinkingDiscriminationRegex = re.compile(
'shrinkingConePFTauDiscrimination(\w*)')
458 input = shrinkingDiscriminationRegex.sub(
r'pfRecoTauDiscrimination\1HighEfficiency', input)
463 """ Converts a draw job defined to compare 31X named PFTau validtion efficiencies
464 to comapre a 31X to a 22X named validation """
466 if not hasattr(input,
"drawJobs"):
468 myDrawJobs = input.drawJobs.parameters_()
469 for drawJobName, drawJobData
in six.iteritems(myDrawJobs):
471 if not drawJobData.plots.pythonTypeName() ==
"cms.PSet":
473 pSetToInsert = cms.PSet(
474 standardEfficiencyParameters,
478 dqmMonitorElements = drawJobData.plots.dqmMonitorElements,
479 process = cms.string(
'test'),
480 drawOptionEntry = cms.string(
'eff_overlay01'),
481 legendEntry = cms.string(input.processes.test.legendEntry.value())
487 process = cms.string(
'reference'),
488 drawOptionEntry = cms.string(
'eff_overlay02'),
489 legendEntry = cms.string(input.processes.reference.legendEntry.value())
493 input.drawJobs.__setattr__(drawJobName, pSetToInsert)
497 if hasattr(module,
'processes'):
498 if module.processes.hasParameter([
'test',
'legendEntry'])
and module.processes.hasParameter([
'reference',
'legendEntry']):
499 module.processes.test.legendEntry = TestLabel
500 module.processes.reference.legendEntry = ReferenceLabel
501 print(
"Set test label to %s and reference label to %s for plot producer %s" % (TestLabel, ReferenceLabel, module.label()))
503 print(
"ERROR in RecoTauValidation_cfi::MakeLabeler - trying to set test/reference label but %s does not have processes.(test/reference).legendEntry parameters!" % module.label())
507 ''' set all modules whose name contains one of the matching names to log y scale'''
509 ''' set a module to use log scaling in the yAxis'''
510 if hasattr(module,
'drawJobs'):
512 drawJobParamGetter =
lambda subName : getattr(module.drawJobs, subName)
514 attrNames =
dir(module.drawJobs)
515 for subModuleName, subModule
in zip(attrNames,
map(drawJobParamGetter, attrNames)):
516 matchedNames = [name
for name
in matchingNames
if subModuleName.find( name) > -1]
517 if len(matchingNames) == 0:
518 matchedNames = [
'take',
'everything',
'and',
'dont',
'bother']
519 if hasattr(subModule,
"yAxis")
and len(matchedNames):
520 print(
"Setting drawJob: ", subModuleName,
" to log scale.")
521 subModule.yAxis = cms.string(
'fakeRate')
522 if len(matchingNames) == 0:
523 module.yAxes.efficiency.maxY_log = 40
524 module.yAxes.fakeRate.maxY_log = 40
529 def BaseDirectorizer(module):
532 if hasattr(module,
"outputFilePath"):
533 oldPath = module.outputFilePath.value()
534 newPath = os.path.join(newPath, oldPath)
535 if not os.path.exists(newPath):
538 module.outputFilePath = cms.string(
"%s" % newPath)
539 return BaseDirectorizer
542 if hasattr(module,
'drawJobs'):
544 drawJobs = module.drawJobs.parameterNames_()
545 for drawJob
in drawJobs:
546 if drawJob !=
"TauIdEffStepByStep":
547 module.drawJobs.__delattr__(drawJob)
548 print(
"Removing comparison plot", drawJob)
552 myPlottingSequence.visit(myFunctor)
556 myPlottingSequence.visit(myFunctor)
560 myPlottingSequence.visit(myFunctor)
563 myProcess.loadTau.test.inputFileNames = cms.vstring(FileLoc)
567 del myProcess.loadTau.reference
569 myProcess.loadTau.reference.inputFileNames = cms.vstring(FileLoc)
573 myPlottingSequence.visit(myFunctor)
577 myPlottingSequence.visit(myFunctor)
581 myPlottingSequence.visit(myFunctor)
584 module.ExtensionName = module.ExtensionName.value()+extension
587 if module._TypedParameterizable__type ==
'TauTagValidation':
588 module.histoSettings = pset
591 if hasattr(module,
'_TypedParameterizable__type')
and module._TypedParameterizable__type ==
'TauTagValidation':
592 setattr(module,
'turnOnTrigger',cms.bool(
True))
593 for item
in pset.parameters_().
items():
594 setattr(module.GenericTriggerSelection,item[0],item[1])