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 MTVTrackAssociationByChi2 = trackingParticleRecoTrackAsssociation.clone(
358 associator = cms.InputTag(
'trackAssociatorByChi2')
362 highPtJets = cms.EDFilter(
"CandPtrSelector", src = cms.InputTag(
"ak4CaloJets"), cut = cms.string(
"pt()>1000"))
363 highPtJetsForTrk = highPtJetsForTrk = highPtJets.clone(src =
"ak4CaloJetsForTrk")
366 trackingParticlesBHadron = _trackingParticleBHadronRefSelector.clone()
369 trackValidator = Validation.RecoTrack.MultiTrackValidator_cfi.multiTrackValidator.clone(
370 useLogPt = cms.untracked.bool(
True),
373 doPVAssociationPlots =
True
378 fastSim.toModify(trackValidator,
381 for _eraName, _postfix, _era
in _relevantEras:
383 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]] +
384 locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix] +
385 locals()[
"_selectorsByOriginalAlgo"+_postfix] +
386 [
"generalTracksPt09"] + locals()[
"_selectorsPt09"+_postfix] +
388 "cutsRecoTracksBtvLike",
389 "cutsRecoTracksAK4PFJets"
391 doResolutionPlotsForLabels = [
393 locals()[
"_generalTracksHp"+_postfix],
395 "cutsRecoTracksBtvLike",
396 "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo",
399 _setForEra(trackValidator.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=locals()[
"_seedingLayerSets"+_postfix])
402 trackValidatorTPPtLess09 = trackValidator.clone(
403 dirName =
"Tracking/TrackTPPtLess09/",
404 label = [x
for x
in trackValidator.label.value()
if (
"Pt09" not in x)
and (
"BtvLike" not in x)
and (
"AK4PFJets" not in x)],
406 histoProducerAlgoBlock = dict(
407 TpSelectorForEfficiencyVsEta = dict(ptMin=0.05),
408 TpSelectorForEfficiencyVsPhi = dict(ptMin=0.05),
409 TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.05),
410 TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.05),
413 doRecoTrackPlots =
False,
414 doResolutionPlotsForLabels = [
"disabled"],
418 trackingParticlesEtaGreater2p7 = _trackingParticleRefSelector.clone(
419 signalOnly = cms.bool(
False),
424 invertRapidityCut = cms.bool(
True),
430 generalTracksEtaGreater2p7 = cutsRecoTracks_cfi.cutsRecoTracks.clone(
431 minRapidity = cms.double(-2.7),
432 maxRapidity = cms.double( 2.7),
433 invertRapidityCut = cms.bool(
True)
437 args=[[
"_generalTracksHp"]],
438 plainArgs=[
"EtaGreater2p7",
"generalTracksEtaGreater2p7"],
439 names=
"_selectorsEtaGreater2p7", task=
"_tracksValidationSelectorsEtaGreater2p7",
440 modifyTask=
lambda task: task.add(generalTracksEtaGreater2p7))
443 trackValidatorTPEtaGreater2p7 = trackValidator.clone(
444 dirName =
"Tracking/TrackTPEtaGreater2p7/",
445 label_tp_effic =
"trackingParticlesEtaGreater2p7",
446 label_tp_fake =
"trackingParticlesEtaGreater2p7",
447 label_tp_effic_refvector =
True,
448 label_tp_fake_refvector =
True,
451 minRapidityTP = -2.7,
453 invertRapidityCutTP =
True,
455 histoProducerAlgoBlock = dict(
456 TpSelectorForEfficiencyVsPt = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
457 TpSelectorForEfficiencyVsEta = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
458 TpSelectorForEfficiencyVsPhi = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
459 TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
460 TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
461 generalTpSelector = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
468 doRecoTrackPlots =
True,
469 doResolutionPlotsForLabels = [
"disabled"]
471 for _eraName, _postfix, _era
in _relevantEras:
472 _setForEra(trackValidatorTPEtaGreater2p7, _eraName, _era,
473 label = [
"generalTracksEtaGreater2p7"] + locals()[
"_selectorsEtaGreater2p7"+_postfix] +
474 locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix],
475 doResolutionPlotsForLabels = [
"generalTracksEtaGreater2p7"] + locals()[
"_selectorsEtaGreater2p7"+_postfix]
480 trackValidatorFromPV = trackValidator.clone(
481 dirName =
"Tracking/TrackFromPV/",
482 label_tp_effic =
"trackingParticlesSignal",
483 label_tp_fake =
"trackingParticlesSignal",
484 label_tp_effic_refvector =
True,
485 label_tp_fake_refvector =
True,
486 trackCollectionForDrCalculation =
"generalTracksFromPV",
487 doPlotsOnlyForTruePV =
True,
488 doPVAssociationPlots =
False,
489 doResolutionPlotsForLabels = [
"disabled"],
491 for _eraName, _postfix, _era
in _relevantEras:
492 _setForEra(trackValidatorFromPV, _eraName, _era,
493 label = [
"generalTracksFromPV"] + locals()[
"_selectorsFromPV"+_postfix] + [
"generalTracksFromPVPt09"] + locals()[
"_selectorsFromPVPt09"+_postfix],
494 doResolutionPlotsForLabels = []
499 trackValidatorFromPVAllTP = trackValidatorFromPV.clone(
500 dirName =
"Tracking/TrackFromPVAllTP/",
501 label_tp_effic = trackValidator.label_tp_effic.value(),
502 label_tp_fake = trackValidator.label_tp_fake.value(),
503 label_tp_effic_refvector =
False,
504 label_tp_fake_refvector =
False,
506 doSimTrackPlots =
False,
507 doResolutionPlotsForLabels = [
"disabled"],
511 trackValidatorAllTPEffic = trackValidator.clone(
512 dirName =
"Tracking/TrackAllTPEffic/",
513 label = [x
for x
in trackValidator.label.value()
if "Pt09" not in x],
515 doRecoTrackPlots =
True,
516 doPVAssociationPlots =
False,
517 doResolutionPlotsForLabels = [
"disabled"],
519 trackValidatorAllTPEffic.histoProducerAlgoBlock.generalTpSelector.signalOnly =
False
520 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsEta.signalOnly =
False
521 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPhi.signalOnly =
False
522 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPt.signalOnly =
False
523 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXR.signalOnly =
False
524 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXZ.signalOnly =
False
525 for _eraName, _postfix, _era
in _relevantEras:
526 _setForEra(trackValidatorAllTPEffic, _eraName, _era, label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]])
529 tpClusterProducerPreSplitting = tpClusterProducer.clone(pixelClusterSrc =
"siPixelClustersPreSplitting")
530 quickTrackAssociatorByHitsPreSplitting = quickTrackAssociatorByHits.clone(cluster2TPSrc =
"tpClusterProducerPreSplitting")
531 _trackValidatorSeedingBuilding = trackValidator.clone(
532 associators = [
"quickTrackAssociatorByHits"],
533 UseAssociators =
True,
535 doPVAssociationPlots =
False,
537 doResolutionPlotsForLabels = [
"disabled"],
539 trackValidatorBuilding = _trackValidatorSeedingBuilding.clone(
540 dirName =
"Tracking/TrackBuilding/",
542 doResolutionPlotsForLabels = [
'jetCoreRegionalStepTracks'],
546 trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone(
547 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
549 doSummaryPlots =
False,
551 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
552 _setForEra(trackValidatorBuilding, _eraName, _era, label = locals()[
"_trackProducers"+_postfix])
553 fastSim.toModify(trackValidatorBuilding, doMVAPlots=
False)
554 for _eraName, _postfix, _era
in _relevantEras:
555 _setForEra(trackValidatorBuilding, _eraName, _era, mvaLabels = locals()[
"_mvaSelectors"+_postfix])
556 _setForEra(trackValidatorBuildingPreSplitting, _eraName, _era, label = locals()[
"_trackProducersPreSplitting"+_postfix])
560 trackValidatorConversion = trackValidator.clone(
561 dirName =
"Tracking/TrackConversion/",
564 "conversionStepTracks",
565 "ckfInOutTracksFromConversions",
566 "ckfOutInTracksFromConversions",
568 label_tp_effic =
"trackingParticlesConversion",
569 label_tp_effic_refvector =
True,
570 associators = [
"quickTrackAssociatorByHits"],
571 UseAssociators =
True,
574 doPVAssociationPlots =
False,
575 calculateDrSingleCollection =
False,
579 firstLayers = [layerSet.split(
"+")[0]
for layerSet
in layerList]
581 for l
in firstLayers:
586 if l.startswith(
"TEC"):
592 trackValidatorConversion.histoProducerAlgoBlock.seedingLayerSets =
_uniqueFirstLayers(_convLayerPairs.layerList.value())
594 for n
in [
"Eta",
"Phi",
"Pt",
"VTXR",
"VTXZ"]:
595 pset = getattr(trackValidatorConversion.histoProducerAlgoBlock,
"TpSelectorForEfficiencyVs"+n)
596 pset.lip = trackValidatorConversion.lipTP.value()
597 pset.tip = trackValidatorConversion.tipTP.value()
600 trackValidatorGsfTracks = trackValidatorConversion.clone(
601 dirName =
"Tracking/TrackGsf/",
602 label = [
"electronGsfTracks"],
603 label_tp_effic =
"trackingParticlesElectron",
606 for _eraName, _postfix, _era
in _relevantEras:
607 _setForEra(trackValidatorGsfTracks.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=trackValidator.histoProducerAlgoBlock.seedingLayerSets.value()+locals()[
"_seedingLayerSetsForElectrons"+_postfix])
612 trackValidatorBHadron = trackValidator.clone(
613 dirName =
"Tracking/TrackBHadron/",
614 label_tp_effic =
"trackingParticlesBHadron",
615 label_tp_effic_refvector =
True,
617 doRecoTrackPlots =
False,
620 for _eraName, _postfix, _era
in _relevantEras:
621 _setForEra(trackValidatorBHadron, _eraName, _era,
622 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix],
"cutsRecoTracksBtvLike"]
627 tracksValidationSelectors = cms.Task(
628 tracksValidationSelectorsByAlgo,
629 tracksValidationSelectorsByAlgoHp,
630 tracksValidationSelectorsByOriginalAlgo,
631 cutsRecoTracksBtvLike,
632 ak4JetTracksAssociatorExplicitAll,
633 cutsRecoTracksAK4PFJets
635 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(generalTracksEtaGreater2p7))
636 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(cutsRecoTracksEtaGreater2p7Hp))
641 names=
"_selectorsByAlgo", task=
"_tracksEtaGreater2p7ValidationSelectorsByAlgo"
647 names=
"_selectorsByAlgoHp", task=
"_tracksEtaGreater2p7ValidationSelectorsByAlgoHp"
650 for _eraName, _postfix, _era
in _relevantEras:
651 selectors = locals()[
"_selectorsByAlgoHp"+_postfix]
652 locals()[
"_generalTracksHp"+_postfix] = selectors[0]
653 locals()[
"_selectorsByAlgoHp"+_postfix] = selectors[1:]
655 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgo))
656 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgoHp))
658 tracksValidationTruth = cms.Task(
660 tpClusterProducerPreSplitting,
663 quickTrackAssociatorByHits,
664 quickTrackAssociatorByHitsPreSplitting,
665 trackingParticleRecoTrackAsssociation,
666 VertexAssociatorByPositionAndTracks,
667 trackingParticleNumberOfLayersProducer
669 fastSim.toModify(tracksValidationTruth,
lambda x: x.remove(tpClusterProducer))
671 tracksPreValidation = cms.Task(
673 tracksValidationSelectors,
674 tracksValidationSelectorsPt09,
675 tracksValidationSelectorsFromPV,
676 tracksValidationSelectorsFromPVPt09,
677 tracksValidationTruth,
678 trackingParticlesSignal,
679 trackingParticlesElectron,
680 trackingParticlesConversion
682 fastSim.toReplaceWith(tracksPreValidation, tracksPreValidation.copyAndExclude([
683 trackingParticlesElectron,
684 trackingParticlesConversion,
689 tracksValidation = cms.Sequence(
691 trackValidatorTPPtLess09 +
692 trackValidatorFromPV +
693 trackValidatorFromPVAllTP +
694 trackValidatorAllTPEffic +
695 trackValidatorBuilding +
696 trackValidatorBuildingPreSplitting +
697 trackValidatorConversion +
698 trackValidatorGsfTracks,
702 from Configuration.Eras.Modifier_phase2_tracker_cff
import phase2_tracker
704 tracksPreValidationPhase2 = tracksPreValidation.copy()
705 tracksPreValidationPhase2.add(trackingParticlesEtaGreater2p7)
706 phase2_tracker.toReplaceWith(tracksPreValidation, tracksPreValidationPhase2)
708 tracksValidationPhase2 = tracksValidation.copy()
709 tracksValidationPhase2+=trackValidatorTPEtaGreater2p7
710 phase2_tracker.toReplaceWith(tracksValidation, tracksValidationPhase2)
713 fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([
714 trackValidatorBuildingPreSplitting,
715 trackValidatorConversion,
716 trackValidatorGsfTracks,
723 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"ByAlgoMask",
"algorithmMaskContains"],
724 names =
"_selectorsByAlgoMask", task =
"_tracksValidationSelectorsByAlgoMaskStandalone")
729 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"Pt09",
"generalTracksPt09"],
730 names =
"_selectorsPt09Standalone", task =
"_tracksValidationSelectorsPt09Standalone")
735 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPV",
"generalTracksFromPV"],
736 names =
"_selectorsFromPVStandalone", task =
"_tracksValidationSelectorsFromPVStandalone")
741 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPVPt09",
"generalTracksFromPVPt09"],
742 names =
"_selectorsFromPVPt09Standalone", task =
"_tracksValidationSelectorsFromPVPt09Standalone")
745 trackValidatorStandalone = trackValidator.clone(
748 trackValidatorTPPtLess09Standalone = trackValidatorTPPtLess09.clone(
751 for _eraName, _postfix, _era
in _relevantEras:
752 _setForEra(trackValidatorStandalone, _eraName, _era, label = trackValidator.label + locals()[
"_selectorsByAlgoMask"+_postfix] + locals()[
"_selectorsPt09Standalone"+_postfix])
753 _setForEra(trackValidatorTPPtLess09Standalone, _eraName, _era, label = trackValidatorTPPtLess09.label + locals()[
"_selectorsByAlgoMask"+_postfix] + locals()[
"_selectorsPt09Standalone"+_postfix])
755 trackValidatorFromPVStandalone = trackValidatorFromPV.clone(
758 for _eraName, _postfix, _era
in _relevantEras:
759 _setForEra(trackValidatorFromPVStandalone, _eraName, _era, label = trackValidatorFromPV.label + locals()[
"_selectorsFromPVStandalone"+_postfix] + locals()[
"_selectorsFromPVPt09Standalone"+_postfix])
762 trackValidatorFromPVAllTPStandalone = trackValidatorFromPVAllTP.clone(
763 label = trackValidatorFromPVStandalone.label.value(),
767 trackValidatorAllTPEfficStandalone = trackValidatorAllTPEffic.clone(
768 label = [ x
for x
in trackValidator.label.value()
if x
not in [
"cutsRecoTracksBtvLike",
"cutsRecoTracksAK4PFJets"]
and "Pt09" not in x],
772 trackValidatorConversionStandalone = trackValidatorConversion.clone(
773 label = [x
for x
in trackValidatorConversion.label
if x !=
"convStepTracks"],
777 trackValidatorBHadronStandalone = trackValidatorBHadron.clone(
778 label = [x
for x
in trackValidatorStandalone.label
if "Pt09" not in x],
782 trackValidatorGsfTracksStandalone = trackValidatorGsfTracks.clone(
787 tracksPreValidationStandalone = tracksPreValidation.copy()
788 tracksPreValidationStandalone.add(trackingParticlesBHadron)
789 tracksPreValidationStandalone.replace(highPtJetsForTrk,highPtJets)
790 fastSim.toReplaceWith(tracksPreValidationStandalone, tracksPreValidation)
792 tracksValidationSelectorsStandalone = cms.Task(
793 tracksValidationSelectorsByAlgoMaskStandalone,
794 tracksValidationSelectorsPt09Standalone,
795 tracksValidationSelectorsFromPVStandalone,
796 tracksValidationSelectorsFromPVPt09Standalone
801 _trackValidatorsBase = cms.Sequence(
802 trackValidatorStandalone +
803 trackValidatorTPPtLess09Standalone +
804 trackValidatorFromPVStandalone +
805 trackValidatorFromPVAllTPStandalone +
806 trackValidatorAllTPEfficStandalone +
807 trackValidatorConversionStandalone +
808 trackValidatorGsfTracksStandalone +
809 trackValidatorBHadronStandalone
812 _trackValidatorsBasePhase2 = _trackValidatorsBase.copy()
813 _trackValidatorsBasePhase2+=trackValidatorTPEtaGreater2p7
814 phase2_tracker.toReplaceWith(_trackValidatorsBase, _trackValidatorsBasePhase2)
816 trackValidatorsStandalone = _trackValidatorsBase.copy()
817 fastSim.toModify(trackValidatorsStandalone,
lambda x: x.remove(trackValidatorConversionStandalone) )
819 tracksValidationStandalone = cms.Sequence(
820 ak4PFL1FastL2L3CorrectorChain +
821 trackValidatorsStandalone,
822 tracksPreValidationStandalone,
823 tracksValidationSelectorsStandalone
829 tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets])
830 _taskForEachEra(_addSeedToTrackProducers, args=[
"_seedProducers"], names=
"_seedSelectors", task=
"_tracksValidationSeedSelectorsTrackingOnly", includeFastSim=
True, modDict=globals())
831 _taskForEachEra(_addSeedToTrackProducers, args=[
"_seedProducersPreSplitting"], names=
"_seedSelectorsPreSplitting", task=
"_tracksValidationSeedSelectorsPreSplittingTrackingOnly", modDict=globals())
832 tracksValidationSeedSelectorsTrackingOnly.add(tracksValidationSeedSelectorsPreSplittingTrackingOnly)
835 trackValidatorTrackingOnly = trackValidatorStandalone.clone(
836 label = [ x
for x
in trackValidatorStandalone.label
if x !=
"cutsRecoTracksAK4PFJets"],
837 cores =
"highPtJetsForTrk"
840 trackValidatorSeedingTrackingOnly = _trackValidatorSeedingBuilding.clone(
841 dirName =
"Tracking/TrackSeeding/",
842 label = _seedSelectors,
844 doResolutionPlotsForLabels = [
"seedTracksjetCoreRegionalStepSeeds",]
846 trackValidatorSeedingPreSplittingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
847 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
848 label = _seedSelectorsPreSplitting,
849 doSummaryPlots =
False,
852 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
853 _setForEra(trackValidatorSeedingTrackingOnly, _eraName, _era, label = locals()[
"_seedSelectors"+_postfix])
854 for _eraName, _postfix, _era
in _relevantEras:
855 _setForEra(trackValidatorSeedingPreSplittingTrackingOnly, _eraName, _era, label = locals()[
"_seedSelectorsPreSplitting"+_postfix])
858 trackValidatorConversionTrackingOnly = trackValidatorConversion.clone(label = [x
for x
in trackValidatorConversion.label
if x
not in [
"ckfInOutTracksFromConversions",
"ckfOutInTracksFromConversions"]])
860 trackValidatorBHadronTrackingOnly = trackValidatorBHadron.clone(label = [x
for x
in trackValidatorTrackingOnly.label
if "Pt09" not in x])
862 trackValidatorTPPtLess09TrackingOnly = trackValidatorTPPtLess09Standalone.clone(cores =
"highPtJetsForTrk")
863 trackValidatorFromPVTrackingOnly = trackValidatorFromPVStandalone.clone(cores =
"highPtJetsForTrk")
864 trackValidatorFromPVAllTPTrackingOnly = trackValidatorFromPVAllTPStandalone.clone(cores =
"highPtJetsForTrk")
865 trackValidatorAllTPEfficTrackingOnly = trackValidatorAllTPEfficStandalone.clone(cores =
"highPtJetsForTrk")
867 tracksPreValidationTrackingOnly = tracksPreValidationStandalone.copy()
868 tracksPreValidationTrackingOnly.replace(tracksValidationSelectors, tracksValidationSelectorsTrackingOnly)
869 tracksPreValidationTrackingOnly.replace(highPtJets,highPtJetsForTrk)
871 trackValidatorsTrackingOnly = _trackValidatorsBase.copy()
872 trackValidatorsTrackingOnly.replace(trackValidatorStandalone, trackValidatorTrackingOnly)
873 trackValidatorsTrackingOnly.replace(trackValidatorTPPtLess09Standalone,trackValidatorTPPtLess09TrackingOnly)
874 trackValidatorsTrackingOnly.replace(trackValidatorFromPVStandalone,trackValidatorFromPVTrackingOnly)
875 trackValidatorsTrackingOnly.replace(trackValidatorFromPVAllTPStandalone,trackValidatorFromPVAllTPTrackingOnly)
876 trackValidatorsTrackingOnly.replace(trackValidatorAllTPEfficStandalone,trackValidatorAllTPEfficTrackingOnly)
877 trackValidatorsTrackingOnly += trackValidatorSeedingTrackingOnly
878 trackValidatorsTrackingOnly += trackValidatorSeedingPreSplittingTrackingOnly
879 trackValidatorsTrackingOnly += trackValidatorBuilding
880 trackValidatorsTrackingOnly += trackValidatorBuildingPreSplitting
881 trackValidatorsTrackingOnly.replace(trackValidatorConversionStandalone, trackValidatorConversionTrackingOnly)
882 trackValidatorsTrackingOnly.remove(trackValidatorGsfTracksStandalone)
883 trackValidatorsTrackingOnly.replace(trackValidatorBHadronStandalone, trackValidatorBHadronTrackingOnly)
884 fastSim.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([
885 trackValidatorBuildingPreSplitting,
886 trackValidatorSeedingPreSplittingTrackingOnly,
887 trackValidatorConversionTrackingOnly,
888 trackValidatorBHadronTrackingOnly
891 tracksValidationTrackingOnly = cms.Sequence(
892 trackValidatorsTrackingOnly,
893 tracksPreValidationTrackingOnly,
894 tracksValidationSelectorsStandalone,
895 tracksValidationSeedSelectorsTrackingOnly
900 trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone(
901 label_tr =
"pixelTracks",
902 associator =
"quickTrackAssociatorByHitsPreSplitting",
904 PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone(
905 trackAssociation =
"trackingParticlePixelTrackAsssociation"
908 trackValidatorPixelTrackingOnly = trackValidator.clone(
909 dirName =
"Tracking/PixelTrack/",
910 label = [
"pixelTracks"],
911 doResolutionPlotsForLabels = [],
912 trackCollectionForDrCalculation =
"pixelTracks",
913 associators = [
"trackingParticlePixelTrackAsssociation"],
914 label_vertex =
"pixelVertices",
915 vertexAssociator =
"PixelVertexAssociatorByPositionAndTracks",
917 cores = cms.InputTag(
""),
920 tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy()
921 tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation)
922 tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks)
923 tracksValidationPixelTrackingOnly = cms.Sequence(
924 trackValidatorPixelTrackingOnly,
925 tracksValidationTruthPixelTrackingOnly
930 trackValidatorLite = trackValidator.clone(
931 label = [
"generalTracks",
"cutsRecoTracksHp"]
933 tracksValidationLite = cms.Sequence(
936 tracksValidationTruth
940 from Configuration.Eras.Modifier_phase2_timing_layer_cff
import phase2_timing_layer
941 phase2_timing_layer.toModify( generalTracksFromPV,
942 timesTag = cms.InputTag(
'tofPID:t0'),
943 timeResosTag = cms.InputTag(
'tofPID:sigmat0'),
944 nSigmaDtVertex = cms.double(3) )
945 phase2_timing_layer.toModify( trackValidatorStandalone,
946 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
947 phase2_timing_layer.toModify( trackValidatorFromPVStandalone,
948 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
949 phase2_timing_layer.toModify( trackValidatorFromPVAllTPStandalone,
950 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
951 phase2_timing_layer.toModify( trackValidatorConversionStandalone,
952 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )
953 phase2_timing_layer.toModify( trackValidatorGsfTracks,
954 label_vertex = cms.untracked.InputTag(
'offlinePrimaryVertices4D') )