1 from __future__
import absolute_import
2 import FWCore.ParameterSet.Config
as cms
8 from Validation.RecoTrack.trajectorySeedTracks_cfi
import trajectorySeedTracks
as _trajectorySeedTracks
17 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi
import trackingParticleRefSelector
as _trackingParticleRefSelector
18 from CommonTools.RecoAlgos.trackingParticleConversionRefSelector_cfi
import trackingParticleConversionRefSelector
as _trackingParticleConversionRefSelector
19 from SimTracker.TrackHistory.trackingParticleBHadronRefSelector_cfi
import trackingParticleBHadronRefSelector
as _trackingParticleBHadronRefSelector
21 from CommonTools.RecoAlgos.recoChargedRefCandidateToTrackRefProducer_cfi
import recoChargedRefCandidateToTrackRefProducer
as _recoChargedRefCandidateToTrackRefProducer
23 import RecoTracker.IterativeTracking.iterativeTkConfig
as _cfg
24 import RecoTracker.IterativeTracking.iterativeTkUtils
as _utils
25 from Configuration.Eras.Modifier_fastSim_cff
import fastSim
30 for _eraName, _postfix, _era
in _cfg.allEras():
31 _seedProd = [
"initialStepSeedsPreSplitting"]
32 _trackProd = [
"initialStepTracksPreSplitting"]
33 if _eraName
in [
"trackingLowPU",
"trackingPhase2PU140"]:
37 locals()[
"_algos"+_postfix] = [
"generalTracks"] + _cfg.iterationAlgos(_postfix) + [
"duplicateMerge"]
38 locals()[
"_seedProducersPreSplitting"+_postfix] = _seedProd
39 locals()[
"_trackProducersPreSplitting"+_postfix] = _trackProd
40 locals()[
"_seedProducers"+_postfix] = _cfg.seedProducers(_postfix)
41 locals()[
"_trackProducers"+_postfix] = _cfg.trackProducers(_postfix)
43 if _eraName !=
"trackingPhase2PU140":
44 locals()[
"_electronSeedProducers"+_postfix] = [
"tripletElectronSeeds",
"pixelPairElectronSeeds",
"stripPairElectronSeeds"]
46 locals()[
"_electronSeedProducers"+_postfix] = [
"tripletElectronSeeds"]
48 _removeForFastSimSeedProducers =[
"initialStepSeedsPreSplitting",
49 "jetCoreRegionalStepSeeds",
50 "muonSeededSeedsInOut",
51 "muonSeededSeedsOutIn"]
52 _seedProducers_fastSim = [ x
for x
in _seedProducers
if x
not in _removeForFastSimSeedProducers]
54 _removeForFastTrackProducers = [
"initialStepTracksPreSplitting",
55 "jetCoreRegionalStepTracks",
56 "muonSeededTracksInOut",
57 "muonSeededTracksOutIn"]
58 _trackProducers_fastSim = [ x
for x
in _trackProducers
if x
not in _removeForFastTrackProducers]
62 if algo !=
"generalTracks":
63 sel = algo[0].
upper()+algo[1:]
64 return "cutsRecoTracks"+sel
70 if algo ==
"generalTracks":
73 if modName
not in modDict:
74 mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(
78 modDict[modName] = mod
80 mod = modDict[modName]
89 modNameHp = modName+
"Hp"
90 if modNameHp
not in modDict:
91 if algo ==
"generalTracks":
92 mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(quality=[
"highPurity"])
94 mod = modDict[modName].
clone(quality=[
"highPurity"])
95 modDict[modNameHp] = mod
97 mod = modDict[modNameHp]
98 names.append(modNameHp)
104 for modName
in modules:
105 modNameNew = modName.replace(
"cutsRecoTracks",
"cutsRecoTracks"+midfix)
106 if modNameNew
not in modDict:
107 mod = modDict[modName].
clone(src=src)
108 modDict[modNameNew] = mod
110 mod = modDict[modNameNew]
111 names.append(modNameNew)
117 for modName
in modules:
118 if modName[-2:] ==
"Hp":
119 modNameNew = modName[:-2] + midfix +
"Hp"
121 modNameNew = modName + midfix
122 if modNameNew
not in modDict:
123 mod = modDict[modName].
clone()
124 setattr(mod, algoParam, mod.algorithm.value())
126 modDict[modNameNew] = mod
128 mod = modDict[modNameNew]
129 names.append(modNameNew)
135 for seed
in seedProducers:
136 modName =
"seedTracks"+seed
137 if modName
not in modDict:
138 mod = _trajectorySeedTracks.clone(src=seed)
139 modDict[modName] = mod
141 mod = modDict[modName]
142 names.append(modName)
146 _relevantEras = _cfg.allEras()
147 _relevantErasAndFastSim = _relevantEras + [(
"fastSim",
"_fastSim", fastSim)]
151 if isinstance(arg, list):
154 ret.append(modDict[arg+postfix])
156 def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False):
158 raise Exception(
"Task name is expected to begin with _")
160 _eras = _relevantErasAndFastSim
if includeFastSim
else _relevantEras
161 for eraName, postfix, _era
in _eras:
163 _args.extend(plainArgs)
164 ret =
function(*_args, modDict=modDict)
166 raise Exception(
"_taskForEachEra is expected to return 2 values, but function returned %d" % len(ret))
167 modDict[names+postfix] = ret[0]
168 modDict[task+postfix] = ret[1]
171 defaultTaskName = task+_eras[0][0]
172 defaultTask = modDict[defaultTaskName]
173 modDict[defaultTaskName[1:]] = defaultTask
176 if modifyTask
is not None:
177 for eraName, postfix, _era
in _eras:
181 for _eraName, _postfix, _era
in _eras[1:]:
182 _era.toReplaceWith(defaultTask, modDict[task+_postfix])
185 for key, value
in six.iteritems(kwargs):
186 setattr(module, key, value)
188 era.toModify(module, **kwargs)
192 def _findSeedingLayers(name):
193 prod = getattr(config, name)
194 if hasattr(prod,
"triplets"):
195 if hasattr(prod,
"layerList"):
196 return prod.layerList.refToPSet_.value()
197 return _findSeedingLayers(prod.triplets.getModuleLabel())
198 elif hasattr(prod,
"doublets"):
199 return _findSeedingLayers(prod.doublets.getModuleLabel())
200 label = prod.trackingRegionsSeedingLayers.getModuleLabel()
203 return prod.seedingLayers.getModuleLabel()
205 seedingLayersMerged = []
206 for seedName
in seedProducers:
207 seedProd = getattr(config, seedName)
208 seedingLayersName =
None
210 if hasattr(seedProd,
"OrderedHitsFactoryPSet"):
211 seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel()
212 elif hasattr(seedProd,
"seedingHitSets"):
213 seedingLayersName = _findSeedingLayers(seedProd.seedingHitSets.getModuleLabel())
214 elif hasattr(seedProd,
"layerList"):
215 seedingLayers = seedProd.layerList.value()
219 if seedingLayersName
is not None:
220 seedingLayers = getattr(config, seedingLayersName).layerList.value()
221 for layerSet
in seedingLayers:
222 if layerSet
not in seedingLayersMerged:
223 seedingLayersMerged.append(layerSet)
225 return seedingLayersMerged
228 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
231 if "_electronSeedProducers"+_postfix
in locals():
232 for _layer
in _getSeedingLayers(locals()[
"_electronSeedProducers"+_postfix], _ElectronSeeds_cff):
233 if _layer
not in _stdLayers:
234 _eleLayers.append(_layer)
236 locals()[
"_seedingLayerSets"+_postfix] = _stdLayers
237 locals()[
"_seedingLayerSetsForElectrons"+_postfix] = _eleLayers
242 mvaSel = _utils.getMVASelectors(postfix)
244 pset = cms.untracked.PSet()
245 for iteration, (trackProducer, classifiers)
in six.iteritems(mvaSel):
246 setattr(pset, trackProducer, cms.untracked.vstring(classifiers))
248 for _eraName, _postfix, _era
in _relevantEras:
252 _taskForEachEra(_addSelectorsByAlgo, args=[
"_algos"], names=
"_selectorsByAlgo", task=
"_tracksValidationSelectorsByAlgo", modDict=globals())
255 _taskForEachEra(_addSelectorsByHp, args=[
"_algos"], names=
"_selectorsByAlgoHp", task=
"_tracksValidationSelectorsByAlgoHp", modDict=globals())
258 for _eraName, _postfix, _era
in _relevantEras:
259 locals()[
"_selectorsByAlgoAndHp"+_postfix] = locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix]
261 locals()[
"_selectorsByAlgoAndHpNoGenTk"+_postfix] = [n
for n
in locals()[
"_selectorsByAlgoAndHp"+_postfix]
if n
not in [
"generalTracks",
"cutsRecoTracksHp"]]
263 locals()[
"_selectorsByAlgoAndHpNoGenTkDupMerge"+_postfix] = [n
for n
in locals()[
"_selectorsByAlgoAndHpNoGenTk"+_postfix]
if n
not in [
"cutsRecoTracksDuplicateMerge",
"cutsRecoTracksDuplicateMergeHp"]]
265 args = [
"_selectorsByAlgoAndHpNoGenTkDupMerge"], plainArgs = [
"ByOriginalAlgo",
"originalAlgorithm"],
266 names =
"_selectorsByOriginalAlgo", task =
"_tracksValidationSelectorsByOriginalAlgo")
269 for _eraName, _postfix, _era
in _relevantEras:
270 selectors = locals()[
"_selectorsByAlgoHp"+_postfix]
271 locals()[
"_generalTracksHp"+_postfix] = selectors[0]
272 locals()[
"_selectorsByAlgoHp"+_postfix] = selectors[1:]
275 import PhysicsTools.RecoAlgos.btvTracks_cfi
as btvTracks_cfi
276 cutsRecoTracksBtvLike = btvTracks_cfi.btvTrackRefs.clone()
280 ak4JetTracksAssociatorExplicitAll = ak4JTA_cff.ak4JetTracksAssociatorExplicit.clone(
284 import CommonTools.RecoAlgos.jetTracksAssociationToTrackRefs_cfi
as jetTracksAssociationToTrackRefs_cfi
285 cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone(
286 association =
"ak4JetTracksAssociatorExplicitAll",
293 trackingParticlesSignal = _trackingParticleRefSelector.clone(
304 generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9)
307 args=[[
"_generalTracksHp"]],
308 plainArgs=[
"Pt09",
"generalTracksPt09"],
309 names=
"_selectorsPt09", task=
"_tracksValidationSelectorsPt09",
310 modifyTask=
lambda task:task.add(generalTracksPt09))
314 generalTracksFromPV = _trackWithVertexRefSelector.clone(
315 src =
"generalTracks",
320 vertexTag =
"offlinePrimaryVertices",
328 args=[[
"_generalTracksHp"]],
329 plainArgs=[
"FromPV",
"generalTracksFromPV"],
330 names=
"_selectorsFromPV", task=
"_tracksValidationSelectorsFromPV",
331 modifyTask=
lambda task: task.add(generalTracksFromPV))
334 generalTracksFromPVPt09 = generalTracksPt09.clone(src=
"generalTracksFromPV")
337 args=[[
"_generalTracksHp"]],
338 plainArgs=[
"FromPVPt09",
"generalTracksFromPVPt09"],
339 names=
"_selectorsFromPVPt09", task=
"_tracksValidationSelectorsFromPVPt09",
340 modifyTask=
lambda task: task.add(generalTracksFromPVPt09))
343 trackingParticlesConversion = _trackingParticleConversionRefSelector.clone()
346 trackingParticlesElectron = _trackingParticleRefSelector.clone(
357 highPtJets = cms.EDFilter(
"CandPtrSelector", src = cms.InputTag(
"ak4CaloJets"), cut = cms.string(
"pt()>1000"))
358 highPtJetsForTrk = highPtJetsForTrk = highPtJets.clone(src =
"ak4CaloJetsForTrk")
361 trackingParticlesBHadron = _trackingParticleBHadronRefSelector.clone()
364 trackValidator = Validation.RecoTrack.MultiTrackValidator_cfi.multiTrackValidator.clone(
365 useLogPt = cms.untracked.bool(
True),
367 doPVAssociationPlots =
True
372 fastSim.toModify(trackValidator,
375 for _eraName, _postfix, _era
in _relevantEras:
377 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]] +
378 locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix] +
379 locals()[
"_selectorsByOriginalAlgo"+_postfix] +
380 [
"generalTracksPt09"] + locals()[
"_selectorsPt09"+_postfix] +
382 "cutsRecoTracksBtvLike",
383 "cutsRecoTracksAK4PFJets"
385 doResolutionPlotsForLabels = [
387 locals()[
"_generalTracksHp"+_postfix],
389 "cutsRecoTracksBtvLike",
392 _setForEra(trackValidator.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=locals()[
"_seedingLayerSets"+_postfix])
395 trackValidatorTPPtLess09 = trackValidator.clone(
396 dirName =
"Tracking/TrackTPPtLess09/",
397 label = [x
for x
in trackValidator.label.value()
if (
"Pt09" not in x)
and (
"BtvLike" not in x)
and (
"AK4PFJets" not in x)],
399 histoProducerAlgoBlock = dict(
400 TpSelectorForEfficiencyVsEta = dict(ptMin=0.05),
401 TpSelectorForEfficiencyVsPhi = dict(ptMin=0.05),
402 TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.05),
403 TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.05),
406 doRecoTrackPlots =
False,
407 doResolutionPlotsForLabels = [
"disabled"],
411 trackingParticlesEtaGreater2p7 = _trackingParticleRefSelector.clone(
412 signalOnly = cms.bool(
False),
417 invertRapidityCut = cms.bool(
True),
423 generalTracksEtaGreater2p7 = cutsRecoTracks_cfi.cutsRecoTracks.clone(
424 minRapidity = cms.double(-2.7),
425 maxRapidity = cms.double( 2.7),
426 invertRapidityCut = cms.bool(
True)
430 args=[[
"_generalTracksHp"]],
431 plainArgs=[
"EtaGreater2p7",
"generalTracksEtaGreater2p7"],
432 names=
"_selectorsEtaGreater2p7", task=
"_tracksValidationSelectorsEtaGreater2p7",
433 modifyTask=
lambda task: task.add(generalTracksEtaGreater2p7))
436 trackValidatorTPEtaGreater2p7 = trackValidator.clone(
437 dirName =
"Tracking/TrackTPEtaGreater2p7/",
438 label_tp_effic =
"trackingParticlesEtaGreater2p7",
439 label_tp_fake =
"trackingParticlesEtaGreater2p7",
440 label_tp_effic_refvector =
True,
441 label_tp_fake_refvector =
True,
444 minRapidityTP = -2.7,
446 invertRapidityCutTP =
True,
448 histoProducerAlgoBlock = dict(
449 TpSelectorForEfficiencyVsPt = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
450 TpSelectorForEfficiencyVsEta = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
451 TpSelectorForEfficiencyVsPhi = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
452 TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
453 TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
454 generalTpSelector = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
461 doRecoTrackPlots =
True,
462 doResolutionPlotsForLabels = [
"disabled"]
464 for _eraName, _postfix, _era
in _relevantEras:
465 _setForEra(trackValidatorTPEtaGreater2p7, _eraName, _era,
466 label = [
"generalTracksEtaGreater2p7"] + locals()[
"_selectorsEtaGreater2p7"+_postfix] +
467 locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix],
468 doResolutionPlotsForLabels = [
"generalTracksEtaGreater2p7"] + locals()[
"_selectorsEtaGreater2p7"+_postfix]
473 trackValidatorFromPV = trackValidator.clone(
474 dirName =
"Tracking/TrackFromPV/",
475 label_tp_effic =
"trackingParticlesSignal",
476 label_tp_fake =
"trackingParticlesSignal",
477 label_tp_effic_refvector =
True,
478 label_tp_fake_refvector =
True,
479 trackCollectionForDrCalculation =
"generalTracksFromPV",
480 doPlotsOnlyForTruePV =
True,
481 doPVAssociationPlots =
False,
482 doResolutionPlotsForLabels = [
"disabled"],
484 for _eraName, _postfix, _era
in _relevantEras:
485 _setForEra(trackValidatorFromPV, _eraName, _era,
486 label = [
"generalTracksFromPV"] + locals()[
"_selectorsFromPV"+_postfix] + [
"generalTracksFromPVPt09"] + locals()[
"_selectorsFromPVPt09"+_postfix],
487 doResolutionPlotsForLabels = []
492 trackValidatorFromPVAllTP = trackValidatorFromPV.clone(
493 dirName =
"Tracking/TrackFromPVAllTP/",
494 label_tp_effic = trackValidator.label_tp_effic.value(),
495 label_tp_fake = trackValidator.label_tp_fake.value(),
496 label_tp_effic_refvector =
False,
497 label_tp_fake_refvector =
False,
499 doSimTrackPlots =
False,
500 doResolutionPlotsForLabels = [
"disabled"],
504 trackValidatorAllTPEffic = trackValidator.clone(
505 dirName =
"Tracking/TrackAllTPEffic/",
506 label = [x
for x
in trackValidator.label.value()
if "Pt09" not in x],
508 doRecoTrackPlots =
True,
509 doPVAssociationPlots =
False,
510 doResolutionPlotsForLabels = [
"disabled"],
512 trackValidatorAllTPEffic.histoProducerAlgoBlock.generalTpSelector.signalOnly =
False
513 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsEta.signalOnly =
False
514 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPhi.signalOnly =
False
515 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPt.signalOnly =
False
516 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXR.signalOnly =
False
517 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXZ.signalOnly =
False
518 for _eraName, _postfix, _era
in _relevantEras:
519 _setForEra(trackValidatorAllTPEffic, _eraName, _era, label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]])
522 tpClusterProducerPreSplitting = tpClusterProducer.clone(pixelClusterSrc =
"siPixelClustersPreSplitting")
523 quickTrackAssociatorByHitsPreSplitting = quickTrackAssociatorByHits.clone(cluster2TPSrc =
"tpClusterProducerPreSplitting")
524 _trackValidatorSeedingBuilding = trackValidator.clone(
525 associators = [
"quickTrackAssociatorByHits"],
526 UseAssociators =
True,
528 doPVAssociationPlots =
False,
530 doResolutionPlotsForLabels = [
"disabled"],
532 trackValidatorBuilding = _trackValidatorSeedingBuilding.clone(
533 dirName =
"Tracking/TrackBuilding/",
536 trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone(
537 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
539 doSummaryPlots =
False,
541 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
542 _setForEra(trackValidatorBuilding, _eraName, _era, label = locals()[
"_trackProducers"+_postfix])
543 fastSim.toModify(trackValidatorBuilding, doMVAPlots=
False)
544 for _eraName, _postfix, _era
in _relevantEras:
545 _setForEra(trackValidatorBuilding, _eraName, _era, mvaLabels = locals()[
"_mvaSelectors"+_postfix])
546 _setForEra(trackValidatorBuildingPreSplitting, _eraName, _era, label = locals()[
"_trackProducersPreSplitting"+_postfix])
550 trackValidatorConversion = trackValidator.clone(
551 dirName =
"Tracking/TrackConversion/",
554 "conversionStepTracks",
555 "ckfInOutTracksFromConversions",
556 "ckfOutInTracksFromConversions",
558 label_tp_effic =
"trackingParticlesConversion",
559 label_tp_effic_refvector =
True,
560 associators = [
"quickTrackAssociatorByHits"],
561 UseAssociators =
True,
564 doPVAssociationPlots =
False,
565 calculateDrSingleCollection =
False,
569 firstLayers = [layerSet.split(
"+")[0]
for layerSet
in layerList]
571 for l
in firstLayers:
576 if l.startswith(
"TEC"):
582 trackValidatorConversion.histoProducerAlgoBlock.seedingLayerSets =
_uniqueFirstLayers(_convLayerPairs.layerList.value())
584 for n
in [
"Eta",
"Phi",
"Pt",
"VTXR",
"VTXZ"]:
585 pset = getattr(trackValidatorConversion.histoProducerAlgoBlock,
"TpSelectorForEfficiencyVs"+n)
586 pset.lip = trackValidatorConversion.lipTP.value()
587 pset.tip = trackValidatorConversion.tipTP.value()
590 trackValidatorGsfTracks = trackValidatorConversion.clone(
591 dirName =
"Tracking/TrackGsf/",
592 label = [
"electronGsfTracks"],
593 label_tp_effic =
"trackingParticlesElectron",
596 for _eraName, _postfix, _era
in _relevantEras:
597 _setForEra(trackValidatorGsfTracks.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=trackValidator.histoProducerAlgoBlock.seedingLayerSets.value()+locals()[
"_seedingLayerSetsForElectrons"+_postfix])
602 trackValidatorBHadron = trackValidator.clone(
603 dirName =
"Tracking/TrackBHadron/",
604 label_tp_effic =
"trackingParticlesBHadron",
605 label_tp_effic_refvector =
True,
607 doRecoTrackPlots =
False,
610 for _eraName, _postfix, _era
in _relevantEras:
611 _setForEra(trackValidatorBHadron, _eraName, _era,
612 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix],
"cutsRecoTracksBtvLike"]
617 tracksValidationSelectors = cms.Task(
618 tracksValidationSelectorsByAlgo,
619 tracksValidationSelectorsByAlgoHp,
620 tracksValidationSelectorsByOriginalAlgo,
621 cutsRecoTracksBtvLike,
622 ak4JetTracksAssociatorExplicitAll,
623 cutsRecoTracksAK4PFJets
625 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(generalTracksEtaGreater2p7))
626 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(cutsRecoTracksEtaGreater2p7Hp))
631 names=
"_selectorsByAlgo", task=
"_tracksEtaGreater2p7ValidationSelectorsByAlgo"
637 names=
"_selectorsByAlgoHp", task=
"_tracksEtaGreater2p7ValidationSelectorsByAlgoHp"
640 for _eraName, _postfix, _era
in _relevantEras:
641 selectors = locals()[
"_selectorsByAlgoHp"+_postfix]
642 locals()[
"_generalTracksHp"+_postfix] = selectors[0]
643 locals()[
"_selectorsByAlgoHp"+_postfix] = selectors[1:]
645 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgo))
646 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgoHp))
648 tracksValidationTruth = cms.Task(
650 tpClusterProducerPreSplitting,
651 quickTrackAssociatorByHits,
652 quickTrackAssociatorByHitsPreSplitting,
653 trackingParticleRecoTrackAsssociation,
654 VertexAssociatorByPositionAndTracks,
655 trackingParticleNumberOfLayersProducer
657 fastSim.toModify(tracksValidationTruth,
lambda x: x.remove(tpClusterProducer))
659 tracksPreValidation = cms.Task(
661 tracksValidationSelectors,
662 tracksValidationSelectorsPt09,
663 tracksValidationSelectorsFromPV,
664 tracksValidationSelectorsFromPVPt09,
665 tracksValidationTruth,
666 trackingParticlesSignal,
667 trackingParticlesElectron,
668 trackingParticlesConversion
670 fastSim.toReplaceWith(tracksPreValidation, tracksPreValidation.copyAndExclude([
671 trackingParticlesElectron,
672 trackingParticlesConversion,
677 tracksValidation = cms.Sequence(
679 trackValidatorTPPtLess09 +
680 trackValidatorFromPV +
681 trackValidatorFromPVAllTP +
682 trackValidatorAllTPEffic +
683 trackValidatorBuilding +
684 trackValidatorBuildingPreSplitting +
685 trackValidatorConversion +
686 trackValidatorGsfTracks,
690 from Configuration.Eras.Modifier_phase2_tracker_cff
import phase2_tracker
692 tracksPreValidationPhase2 = tracksPreValidation.copy()
693 tracksPreValidationPhase2.add(trackingParticlesEtaGreater2p7)
694 phase2_tracker.toReplaceWith(tracksPreValidation, tracksPreValidationPhase2)
696 tracksValidationPhase2 = tracksValidation.copy()
697 tracksValidationPhase2+=trackValidatorTPEtaGreater2p7
698 phase2_tracker.toReplaceWith(tracksValidation, tracksValidationPhase2)
701 fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([
702 trackValidatorBuildingPreSplitting,
703 trackValidatorConversion,
704 trackValidatorGsfTracks,
711 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"ByAlgoMask",
"algorithmMaskContains"],
712 names =
"_selectorsByAlgoMask", task =
"_tracksValidationSelectorsByAlgoMaskStandalone")
717 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"Pt09",
"generalTracksPt09"],
718 names =
"_selectorsPt09Standalone", task =
"_tracksValidationSelectorsPt09Standalone")
723 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPV",
"generalTracksFromPV"],
724 names =
"_selectorsFromPVStandalone", task =
"_tracksValidationSelectorsFromPVStandalone")
729 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPVPt09",
"generalTracksFromPVPt09"],
730 names =
"_selectorsFromPVPt09Standalone", task =
"_tracksValidationSelectorsFromPVPt09Standalone")
733 trackValidatorStandalone = trackValidator.clone(
736 trackValidatorTPPtLess09Standalone = trackValidatorTPPtLess09.clone(
739 for _eraName, _postfix, _era
in _relevantEras:
740 _setForEra(trackValidatorStandalone, _eraName, _era, label = trackValidator.label + locals()[
"_selectorsByAlgoMask"+_postfix] + locals()[
"_selectorsPt09Standalone"+_postfix])
741 _setForEra(trackValidatorTPPtLess09Standalone, _eraName, _era, label = trackValidatorTPPtLess09.label + locals()[
"_selectorsByAlgoMask"+_postfix] + locals()[
"_selectorsPt09Standalone"+_postfix])
743 trackValidatorFromPVStandalone = trackValidatorFromPV.clone(
746 for _eraName, _postfix, _era
in _relevantEras:
747 _setForEra(trackValidatorFromPVStandalone, _eraName, _era, label = trackValidatorFromPV.label + locals()[
"_selectorsFromPVStandalone"+_postfix] + locals()[
"_selectorsFromPVPt09Standalone"+_postfix])
750 trackValidatorFromPVAllTPStandalone = trackValidatorFromPVAllTP.clone(
751 label = trackValidatorFromPVStandalone.label.value(),
755 trackValidatorAllTPEfficStandalone = trackValidatorAllTPEffic.clone(
756 label = [ x
for x
in trackValidator.label.value()
if x
not in [
"cutsRecoTracksBtvLike",
"cutsRecoTracksAK4PFJets"]
and "Pt09" not in x],
760 trackValidatorConversionStandalone = trackValidatorConversion.clone(
761 label = [x
for x
in trackValidatorConversion.label
if x !=
"convStepTracks"],
765 trackValidatorBHadronStandalone = trackValidatorBHadron.clone(
766 label = [x
for x
in trackValidatorStandalone.label
if "Pt09" not in x],
770 trackValidatorGsfTracksStandalone = trackValidatorGsfTracks.clone(
775 tracksPreValidationStandalone = tracksPreValidation.copy()
776 tracksPreValidationStandalone.add(trackingParticlesBHadron)
777 tracksPreValidationStandalone.replace(highPtJetsForTrk,highPtJets)
778 fastSim.toReplaceWith(tracksPreValidationStandalone, tracksPreValidation)
780 tracksValidationSelectorsStandalone = cms.Task(
781 tracksValidationSelectorsByAlgoMaskStandalone,
782 tracksValidationSelectorsPt09Standalone,
783 tracksValidationSelectorsFromPVStandalone,
784 tracksValidationSelectorsFromPVPt09Standalone
789 _trackValidatorsBase = cms.Sequence(
790 trackValidatorStandalone +
791 trackValidatorTPPtLess09Standalone +
792 trackValidatorFromPVStandalone +
793 trackValidatorFromPVAllTPStandalone +
794 trackValidatorAllTPEfficStandalone +
795 trackValidatorConversionStandalone +
796 trackValidatorGsfTracksStandalone +
797 trackValidatorBHadronStandalone
800 _trackValidatorsBasePhase2 = _trackValidatorsBase.copy()
801 _trackValidatorsBasePhase2+=trackValidatorTPEtaGreater2p7
802 phase2_tracker.toReplaceWith(_trackValidatorsBase, _trackValidatorsBasePhase2)
804 trackValidatorsStandalone = _trackValidatorsBase.copy()
805 fastSim.toModify(trackValidatorsStandalone,
lambda x: x.remove(trackValidatorConversionStandalone) )
807 tracksValidationStandalone = cms.Sequence(
808 ak4PFL1FastL2L3CorrectorChain +
809 trackValidatorsStandalone,
810 tracksPreValidationStandalone,
811 tracksValidationSelectorsStandalone
817 tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets])
818 _taskForEachEra(_addSeedToTrackProducers, args=[
"_seedProducers"], names=
"_seedSelectors", task=
"_tracksValidationSeedSelectorsTrackingOnly", includeFastSim=
True, modDict=globals())
819 _taskForEachEra(_addSeedToTrackProducers, args=[
"_seedProducersPreSplitting"], names=
"_seedSelectorsPreSplitting", task=
"_tracksValidationSeedSelectorsPreSplittingTrackingOnly", modDict=globals())
820 tracksValidationSeedSelectorsTrackingOnly.add(tracksValidationSeedSelectorsPreSplittingTrackingOnly)
823 trackValidatorTrackingOnly = trackValidatorStandalone.clone(
824 label = [ x
for x
in trackValidatorStandalone.label
if x !=
"cutsRecoTracksAK4PFJets"],
825 cores =
"highPtJetsForTrk"
828 trackValidatorSeedingTrackingOnly = _trackValidatorSeedingBuilding.clone(
829 dirName =
"Tracking/TrackSeeding/",
830 label = _seedSelectors,
833 trackValidatorSeedingPreSplittingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
834 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
835 label = _seedSelectorsPreSplitting,
836 doSummaryPlots =
False,
839 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
840 _setForEra(trackValidatorSeedingTrackingOnly, _eraName, _era, label = locals()[
"_seedSelectors"+_postfix])
841 for _eraName, _postfix, _era
in _relevantEras:
842 _setForEra(trackValidatorSeedingPreSplittingTrackingOnly, _eraName, _era, label = locals()[
"_seedSelectorsPreSplitting"+_postfix])
845 trackValidatorConversionTrackingOnly = trackValidatorConversion.clone(label = [x
for x
in trackValidatorConversion.label
if x
not in [
"ckfInOutTracksFromConversions",
"ckfOutInTracksFromConversions"]])
847 trackValidatorBHadronTrackingOnly = trackValidatorBHadron.clone(label = [x
for x
in trackValidatorTrackingOnly.label
if "Pt09" not in x])
849 trackValidatorTPPtLess09TrackingOnly = trackValidatorTPPtLess09Standalone.clone(cores =
"highPtJetsForTrk")
850 trackValidatorFromPVTrackingOnly = trackValidatorFromPVStandalone.clone(cores =
"highPtJetsForTrk")
851 trackValidatorFromPVAllTPTrackingOnly = trackValidatorFromPVAllTPStandalone.clone(cores =
"highPtJetsForTrk")
852 trackValidatorAllTPEfficTrackingOnly = trackValidatorAllTPEfficStandalone.clone(cores =
"highPtJetsForTrk")
854 tracksPreValidationTrackingOnly = tracksPreValidationStandalone.copy()
855 tracksPreValidationTrackingOnly.replace(tracksValidationSelectors, tracksValidationSelectorsTrackingOnly)
856 tracksPreValidationTrackingOnly.replace(highPtJets,highPtJetsForTrk)
858 trackValidatorsTrackingOnly = _trackValidatorsBase.copy()
859 trackValidatorsTrackingOnly.replace(trackValidatorStandalone, trackValidatorTrackingOnly)
860 trackValidatorsTrackingOnly.replace(trackValidatorTPPtLess09Standalone,trackValidatorTPPtLess09TrackingOnly)
861 trackValidatorsTrackingOnly.replace(trackValidatorFromPVStandalone,trackValidatorFromPVTrackingOnly)
862 trackValidatorsTrackingOnly.replace(trackValidatorFromPVAllTPStandalone,trackValidatorFromPVAllTPTrackingOnly)
863 trackValidatorsTrackingOnly.replace(trackValidatorAllTPEfficStandalone,trackValidatorAllTPEfficTrackingOnly)
864 trackValidatorsTrackingOnly += trackValidatorSeedingTrackingOnly
865 trackValidatorsTrackingOnly += trackValidatorSeedingPreSplittingTrackingOnly
866 trackValidatorsTrackingOnly += trackValidatorBuilding
867 trackValidatorsTrackingOnly += trackValidatorBuildingPreSplitting
868 trackValidatorsTrackingOnly.replace(trackValidatorConversionStandalone, trackValidatorConversionTrackingOnly)
869 trackValidatorsTrackingOnly.remove(trackValidatorGsfTracksStandalone)
870 trackValidatorsTrackingOnly.replace(trackValidatorBHadronStandalone, trackValidatorBHadronTrackingOnly)
871 fastSim.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([
872 trackValidatorBuildingPreSplitting,
873 trackValidatorSeedingPreSplittingTrackingOnly,
874 trackValidatorConversionTrackingOnly,
875 trackValidatorBHadronTrackingOnly
878 tracksValidationTrackingOnly = cms.Sequence(
879 trackValidatorsTrackingOnly,
880 tracksPreValidationTrackingOnly,
881 tracksValidationSelectorsStandalone,
882 tracksValidationSeedSelectorsTrackingOnly
887 trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone(
888 label_tr =
"pixelTracks",
889 associator =
"quickTrackAssociatorByHitsPreSplitting",
891 PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone(
892 trackAssociation =
"trackingParticlePixelTrackAsssociation"
895 trackValidatorPixelTrackingOnly = trackValidator.clone(
896 dirName =
"Tracking/PixelTrack/",
897 label = [
"pixelTracks"],
898 doResolutionPlotsForLabels = [],
899 trackCollectionForDrCalculation =
"pixelTracks",
900 associators = [
"trackingParticlePixelTrackAsssociation"],
901 label_vertex =
"pixelVertices",
902 vertexAssociator =
"PixelVertexAssociatorByPositionAndTracks",
904 cores = cms.InputTag(
""),
907 tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy()
908 tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation)
909 tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks)
910 tracksValidationPixelTrackingOnly = cms.Sequence(
911 trackValidatorPixelTrackingOnly,
912 tracksValidationTruthPixelTrackingOnly
917 trackValidatorLite = trackValidator.clone(
918 label = [
"generalTracks",
"cutsRecoTracksHp"]
920 tracksValidationLite = cms.Sequence(
923 tracksValidationTruth
927 from Configuration.Eras.Modifier_phase2_timing_layer_cff
import phase2_timing_layer
928 phase2_timing_layer.toModify( generalTracksFromPV,
929 timesTag = cms.InputTag(
'tofPID:t0'),
930 timeResosTag = cms.InputTag(
'tofPID:sigmat0'),
931 nSigmaDtVertex = cms.double(3) )
932 phase2_timing_layer.toModify( trackValidatorStandalone,
933 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
934 phase2_timing_layer.toModify( trackValidatorFromPVStandalone,
935 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
936 phase2_timing_layer.toModify( trackValidatorFromPVAllTPStandalone,
937 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
938 phase2_timing_layer.toModify( trackValidatorConversionStandalone,
939 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
940 phase2_timing_layer.toModify( trackValidatorGsfTracks,
941 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )