1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
3 import Validation.RecoTau.ValidationUtils
as Utils
15 RecoTauValidation_cfi.py
17 Contains the standard tau validation parameters. It is organized into
18 the following sections.
22 Set common kinematic cuts (pt > 5 and eta < 2.5) on the denominator source.
23 Note that the denominator depends on the type of test (signal/background/e etc)
25 The denominator kinematic cutter requires that
29 Produce numerator and denominator histgorams used to produce
33 TauValNumeratorAndDenominator
35 tauValSelectedDenominator (filtered GenJet collection)
39 Using numerator and denominators, calculate and store
45 TauValNumeratorAndDenominator
49 Plot curves calculated in efficiency, in both an overlay mode
50 showing overall performance for a release, and the indvidual
51 discriminator efficiency compared to a given release
56 loadAndPlotTauValidation
59 TauEfficiencies, external root file to compare to
61 Plotting must be executed in a separate cmsRun job!
65 Various scripts to automate things...
76 kinematicSelectedTauValDenominatorCut = cms.string(
'pt > 5. && abs(eta) < 2.5')
77 denominator = cms.InputTag(
"kinematicSelectedTauValDenominator")
83 Plot the pt/eta/energy/phi spectrum of PFTaus that pass
84 a series of PFTauDiscriminator cuts.
86 These will be used as the numerator/denominators of the
87 efficiency calculations
91 proc = cms.Process(
'helper')
93 StandardMatchingParameters = cms.PSet(
94 DataType = cms.string(
'Leptons'),
95 MatchDeltaR_Leptons = cms.double(0.15),
96 MatchDeltaR_Jets = cms.double(0.3),
97 SaveOutputHistograms = cms.bool(
False),
99 RefCollection = denominator,
100 TauPtCut = cms.double(0.),
101 recoCuts = cms.string(
''),
102 genCuts = cms.string(
''),
103 chainCuts = cms.bool(
False)
106 GenericTriggerSelectionParameters = cms.PSet(
107 andOr = cms.bool(
False ),
108 dbLabel = cms.string(
"PFTauDQMTrigger"),
109 andOrHlt = cms.bool(
True),
110 hltInputTag = cms.InputTag(
"TriggerResults::HLT"),
112 hltPaths = cms.vstring(
'HLT_IsoMu*_eta*_LooseIsoPFTau*_v*',
'HLT_DoubleIsoPFTau*_Trk*_eta*_v*'),
113 errorReplyHlt = cms.bool(
False),
114 verbosityLevel = cms.uint32(0)
117 from DQMServices.Core.DQMEDAnalyzer
import DQMEDAnalyzer
120 StandardMatchingParameters,
121 GenericTriggerSelection = GenericTriggerSelectionParameters,
122 ExtensionName = cms.string(
""),
123 TauProducer = cms.InputTag(
''),
124 discriminators = cms.VPSet(
129 proc.RunHPSValidation = proc.templateAnalyzer.clone()
132 from Configuration.Eras.Modifier_fastSim_cff
import fastSim
134 proc.RunHPSValidation,
135 hltInputTag = cms.InputTag(
""),
136 GenericTriggerSelection=dict(hltInputTag = cms.InputTag(
""))
139 proc.RunHPSValidation.ExtensionName =
""
141 proc.RunHPSValidation.TauProducer = cms.InputTag(
'hpsPFTauProducer')
144 return {
"container" : cms.string(module),
"workingPointIndex" : cms.int32(-1
if wp==
"raw" else getattr(RecoModules, module).workingPoints.index(wp))}
146 index = RecoModules.getBasicTauDiscriminatorRawIndex(getattr(RecoModules, module), wp,
True)
148 index = RecoModules.getBasicTauDiscriminatorWPIndex(getattr(RecoModules, module), wp,
True)
152 return {
"container" : cms.string(module),
"workingPointIndex" : cms.int32(index)}
153 print (
"Basic Tau Discriminator <{}> <{}> for Validation configuration not found!".
format(module, wp))
156 proc.RunHPSValidation.discriminators = cms.VPSet(
157 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByDecayModeFinding"),plotStep = cms.bool(
True),selectionCut = cms.double(0.5),container = cms.string(
"")),
158 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByDecayModeFindingNewDMs"),plotStep = cms.bool(
True),selectionCut = cms.double(0.5),container = cms.string(
"")),
159 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByDecayModeFindingOldDMs"),plotStep = cms.bool(
True),selectionCut = cms.double(0.5),container = cms.string(
"")),
160 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminators"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByLooseCombinedIsolationDBSumPtCorr3Hits")),
161 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminators"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByMediumCombinedIsolationDBSumPtCorr3Hits")),
162 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminators"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByTightCombinedIsolationDBSumPtCorr3Hits")),
171 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseMuonRejection3"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauDiscriminationByMuonRejection3"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByLooseMuonRejection3")),
172 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightMuonRejection3"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauDiscriminationByMuonRejection3"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByTightMuonRejection3")),
173 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6VLooseElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
174 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6LooseElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
175 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6MediumElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
176 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6TightElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
177 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMVA6VTightElectronRejection"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByMVA6ElectronRejection"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
178 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
179 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
180 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
181 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
182 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
183 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VVTight")),
184 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
185 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
186 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
187 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
188 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
189 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VVTight")),
190 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3HitsdR03"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminatorsdR03"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByLooseCombinedIsolationDBSumPtCorr3HitsdR03")),
191 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3HitsdR03"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminatorsdR03"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByMediumCombinedIsolationDBSumPtCorr3HitsdR03")),
192 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3HitsdR03"),plotStep = cms.bool(
True),container = cms.string(
"hpsPFTauBasicDiscriminatorsdR03"),provenanceConfigLabel=cms.string(
"IDWPdefinitions"),idLabel=cms.string(
"ByTightCombinedIsolationDBSumPtCorr3HitsdR03")),
193 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVLooseIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VLoose")),
194 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByLooseIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Loose")),
195 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByMediumIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Medium")),
196 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByTightIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_Tight")),
197 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVTightIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VTight")),
198 cms.PSet( discriminator = cms.string(
"hpsPFTauDiscriminationByVVTightIsolationMVArun2v1DBdR03oldDMwLT"),plotStep = cms.bool(
False),container = cms.string(
"hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLT"),provenanceConfigLabel=cms.string(
"workingPoints"),idLabel=cms.string(
"_VVTight")),
201 proc.TauValNumeratorAndDenominator = cms.Sequence(
202 proc.RunHPSValidation
209 Tau efficiency calculations
211 Define the Efficiency curves to produce. Each
212 efficiency producer takes the numberator and denominator
213 histograms and the dependent variables.
216 plotPset = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominator)
217 from DQMServices.Core.DQMEDHarvester
import DQMEDHarvester
219 "TauDQMHistEffProducer",
230 proc.normalizePlots = cms.EDAnalyzer(
232 plotNamesToNormalize = cms.vstring(
'*_pTRatio_*',
'*_Size_*',
'*_SumPt_*',
'*_dRTauRefJet*'),
233 reference = cms.string(
'*_pTRatio_allHadronic')
236 proc.TauEfficiencies = cms.Sequence(
245 loadTau: load two separate TauVal root files into the DQM
246 so the plotter can access them
253 inputFileNames = cms.vstring(
'/opt/sbg/cms/ui4_data1/dbodin/CMSSW_3_5_1/src/TauID/QCD_recoFiles/TauVal_CMSSW_3_6_0_QCD.root'),
254 scaleFactor = cms.double(1.),
255 dqmDirectory_store = cms.string(
'test')
257 reference = cms.PSet(
258 inputFileNames = cms.vstring(
'/opt/sbg/cms/ui4_data1/dbodin/CMSSW_3_5_1/src/TauID/QCD_recoFiles/TauVal_CMSSW_3_6_0_QCD.root'),
259 scaleFactor = cms.double(1.),
260 dqmDirectory_store = cms.string(
'reference')
267 xAxisStuff = cms.PSet(
268 xAxisTitle = cms.string(
'P_{T} / GeV'),
269 xAxisTitleOffset = cms.double(0.9),
270 xAxisTitleSize = cms.double(0.05)
272 xModifiers = [[
'pt',[
'xAxisTitle'],[
'P_{T} / GeV']],[
'eta',[
'xAxisTitle'],[
'#eta']],[
'phi',[
'xAxisTitle'],[
'#phi']],[
'pileup',[
'xAxisTitle'],[
'# of Reco Vertices']]]
274 yAxisStuff =cms.PSet(
275 yScale = cms.string(
'linear'),
276 minY_linear = cms.double(0.),
277 maxY_linear = cms.double(1.6),
278 minY_log = cms.double(0.001),
279 maxY_log = cms.double(1.8),
280 yAxisTitle = cms.string(
'#varepsilon'),
281 yAxisTitleOffset = cms.double(1.1),
282 yAxisTitleSize = cms.double(0.05)
284 yModifiers = [[
'efficiency',[
'yScale',
'yAxisTitle'],[
'linear',
'#varepsilon']],[
'fakeRate',[
'yScale',
'yAxisTitle'],[
'log',
'Fake rate']]]
287 posX = cms.double(0.50),
288 posY = cms.double(0.72),
289 sizeX = cms.double(0.39),
290 sizeY = cms.double(0.17),
291 header = cms.string(
''),
292 option = cms.string(
'brNDC'),
293 borderSize = cms.int32(0),
294 fillColor = cms.int32(0)
296 legModifiers = [[
'efficiency',[
'posY',
'sizeY'],[0.72,0.17]],[
'efficiency_overlay',[
'posY',
'sizeY'],[0.66,0.23]]]
298 drawOptStuff = cms.PSet(
299 markerColor = cms.int32(1),
300 markerSize = cms.double(1.),
301 markerStyle = cms.int32(20),
302 lineColor = cms.int32(1),
303 lineStyle = cms.int32(1),
304 lineWidth = cms.int32(2),
305 drawOption = cms.string(
'ex0'),
306 drawOptionLegend = cms.string(
'p')
308 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]]]
310 standardDrawingStuff = cms.PSet(
311 canvasSizeX = cms.int32(640),
312 canvasSizeY = cms.int32(640),
313 indOutputFileName = cms.string(
'#PLOT#.png'),
314 xAxes = Utils.SpawnPSet(xModifiers,xAxisStuff),
315 yAxes = Utils.SpawnPSet(yModifiers,yAxisStuff),
316 legends = Utils.SpawnPSet(legModifiers,legStuff),
319 posX = cms.double(0.19),
320 posY = cms.double(0.77),
321 sizeX = cms.double(0.12),
322 sizeY = cms.double(0.04),
323 option = cms.string(
'brNDC'),
324 borderSize = cms.int32(0),
325 fillColor = cms.int32(0),
326 textColor = cms.int32(1),
327 textSize = cms.double(0.04),
328 textAlign = cms.int32(22),
329 text = cms.vstring(
'P_{T} > 5 GeV')
332 posX = cms.double(0.19),
333 posY = cms.double(0.83),
334 sizeX = cms.double(0.12),
335 sizeY = cms.double(0.04),
336 option = cms.string(
'brNDC'),
337 borderSize = cms.int32(0),
338 fillColor = cms.int32(0),
339 textColor = cms.int32(1),
340 textSize = cms.double(0.04),
341 textAlign = cms.int32(22),
342 text = cms.vstring(
'-2.5 < #eta < +2.5')
345 drawOptionSets = cms.PSet(
346 efficiency = cms.PSet(
348 markerColor = cms.int32(4),
349 markerSize = cms.double(1.),
350 markerStyle = cms.int32(20),
351 lineColor = cms.int32(1),
352 lineStyle = cms.int32(1),
353 lineWidth = cms.int32(1),
354 drawOption = cms.string(
'ep'),
355 drawOptionLegend = cms.string(
'p')
357 reference = cms.PSet(
358 lineColor = cms.int32(1),
359 lineStyle = cms.int32(1),
360 lineWidth = cms.int32(1),
361 fillColor = cms.int32(41),
362 drawOption = cms.string(
'eBand'),
363 drawOptionLegend = cms.string(
'l')
367 drawOptionEntries = Utils.SpawnPSet(drawOptModifiers,drawOptStuff)
370 standardCompareTestAndReference = cms.PSet(
371 processes = cms.PSet(
373 dqmDirectory = cms.string(
'test'),
374 legendEntry = cms.string(
'no test label'),
375 type = cms.string(
'smMC')
377 reference = cms.PSet(
378 dqmDirectory = cms.string(
'reference'),
379 legendEntry = cms.string(
'no ref label'),
380 type = cms.string(
'smMC')
441 """ Helper class that applies a given function to all modules
451 input = re.sub(
'fixedConePFTauProducer',
'pfRecoTauProducer', input)
453 fixedDiscriminationRegex = re.compile(
'fixedConePFTauDiscrimination(\w*)')
454 input = fixedDiscriminationRegex.sub(
r'pfRecoTauDiscrimination\1', input)
455 input = re.sub(
'shrinkingConePFTauProducer',
'pfRecoTauProducerHighEfficiency', input)
456 shrinkingDiscriminationRegex = re.compile(
'shrinkingConePFTauDiscrimination(\w*)')
457 input = shrinkingDiscriminationRegex.sub(
r'pfRecoTauDiscrimination\1HighEfficiency', input)
462 """ Converts a draw job defined to compare 31X named PFTau validtion efficiencies
463 to comapre a 31X to a 22X named validation """
465 if not hasattr(input,
"drawJobs"):
467 myDrawJobs = input.drawJobs.parameters_()
468 for drawJobName, drawJobData
in myDrawJobs.items():
470 if not drawJobData.plots.pythonTypeName() ==
"cms.PSet":
472 pSetToInsert = cms.PSet(
473 standardEfficiencyParameters,
477 dqmMonitorElements = drawJobData.plots.dqmMonitorElements,
478 process = cms.string(
'test'),
479 drawOptionEntry = cms.string(
'eff_overlay01'),
480 legendEntry = cms.string(input.processes.test.legendEntry.value())
486 process = cms.string(
'reference'),
487 drawOptionEntry = cms.string(
'eff_overlay02'),
488 legendEntry = cms.string(input.processes.reference.legendEntry.value())
492 input.drawJobs.__setattr__(drawJobName, pSetToInsert)
496 if hasattr(module,
'processes'):
497 if module.processes.hasParameter([
'test',
'legendEntry'])
and module.processes.hasParameter([
'reference',
'legendEntry']):
498 module.processes.test.legendEntry = TestLabel
499 module.processes.reference.legendEntry = ReferenceLabel
500 print(
"Set test label to %s and reference label to %s for plot producer %s" % (TestLabel, ReferenceLabel, module.label()))
502 print(
"ERROR in RecoTauValidation_cfi::MakeLabeler - trying to set test/reference label but %s does not have processes.(test/reference).legendEntry parameters!" % module.label())
506 ''' set all modules whose name contains one of the matching names to log y scale'''
508 ''' set a module to use log scaling in the yAxis'''
509 if hasattr(module,
'drawJobs'):
511 drawJobParamGetter =
lambda subName : getattr(module.drawJobs, subName)
513 attrNames =
dir(module.drawJobs)
514 for subModuleName, subModule
in zip(attrNames, map(drawJobParamGetter, attrNames)):
515 matchedNames = [name
for name
in matchingNames
if subModuleName.find( name) > -1]
516 if len(matchingNames) == 0:
517 matchedNames = [
'take',
'everything',
'and',
'dont',
'bother']
518 if hasattr(subModule,
"yAxis")
and len(matchedNames):
519 print(
"Setting drawJob: ", subModuleName,
" to log scale.")
520 subModule.yAxis = cms.string(
'fakeRate')
521 if len(matchingNames) == 0:
522 module.yAxes.efficiency.maxY_log = 40
523 module.yAxes.fakeRate.maxY_log = 40
528 def BaseDirectorizer(module):
531 if hasattr(module,
"outputFilePath"):
532 oldPath = module.outputFilePath.value()
533 newPath = os.path.join(newPath, oldPath)
534 if not os.path.exists(newPath):
537 module.outputFilePath = cms.string(
"%s" % newPath)
538 return BaseDirectorizer
541 if hasattr(module,
'drawJobs'):
543 drawJobs = module.drawJobs.parameterNames_()
544 for drawJob
in drawJobs:
545 if drawJob !=
"TauIdEffStepByStep":
546 module.drawJobs.__delattr__(drawJob)
547 print(
"Removing comparison plot", drawJob)
551 myPlottingSequence.visit(myFunctor)
555 myPlottingSequence.visit(myFunctor)
559 myPlottingSequence.visit(myFunctor)
562 myProcess.loadTau.test.inputFileNames = cms.vstring(FileLoc)
566 del myProcess.loadTau.reference
568 myProcess.loadTau.reference.inputFileNames = cms.vstring(FileLoc)
572 myPlottingSequence.visit(myFunctor)
576 myPlottingSequence.visit(myFunctor)
580 myPlottingSequence.visit(myFunctor)
583 module.ExtensionName = module.ExtensionName.value()+extension
586 if module._TypedParameterizable__type ==
'TauTagValidation':
587 module.histoSettings = pset
590 if hasattr(module,
'_TypedParameterizable__type')
and module._TypedParameterizable__type ==
'TauTagValidation':
591 setattr(module,
'turnOnTrigger',cms.bool(
True))
592 for item
in pset.parameters_().
items():
593 setattr(module.GenericTriggerSelection,item[0],item[1])
def SetPlotOnlyStepByStep
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def TranslateToLegacyProdNames
def ConvertDrawJobToLegacyCompare
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def SetValidationExtention
The plotting of HPS Efficiencies.
def SetReferenceFileToPlot
def RemoveComparisonPlotCommands
def SetTestAndReferenceLabels
def SetCompareToLegacyProductNames