1 from __future__
import absolute_import
2 import FWCore.ParameterSet.Config
as cms
8 from Validation.RecoTrack.trajectorySeedTracks_cfi
import trajectorySeedTracks
as _trajectorySeedTracks
12 from .
import cutsRecoTracks_cfi
16 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi
import trackingParticleRefSelector
as _trackingParticleRefSelector
17 from CommonTools.RecoAlgos.trackingParticleConversionRefSelector_cfi
import trackingParticleConversionRefSelector
as _trackingParticleConversionRefSelector
18 from SimTracker.TrackHistory.trackingParticleBHadronRefSelector_cfi
import trackingParticleBHadronRefSelector
as _trackingParticleBHadronRefSelector
20 from CommonTools.RecoAlgos.recoChargedRefCandidateToTrackRefProducer_cfi
import recoChargedRefCandidateToTrackRefProducer
as _recoChargedRefCandidateToTrackRefProducer
22 import RecoTracker.IterativeTracking.iterativeTkConfig
as _cfg
23 import RecoTracker.IterativeTracking.iterativeTkUtils
as _utils
24 from Configuration.Eras.Modifier_fastSim_cff
import fastSim
29 for _eraName, _postfix, _era
in _cfg.allEras():
30 _seedProd = [
"initialStepSeedsPreSplitting"]
31 _trackProd = [
"initialStepTracksPreSplitting"]
32 if _eraName
in [
"trackingLowPU",
"trackingPhase2PU140"]:
36 locals()[
"_algos"+_postfix] = [
"generalTracks"] + _cfg.iterationAlgos(_postfix) + [
"duplicateMerge"]
37 locals()[
"_seedProducersPreSplitting"+_postfix] = _seedProd
38 locals()[
"_trackProducersPreSplitting"+_postfix] = _trackProd
39 locals()[
"_seedProducers"+_postfix] = _cfg.seedProducers(_postfix)
40 locals()[
"_trackProducers"+_postfix] = _cfg.trackProducers(_postfix)
42 if _eraName !=
"trackingPhase2PU140":
43 locals()[
"_electronSeedProducers"+_postfix] = [
"tripletElectronSeeds",
"pixelPairElectronSeeds",
"stripPairElectronSeeds"]
45 locals()[
"_electronSeedProducers"+_postfix] = [
"tripletElectronSeeds"]
47 _removeForFastSimSeedProducers =[
"initialStepSeedsPreSplitting",
48 "jetCoreRegionalStepSeeds",
49 "muonSeededSeedsInOut",
50 "muonSeededSeedsOutIn"]
51 _seedProducers_fastSim = [ x
for x
in _seedProducers
if x
not in _removeForFastSimSeedProducers]
53 _removeForFastTrackProducers = [
"initialStepTracksPreSplitting",
54 "jetCoreRegionalStepTracks",
55 "muonSeededTracksInOut",
56 "muonSeededTracksOutIn"]
57 _trackProducers_fastSim = [ x
for x
in _trackProducers
if x
not in _removeForFastTrackProducers]
61 if algo !=
"generalTracks":
62 sel = algo[0].
upper()+algo[1:]
63 return "cutsRecoTracks"+sel
69 if algo ==
"generalTracks":
72 if modName
not in modDict:
73 mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(algorithm=[algo])
74 modDict[modName] = mod
76 mod = modDict[modName]
85 modNameHp = modName+
"Hp" 86 if modNameHp
not in modDict:
87 if algo ==
"generalTracks":
88 mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(quality=[
"highPurity"])
90 mod = modDict[modName].
clone(quality=[
"highPurity"])
91 modDict[modNameHp] = mod
93 mod = modDict[modNameHp]
94 names.append(modNameHp)
100 for modName
in modules:
101 modNameNew = modName.replace(
"cutsRecoTracks",
"cutsRecoTracks"+midfix)
102 if modNameNew
not in modDict:
103 mod = modDict[modName].
clone(src=src)
104 modDict[modNameNew] = mod
106 mod = modDict[modNameNew]
107 names.append(modNameNew)
113 for modName
in modules:
114 if modName[-2:] ==
"Hp":
115 modNameNew = modName[:-2] + midfix +
"Hp" 117 modNameNew = modName + midfix
118 if modNameNew
not in modDict:
119 mod = modDict[modName].
clone()
120 setattr(mod, algoParam, mod.algorithm.value())
122 modDict[modNameNew] = mod
124 mod = modDict[modNameNew]
125 names.append(modNameNew)
131 for seed
in seedProducers:
132 modName =
"seedTracks"+seed
133 if modName
not in modDict:
134 mod = _trajectorySeedTracks.clone(src=seed)
135 modDict[modName] = mod
137 mod = modDict[modName]
138 names.append(modName)
142 _relevantEras = _cfg.allEras()
143 _relevantErasAndFastSim = _relevantEras + [(
"fastSim",
"_fastSim", fastSim)]
147 if isinstance(arg, list):
150 ret.append(modDict[arg+postfix])
152 def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False):
154 raise Exception(
"Task name is expected to begin with _")
156 _eras = _relevantErasAndFastSim
if includeFastSim
else _relevantEras
157 for eraName, postfix, _era
in _eras:
159 _args.extend(plainArgs)
160 ret =
function(*_args, modDict=modDict)
162 raise Exception(
"_taskForEachEra is expected to return 2 values, but function returned %d" % len(ret))
163 modDict[names+postfix] = ret[0]
164 modDict[task+postfix] = ret[1]
167 defaultTaskName = task+_eras[0][0]
168 defaultTask = modDict[defaultTaskName]
169 modDict[defaultTaskName[1:]] = defaultTask
172 if modifyTask
is not None:
173 for eraName, postfix, _era
in _eras:
177 for _eraName, _postfix, _era
in _eras[1:]:
178 _era.toReplaceWith(defaultTask, modDict[task+_postfix])
181 for key, value
in six.iteritems(kwargs):
182 setattr(module, key, value)
184 era.toModify(module, **kwargs)
188 def _findSeedingLayers(name):
189 prod = getattr(config, name)
190 if hasattr(prod,
"triplets"):
191 if hasattr(prod,
"layerList"):
192 return prod.layerList.refToPSet_.value()
193 return _findSeedingLayers(prod.triplets.getModuleLabel())
194 elif hasattr(prod,
"doublets"):
195 return _findSeedingLayers(prod.doublets.getModuleLabel())
196 label = prod.trackingRegionsSeedingLayers.getModuleLabel()
199 return prod.seedingLayers.getModuleLabel()
201 seedingLayersMerged = []
202 for seedName
in seedProducers:
203 seedProd = getattr(config, seedName)
204 seedingLayersName =
None 206 if hasattr(seedProd,
"OrderedHitsFactoryPSet"):
207 seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel()
208 elif hasattr(seedProd,
"seedingHitSets"):
209 seedingLayersName = _findSeedingLayers(seedProd.seedingHitSets.getModuleLabel())
210 elif hasattr(seedProd,
"layerList"):
211 seedingLayers = seedProd.layerList.value()
215 if seedingLayersName
is not None:
216 seedingLayers = getattr(config, seedingLayersName).layerList.value()
217 for layerSet
in seedingLayers:
218 if layerSet
not in seedingLayersMerged:
219 seedingLayersMerged.append(layerSet)
221 return seedingLayersMerged
224 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
227 if "_electronSeedProducers"+_postfix
in locals():
228 for _layer
in _getSeedingLayers(locals()[
"_electronSeedProducers"+_postfix], _ElectronSeeds_cff):
229 if _layer
not in _stdLayers:
230 _eleLayers.append(_layer)
232 locals()[
"_seedingLayerSets"+_postfix] = _stdLayers
233 locals()[
"_seedingLayerSetsForElectrons"+_postfix] = _eleLayers
238 mvaSel = _utils.getMVASelectors(postfix)
240 pset = cms.untracked.PSet()
241 for iteration, (trackProducer, classifiers)
in six.iteritems(mvaSel):
242 setattr(pset, trackProducer, cms.untracked.vstring(classifiers))
244 for _eraName, _postfix, _era
in _relevantEras:
248 _taskForEachEra(_addSelectorsByAlgo, args=[
"_algos"], names=
"_selectorsByAlgo", task=
"_tracksValidationSelectorsByAlgo", modDict=globals())
251 _taskForEachEra(_addSelectorsByHp, args=[
"_algos"], names=
"_selectorsByAlgoHp", task=
"_tracksValidationSelectorsByAlgoHp", modDict=globals())
254 for _eraName, _postfix, _era
in _relevantEras:
255 locals()[
"_selectorsByAlgoAndHp"+_postfix] = locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix]
257 locals()[
"_selectorsByAlgoAndHpNoGenTk"+_postfix] = [n
for n
in locals()[
"_selectorsByAlgoAndHp"+_postfix]
if n
not in [
"generalTracks",
"cutsRecoTracksHp"]]
259 locals()[
"_selectorsByAlgoAndHpNoGenTkDupMerge"+_postfix] = [n
for n
in locals()[
"_selectorsByAlgoAndHpNoGenTk"+_postfix]
if n
not in [
"cutsRecoTracksDuplicateMerge",
"cutsRecoTracksDuplicateMergeHp"]]
261 args = [
"_selectorsByAlgoAndHpNoGenTkDupMerge"], plainArgs = [
"ByOriginalAlgo",
"originalAlgorithm"],
262 names =
"_selectorsByOriginalAlgo", task =
"_tracksValidationSelectorsByOriginalAlgo")
265 for _eraName, _postfix, _era
in _relevantEras:
266 selectors = locals()[
"_selectorsByAlgoHp"+_postfix]
267 locals()[
"_generalTracksHp"+_postfix] = selectors[0]
268 locals()[
"_selectorsByAlgoHp"+_postfix] = selectors[1:]
271 import PhysicsTools.RecoAlgos.btvTracks_cfi
as btvTracks_cfi
272 cutsRecoTracksBtvLike = btvTracks_cfi.btvTrackRefs.clone()
276 ak4JetTracksAssociatorExplicitAll = ak4JTA_cff.ak4JetTracksAssociatorExplicit.clone(
280 import CommonTools.RecoAlgos.jetTracksAssociationToTrackRefs_cfi
as jetTracksAssociationToTrackRefs_cfi
281 cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone(
282 association =
"ak4JetTracksAssociatorExplicitAll",
289 trackingParticlesSignal = _trackingParticleRefSelector.clone(
300 generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9)
303 args=[[
"_generalTracksHp"]],
304 plainArgs=[
"Pt09",
"generalTracksPt09"],
305 names=
"_selectorsPt09", task=
"_tracksValidationSelectorsPt09",
306 modifyTask=
lambda task:task.add(generalTracksPt09))
310 generalTracksFromPV = _trackWithVertexRefSelector.clone(
311 src =
"generalTracks",
316 vertexTag =
"offlinePrimaryVertices",
324 args=[[
"_generalTracksHp"]],
325 plainArgs=[
"FromPV",
"generalTracksFromPV"],
326 names=
"_selectorsFromPV", task=
"_tracksValidationSelectorsFromPV",
327 modifyTask=
lambda task: task.add(generalTracksFromPV))
330 generalTracksFromPVPt09 = generalTracksPt09.clone(src=
"generalTracksFromPV")
333 args=[[
"_generalTracksHp"]],
334 plainArgs=[
"FromPVPt09",
"generalTracksFromPVPt09"],
335 names=
"_selectorsFromPVPt09", task=
"_tracksValidationSelectorsFromPVPt09",
336 modifyTask=
lambda task: task.add(generalTracksFromPVPt09))
339 trackingParticlesConversion = _trackingParticleConversionRefSelector.clone()
342 trackingParticlesElectron = _trackingParticleRefSelector.clone(
353 highPtJets = cms.EDFilter(
"CandPtrSelector", src = cms.InputTag(
"ak4CaloJets"), cut = cms.string(
"pt()>1000"))
354 highPtJetsForTrk = highPtJetsForTrk = highPtJets.clone(src =
"ak4CaloJetsForTrk")
357 trackingParticlesBHadron = _trackingParticleBHadronRefSelector.clone()
360 trackValidator = Validation.RecoTrack.MultiTrackValidator_cfi.multiTrackValidator.clone(
361 useLogPt = cms.untracked.bool(
True),
363 doPVAssociationPlots =
True 368 fastSim.toModify(trackValidator,
371 for _eraName, _postfix, _era
in _relevantEras:
373 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]] +
374 locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix] +
375 locals()[
"_selectorsByOriginalAlgo"+_postfix] +
376 [
"generalTracksPt09"] + locals()[
"_selectorsPt09"+_postfix] +
378 "cutsRecoTracksBtvLike",
379 "cutsRecoTracksAK4PFJets" 381 doResolutionPlotsForLabels = [
383 locals()[
"_generalTracksHp"+_postfix],
385 "cutsRecoTracksBtvLike",
388 _setForEra(trackValidator.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=locals()[
"_seedingLayerSets"+_postfix])
391 trackValidatorTPPtLess09 = trackValidator.clone(
392 dirName =
"Tracking/TrackTPPtLess09/",
393 label = [x
for x
in trackValidator.label.value()
if (
"Pt09" not in x)
and (
"BtvLike" not in x)
and (
"AK4PFJets" not in x)],
395 histoProducerAlgoBlock =
dict(
396 TpSelectorForEfficiencyVsEta =
dict(ptMin=0.05),
397 TpSelectorForEfficiencyVsPhi =
dict(ptMin=0.05),
398 TpSelectorForEfficiencyVsVTXR =
dict(ptMin=0.05),
399 TpSelectorForEfficiencyVsVTXZ =
dict(ptMin=0.05),
402 doRecoTrackPlots =
False,
403 doResolutionPlotsForLabels = [
"disabled"],
408 trackValidatorFromPV = trackValidator.clone(
409 dirName =
"Tracking/TrackFromPV/",
410 label_tp_effic =
"trackingParticlesSignal",
411 label_tp_fake =
"trackingParticlesSignal",
412 label_tp_effic_refvector =
True,
413 label_tp_fake_refvector =
True,
414 trackCollectionForDrCalculation =
"generalTracksFromPV",
415 doPlotsOnlyForTruePV =
True,
416 doPVAssociationPlots =
False,
417 doResolutionPlotsForLabels = [
"disabled"],
419 for _eraName, _postfix, _era
in _relevantEras:
420 _setForEra(trackValidatorFromPV, _eraName, _era,
421 label = [
"generalTracksFromPV"] + locals()[
"_selectorsFromPV"+_postfix] + [
"generalTracksFromPVPt09"] + locals()[
"_selectorsFromPVPt09"+_postfix],
422 doResolutionPlotsForLabels = []
427 trackValidatorFromPVAllTP = trackValidatorFromPV.clone(
428 dirName =
"Tracking/TrackFromPVAllTP/",
429 label_tp_effic = trackValidator.label_tp_effic.value(),
430 label_tp_fake = trackValidator.label_tp_fake.value(),
431 label_tp_effic_refvector =
False,
432 label_tp_fake_refvector =
False,
434 doSimTrackPlots =
False,
435 doResolutionPlotsForLabels = [
"disabled"],
439 trackValidatorAllTPEffic = trackValidator.clone(
440 dirName =
"Tracking/TrackAllTPEffic/",
441 label = [x
for x
in trackValidator.label.value()
if "Pt09" not in x],
443 doRecoTrackPlots =
True,
444 doPVAssociationPlots =
False,
445 doResolutionPlotsForLabels = [
"disabled"],
447 trackValidatorAllTPEffic.histoProducerAlgoBlock.generalTpSelector.signalOnly =
False 448 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsEta.signalOnly =
False 449 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPhi.signalOnly =
False 450 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPt.signalOnly =
False 451 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXR.signalOnly =
False 452 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXZ.signalOnly =
False 453 for _eraName, _postfix, _era
in _relevantEras:
454 _setForEra(trackValidatorAllTPEffic, _eraName, _era, label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]])
457 tpClusterProducerPreSplitting = tpClusterProducer.clone(pixelClusterSrc =
"siPixelClustersPreSplitting")
458 quickTrackAssociatorByHitsPreSplitting = quickTrackAssociatorByHits.clone(cluster2TPSrc =
"tpClusterProducerPreSplitting")
459 _trackValidatorSeedingBuilding = trackValidator.clone(
460 associators = [
"quickTrackAssociatorByHits"],
461 UseAssociators =
True,
463 doPVAssociationPlots =
False,
465 doResolutionPlotsForLabels = [
"disabled"],
467 trackValidatorBuilding = _trackValidatorSeedingBuilding.clone(
468 dirName =
"Tracking/TrackBuilding/",
471 trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone(
472 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
474 doSummaryPlots =
False,
476 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
477 _setForEra(trackValidatorBuilding, _eraName, _era, label = locals()[
"_trackProducers"+_postfix])
478 fastSim.toModify(trackValidatorBuilding, doMVAPlots=
False)
479 for _eraName, _postfix, _era
in _relevantEras:
480 _setForEra(trackValidatorBuilding, _eraName, _era, mvaLabels = locals()[
"_mvaSelectors"+_postfix])
481 _setForEra(trackValidatorBuildingPreSplitting, _eraName, _era, label = locals()[
"_trackProducersPreSplitting"+_postfix])
485 trackValidatorConversion = trackValidator.clone(
486 dirName =
"Tracking/TrackConversion/",
489 "conversionStepTracks",
490 "ckfInOutTracksFromConversions",
491 "ckfOutInTracksFromConversions",
493 label_tp_effic =
"trackingParticlesConversion",
494 label_tp_effic_refvector =
True,
495 associators = [
"quickTrackAssociatorByHits"],
496 UseAssociators =
True,
499 doPVAssociationPlots =
False,
500 calculateDrSingleCollection =
False,
504 firstLayers = [layerSet.split(
"+")[0]
for layerSet
in layerList]
506 for l
in firstLayers:
511 if l.startswith(
"TEC"):
517 trackValidatorConversion.histoProducerAlgoBlock.seedingLayerSets =
_uniqueFirstLayers(_convLayerPairs.layerList.value())
519 for n
in [
"Eta",
"Phi",
"Pt",
"VTXR",
"VTXZ"]:
520 pset = getattr(trackValidatorConversion.histoProducerAlgoBlock,
"TpSelectorForEfficiencyVs"+n)
521 pset.lip = trackValidatorConversion.lipTP.value()
522 pset.tip = trackValidatorConversion.tipTP.value()
525 trackValidatorGsfTracks = trackValidatorConversion.clone(
526 dirName =
"Tracking/TrackGsf/",
527 label = [
"electronGsfTracks"],
528 label_tp_effic =
"trackingParticlesElectron",
531 for _eraName, _postfix, _era
in _relevantEras:
532 _setForEra(trackValidatorGsfTracks.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=trackValidator.histoProducerAlgoBlock.seedingLayerSets.value()+locals()[
"_seedingLayerSetsForElectrons"+_postfix])
537 trackValidatorBHadron = trackValidator.clone(
538 dirName =
"Tracking/TrackBHadron/",
539 label_tp_effic =
"trackingParticlesBHadron",
540 label_tp_effic_refvector =
True,
542 doRecoTrackPlots =
False,
545 for _eraName, _postfix, _era
in _relevantEras:
546 _setForEra(trackValidatorBHadron, _eraName, _era,
547 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix],
"cutsRecoTracksBtvLike"]
552 tracksValidationSelectors = cms.Task(
553 tracksValidationSelectorsByAlgo,
554 tracksValidationSelectorsByAlgoHp,
555 tracksValidationSelectorsByOriginalAlgo,
556 cutsRecoTracksBtvLike,
557 ak4JetTracksAssociatorExplicitAll,
558 cutsRecoTracksAK4PFJets
560 tracksValidationTruth = cms.Task(
562 tpClusterProducerPreSplitting,
563 quickTrackAssociatorByHits,
564 quickTrackAssociatorByHitsPreSplitting,
565 trackingParticleRecoTrackAsssociation,
566 VertexAssociatorByPositionAndTracks,
567 trackingParticleNumberOfLayersProducer
569 fastSim.toModify(tracksValidationTruth,
lambda x: x.remove(tpClusterProducer))
571 tracksPreValidation = cms.Task(
573 tracksValidationSelectors,
574 tracksValidationSelectorsPt09,
575 tracksValidationSelectorsFromPV,
576 tracksValidationSelectorsFromPVPt09,
577 tracksValidationTruth,
578 trackingParticlesSignal,
579 trackingParticlesElectron,
580 trackingParticlesConversion
582 fastSim.toReplaceWith(tracksPreValidation, tracksPreValidation.copyAndExclude([
583 trackingParticlesElectron,
584 trackingParticlesConversion,
587 tracksValidation = cms.Sequence(
589 trackValidatorTPPtLess09 +
590 trackValidatorFromPV +
591 trackValidatorFromPVAllTP +
592 trackValidatorAllTPEffic +
593 trackValidatorBuilding +
594 trackValidatorBuildingPreSplitting +
595 trackValidatorConversion +
596 trackValidatorGsfTracks,
599 fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([
600 trackValidatorBuildingPreSplitting,
601 trackValidatorConversion,
602 trackValidatorGsfTracks,
609 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"ByAlgoMask",
"algorithmMaskContains"],
610 names =
"_selectorsByAlgoMask", task =
"_tracksValidationSelectorsByAlgoMaskStandalone")
615 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"Pt09",
"generalTracksPt09"],
616 names =
"_selectorsPt09Standalone", task =
"_tracksValidationSelectorsPt09Standalone")
621 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPV",
"generalTracksFromPV"],
622 names =
"_selectorsFromPVStandalone", task =
"_tracksValidationSelectorsFromPVStandalone")
627 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPVPt09",
"generalTracksFromPVPt09"],
628 names =
"_selectorsFromPVPt09Standalone", task =
"_tracksValidationSelectorsFromPVPt09Standalone")
631 trackValidatorStandalone = trackValidator.clone(
634 trackValidatorTPPtLess09Standalone = trackValidatorTPPtLess09.clone(
637 for _eraName, _postfix, _era
in _relevantEras:
638 _setForEra(trackValidatorStandalone, _eraName, _era, label = trackValidator.label + locals()[
"_selectorsByAlgoMask"+_postfix] + locals()[
"_selectorsPt09Standalone"+_postfix])
639 _setForEra(trackValidatorTPPtLess09Standalone, _eraName, _era, label = trackValidatorTPPtLess09.label + locals()[
"_selectorsByAlgoMask"+_postfix] + locals()[
"_selectorsPt09Standalone"+_postfix])
641 trackValidatorFromPVStandalone = trackValidatorFromPV.clone(
644 for _eraName, _postfix, _era
in _relevantEras:
645 _setForEra(trackValidatorFromPVStandalone, _eraName, _era, label = trackValidatorFromPV.label + locals()[
"_selectorsFromPVStandalone"+_postfix] + locals()[
"_selectorsFromPVPt09Standalone"+_postfix])
648 trackValidatorFromPVAllTPStandalone = trackValidatorFromPVAllTP.clone(
649 label = trackValidatorFromPVStandalone.label.value(),
653 trackValidatorAllTPEfficStandalone = trackValidatorAllTPEffic.clone(
654 label = [ x
for x
in trackValidator.label.value()
if x
not in [
"cutsRecoTracksBtvLike",
"cutsRecoTracksAK4PFJets"]
and "Pt09" not in x],
659 trackValidatorConversionStandalone = trackValidatorConversion.clone(
660 label = [x
for x
in trackValidatorConversion.label
if x !=
"convStepTracks"],
664 trackValidatorBHadronStandalone = trackValidatorBHadron.clone(
665 label = [x
for x
in trackValidatorStandalone.label
if "Pt09" not in x],
669 trackValidatorGsfTracksStandalone = trackValidatorGsfTracks.clone(
674 tracksPreValidationStandalone = tracksPreValidation.copy()
675 tracksPreValidationStandalone.add(trackingParticlesBHadron)
676 tracksPreValidationStandalone.replace(highPtJetsForTrk,highPtJets)
677 fastSim.toReplaceWith(tracksPreValidationStandalone, tracksPreValidation)
679 tracksValidationSelectorsStandalone = cms.Task(
680 tracksValidationSelectorsByAlgoMaskStandalone,
681 tracksValidationSelectorsPt09Standalone,
682 tracksValidationSelectorsFromPVStandalone,
683 tracksValidationSelectorsFromPVPt09Standalone
688 _trackValidatorsBase = cms.Sequence(
689 trackValidatorStandalone +
690 trackValidatorTPPtLess09Standalone +
691 trackValidatorFromPVStandalone +
692 trackValidatorFromPVAllTPStandalone +
693 trackValidatorAllTPEfficStandalone +
694 trackValidatorConversionStandalone +
695 trackValidatorGsfTracksStandalone +
696 trackValidatorBHadronStandalone
698 trackValidatorsStandalone = _trackValidatorsBase.copy()
699 fastSim.toModify(trackValidatorsStandalone,
lambda x: x.remove(trackValidatorConversionStandalone) )
701 tracksValidationStandalone = cms.Sequence(
702 ak4PFL1FastL2L3CorrectorChain +
703 trackValidatorsStandalone,
704 tracksPreValidationStandalone,
705 tracksValidationSelectorsStandalone
711 tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets])
712 _taskForEachEra(_addSeedToTrackProducers, args=[
"_seedProducers"], names=
"_seedSelectors", task=
"_tracksValidationSeedSelectorsTrackingOnly", includeFastSim=
True, modDict=globals())
713 _taskForEachEra(_addSeedToTrackProducers, args=[
"_seedProducersPreSplitting"], names=
"_seedSelectorsPreSplitting", task=
"_tracksValidationSeedSelectorsPreSplittingTrackingOnly", modDict=globals())
714 tracksValidationSeedSelectorsTrackingOnly.add(tracksValidationSeedSelectorsPreSplittingTrackingOnly)
717 trackValidatorTrackingOnly = trackValidatorStandalone.clone(
718 label = [ x
for x
in trackValidatorStandalone.label
if x !=
"cutsRecoTracksAK4PFJets"],
719 cores =
"highPtJetsForTrk" 722 trackValidatorSeedingTrackingOnly = _trackValidatorSeedingBuilding.clone(
723 dirName =
"Tracking/TrackSeeding/",
724 label = _seedSelectors,
727 trackValidatorSeedingPreSplittingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
728 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
729 label = _seedSelectorsPreSplitting,
730 doSummaryPlots =
False,
733 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
734 _setForEra(trackValidatorSeedingTrackingOnly, _eraName, _era, label = locals()[
"_seedSelectors"+_postfix])
735 for _eraName, _postfix, _era
in _relevantEras:
736 _setForEra(trackValidatorSeedingPreSplittingTrackingOnly, _eraName, _era, label = locals()[
"_seedSelectorsPreSplitting"+_postfix])
739 trackValidatorConversionTrackingOnly = trackValidatorConversion.clone(label = [x
for x
in trackValidatorConversion.label
if x
not in [
"ckfInOutTracksFromConversions",
"ckfOutInTracksFromConversions"]])
741 trackValidatorBHadronTrackingOnly = trackValidatorBHadron.clone(label = [x
for x
in trackValidatorTrackingOnly.label
if "Pt09" not in x])
743 trackValidatorTPPtLess09TrackingOnly = trackValidatorTPPtLess09Standalone.clone(cores =
"highPtJetsForTrk")
744 trackValidatorFromPVTrackingOnly = trackValidatorFromPVStandalone.clone(cores =
"highPtJetsForTrk")
745 trackValidatorFromPVAllTPTrackingOnly = trackValidatorFromPVAllTPStandalone.clone(cores =
"highPtJetsForTrk")
746 trackValidatorAllTPEfficTrackingOnly = trackValidatorAllTPEfficStandalone.clone(cores =
"highPtJetsForTrk")
748 tracksPreValidationTrackingOnly = tracksPreValidationStandalone.copy()
749 tracksPreValidationTrackingOnly.replace(tracksValidationSelectors, tracksValidationSelectorsTrackingOnly)
750 tracksPreValidationTrackingOnly.replace(highPtJets,highPtJetsForTrk)
752 trackValidatorsTrackingOnly = _trackValidatorsBase.copy()
753 trackValidatorsTrackingOnly.replace(trackValidatorStandalone, trackValidatorTrackingOnly)
754 trackValidatorsTrackingOnly.replace(trackValidatorTPPtLess09Standalone,trackValidatorTPPtLess09TrackingOnly)
755 trackValidatorsTrackingOnly.replace(trackValidatorFromPVStandalone,trackValidatorFromPVTrackingOnly)
756 trackValidatorsTrackingOnly.replace(trackValidatorFromPVAllTPStandalone,trackValidatorFromPVAllTPTrackingOnly)
757 trackValidatorsTrackingOnly.replace(trackValidatorAllTPEfficStandalone,trackValidatorAllTPEfficTrackingOnly)
758 trackValidatorsTrackingOnly += trackValidatorSeedingTrackingOnly
759 trackValidatorsTrackingOnly += trackValidatorSeedingPreSplittingTrackingOnly
760 trackValidatorsTrackingOnly += trackValidatorBuilding
761 trackValidatorsTrackingOnly += trackValidatorBuildingPreSplitting
762 trackValidatorsTrackingOnly.replace(trackValidatorConversionStandalone, trackValidatorConversionTrackingOnly)
763 trackValidatorsTrackingOnly.remove(trackValidatorGsfTracksStandalone)
764 trackValidatorsTrackingOnly.replace(trackValidatorBHadronStandalone, trackValidatorBHadronTrackingOnly)
765 fastSim.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([
766 trackValidatorBuildingPreSplitting,
767 trackValidatorSeedingPreSplittingTrackingOnly,
768 trackValidatorConversionTrackingOnly,
769 trackValidatorBHadronTrackingOnly
773 tracksValidationTrackingOnly = cms.Sequence(
774 trackValidatorsTrackingOnly,
775 tracksPreValidationTrackingOnly,
776 tracksValidationSelectorsStandalone,
777 tracksValidationSeedSelectorsTrackingOnly
782 trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone(
783 label_tr =
"pixelTracks",
784 associator =
"quickTrackAssociatorByHitsPreSplitting",
786 PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone(
787 trackAssociation =
"trackingParticlePixelTrackAsssociation" 790 trackValidatorPixelTrackingOnly = trackValidator.clone(
791 dirName =
"Tracking/PixelTrack/",
792 label = [
"pixelTracks"],
793 doResolutionPlotsForLabels = [],
794 trackCollectionForDrCalculation =
"pixelTracks",
795 associators = [
"trackingParticlePixelTrackAsssociation"],
796 label_vertex =
"pixelVertices",
797 vertexAssociator =
"PixelVertexAssociatorByPositionAndTracks",
799 cores = cms.InputTag(
""),
802 tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy()
803 tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation)
804 tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks)
805 tracksValidationPixelTrackingOnly = cms.Sequence(
806 trackValidatorPixelTrackingOnly,
807 tracksValidationTruthPixelTrackingOnly
812 trackValidatorLite = trackValidator.clone(
813 label = [
"generalTracks",
"cutsRecoTracksHp"]
815 tracksValidationLite = cms.Sequence(
818 tracksValidationTruth
822 from Configuration.Eras.Modifier_phase2_timing_layer_cff
import phase2_timing_layer
823 phase2_timing_layer.toModify( generalTracksFromPV,
824 timesTag = cms.InputTag(
'trackTimeValueMapProducer:generalTracksConfigurableFlatResolutionModel'),
825 timeResosTag = cms.InputTag(
'trackTimeValueMapProducer:generalTracksConfigurableFlatResolutionModelResolution'),
826 nSigmaDtVertex = cms.double(3) )
827 phase2_timing_layer.toModify( trackValidatorStandalone,
828 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
829 phase2_timing_layer.toModify( trackValidatorFromPVStandalone,
830 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
831 phase2_timing_layer.toModify( trackValidatorFromPVAllTPStandalone,
832 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
833 phase2_timing_layer.toModify( trackValidatorConversionStandalone,
834 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
835 phase2_timing_layer.toModify( trackValidatorGsfTracks,
836 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
838 from Configuration.Eras.Modifier_phase2_timing_layer_tile_cff
import phase2_timing_layer_tile
839 from Configuration.Eras.Modifier_phase2_timing_layer_bar_cff
import phase2_timing_layer_bar
840 (phase2_timing_layer_tile | phase2_timing_layer_bar).toModify( generalTracksFromPV,
841 timesTag = cms.InputTag(
'tofPID:t0'),
842 timeResosTag = cms.InputTag(
'tofPID:sigmat0') )
def _getMVASelectors(postfix)
def _setForEra(module, eraName, era, kwargs)
def _translateArgs(args, postfix, modDict)
def _uniqueFirstLayers(layerList)
_addSelectorsByOriginalAlgoMask
Then define stuff for standalone mode (i.e.
def _getSeedingLayers(seedProducers, config)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
def _algoToSelector(algo)
def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False)