diff --git a/DataFormats/Provenance/src/classes.h b/DataFormats/Provenance/src/classes.h index e87580521fddc..6630f6f044166 100644 --- a/DataFormats/Provenance/src/classes.h +++ b/DataFormats/Provenance/src/classes.h @@ -35,6 +35,7 @@ #include "DataFormats/Provenance/interface/ESRecordAuxiliary.h" #include "DataFormats/Provenance/interface/ViewTypeChecker.h" #include "FWCore/Utilities/interface/typedefs.h" +#include "FWCore/Utilities/interface/VecArray.h" #include #include #include diff --git a/DataFormats/Provenance/src/classes_def.xml b/DataFormats/Provenance/src/classes_def.xml index 500022fac5cb1..2a521b82b6b2c 100644 --- a/DataFormats/Provenance/src/classes_def.xml +++ b/DataFormats/Provenance/src/classes_def.xml @@ -61,6 +61,7 @@ + diff --git a/SimTracker/TrackerHitAssociation/BuildFile.xml b/SimTracker/TrackerHitAssociation/BuildFile.xml index b63d354eec25b..48e91f5cbee07 100644 --- a/SimTracker/TrackerHitAssociation/BuildFile.xml +++ b/SimTracker/TrackerHitAssociation/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h b/SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h index 41bfb42bead5e..e4fcde1f03f70 100644 --- a/SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h +++ b/SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h @@ -4,6 +4,7 @@ #include "DataFormats/Provenance/interface/ProductID.h" #include "DataFormats/Common/interface/HandleBase.h" #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h" +#include "FWCore/Utilities/interface/VecArray.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h" @@ -32,6 +33,10 @@ class ClusterTPAssociation { void emplace_back(const OmniClusterRef& cluster, const TrackingParticleRef& tp) { checkMappedProductID(tp); + auto foundKeyID = std::find(std::begin(keyProductIDs_), std::end(keyProductIDs_), cluster.id()); + if(foundKeyID == std::end(keyProductIDs_)) { + keyProductIDs_.emplace_back(cluster.id()); + } map_.emplace_back(cluster, tp); } void sortAndUnique() { @@ -54,11 +59,15 @@ class ClusterTPAssociation { const_iterator cend() const { return map_.end(); } range equal_range(const OmniClusterRef& key) const { + checkKeyProductID(key); return std::equal_range(map_.begin(), map_.end(), value_type(key, TrackingParticleRef()), compare); } const map_type& map() const { return map_; } + void checkKeyProductID(const OmniClusterRef& key) const { checkKeyProductID(key.id()); } + void checkKeyProductID(const edm::ProductID& id) const; + void checkMappedProductID(const edm::HandleBase& mappedHandle) const { checkMappedProductID(mappedHandle.id()); } void checkMappedProductID(const TrackingParticleRef& tp) const { checkMappedProductID(tp.id()); } void checkMappedProductID(const edm::ProductID& id) const; @@ -75,6 +84,7 @@ class ClusterTPAssociation { } map_type map_; + edm::VecArray keyProductIDs_; edm::ProductID mappedProductId_; }; diff --git a/SimTracker/TrackerHitAssociation/src/ClusterTPAssociation.cc b/SimTracker/TrackerHitAssociation/src/ClusterTPAssociation.cc index fd66cb18c2cc4..9ee06286e9dd7 100644 --- a/SimTracker/TrackerHitAssociation/src/ClusterTPAssociation.cc +++ b/SimTracker/TrackerHitAssociation/src/ClusterTPAssociation.cc @@ -1,6 +1,21 @@ #include "SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h" #include "FWCore/Utilities/interface/Exception.h" +void ClusterTPAssociation::checkKeyProductID(const edm::ProductID& id) const { + if(std::find(std::begin(keyProductIDs_), std::end(keyProductIDs_), id) == std::end(keyProductIDs_)) { + auto e = cms::Exception("InvalidReference"); + e << "ClusterTPAssociation has OmniClusterRefs with ProductIDs "; + for(size_t i=0; i("doMVAPlots")), simPVMaxZ_(pset.getUntrackedParameter("simPVMaxZ")) { + if(label.empty()) { + // Disable prefetching of everything if there are no track collections + return; + } + const edm::InputTag& label_tp_effic_tag = pset.getParameter< edm::InputTag >("label_tp_effic"); const edm::InputTag& label_tp_fake_tag = pset.getParameter< edm::InputTag >("label_tp_fake"); @@ -211,6 +216,10 @@ MultiTrackValidator::~MultiTrackValidator() {} void MultiTrackValidator::bookHistograms(DQMStore::ConcurrentBooker& ibook, edm::Run const&, edm::EventSetup const& setup, Histograms& histograms) const { + if(label.empty()) { + // Disable histogram booking if there are no track collections + return; + } const auto minColl = -0.5; const auto maxColl = label.size()-0.5; @@ -481,6 +490,11 @@ void MultiTrackValidator::trackDR(const edm::View& trackCollection, void MultiTrackValidator::dqmAnalyze(const edm::Event& event, const edm::EventSetup& setup, const Histograms& histograms) const { + if(label.empty()) { + // Disable if there are no track collections + return; + } + using namespace reco; LogDebug("TrackValidator") << "\n====================================================" << "\n" diff --git a/Validation/RecoTrack/python/PostProcessorTracker_cfi.py b/Validation/RecoTrack/python/PostProcessorTracker_cfi.py index a926b19d4321a..6b5a19f799035 100644 --- a/Validation/RecoTrack/python/PostProcessorTracker_cfi.py +++ b/Validation/RecoTrack/python/PostProcessorTracker_cfi.py @@ -270,9 +270,9 @@ def _addNoFlow(module): ) postProcessorTrackTrackingOnly = postProcessorTrack.clone() -postProcessorTrackTrackingOnly.subDirs.extend(["Tracking/TrackSeeding/*", "Tracking/PixelTrack/*", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*"]) +postProcessorTrackTrackingOnly.subDirs.extend(["Tracking/TrackSeeding/*", "Tracking/PixelTrack/*", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*", "Tracking/PixelTrackBHadron/*"]) postProcessorTrackSummaryTrackingOnly = postProcessorTrackSummary.clone() -postProcessorTrackSummaryTrackingOnly.subDirs.extend(["Tracking/TrackSeeding", "Tracking/PixelTrack", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*"]) +postProcessorTrackSummaryTrackingOnly.subDirs.extend(["Tracking/TrackSeeding", "Tracking/PixelTrack", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*", "Tracking/PixelTrackBHadron/*"]) postProcessorTrackSequenceTrackingOnly = cms.Sequence( postProcessorTrackTrackingOnly+ diff --git a/Validation/RecoTrack/python/TrackValidation_cff.py b/Validation/RecoTrack/python/TrackValidation_cff.py index a90d22e8518cf..bc84c87cf191f 100644 --- a/Validation/RecoTrack/python/TrackValidation_cff.py +++ b/Validation/RecoTrack/python/TrackValidation_cff.py @@ -33,8 +33,10 @@ _trackProd = [] locals()["_algos"+_postfix] = ["generalTracks"] + _cfg.iterationAlgos(_postfix) + ["duplicateMerge"] - locals()["_seedProducers"+_postfix] = _seedProd + _cfg.seedProducers(_postfix) - locals()["_trackProducers"+_postfix] = _trackProd + _cfg.trackProducers(_postfix) + locals()["_seedProducersPreSplitting"+_postfix] = _seedProd + locals()["_trackProducersPreSplitting"+_postfix] = _trackProd + locals()["_seedProducers"+_postfix] = _cfg.seedProducers(_postfix) + locals()["_trackProducers"+_postfix] = _cfg.trackProducers(_postfix) if _eraName != "trackingPhase2PU140": locals()["_electronSeedProducers"+_postfix] = ["tripletElectronSeeds", "pixelPairElectronSeeds", "stripPairElectronSeeds"] @@ -61,7 +63,7 @@ def _algoToSelector(algo): def _addSelectorsByAlgo(algos, modDict): names = [] - seq = cms.Sequence() + task = cms.Task() for algo in algos: if algo == "generalTracks": continue @@ -72,10 +74,10 @@ def _addSelectorsByAlgo(algos, modDict): else: mod = modDict[modName] names.append(modName) - seq += mod - return (names, seq) + task.add(mod) + return (names, task) def _addSelectorsByHp(algos, modDict): - seq = cms.Sequence() + task = cms.Task() names = [] for algo in algos: modName = _algoToSelector(algo) @@ -89,10 +91,10 @@ def _addSelectorsByHp(algos, modDict): else: mod = modDict[modNameHp] names.append(modNameHp) - seq += mod - return (names, seq) + task.add(mod) + return (names, task) def _addSelectorsBySrc(modules, midfix, src, modDict): - seq = cms.Sequence() + task = cms.Task() names = [] for modName in modules: modNameNew = modName.replace("cutsRecoTracks", "cutsRecoTracks"+midfix) @@ -102,10 +104,10 @@ def _addSelectorsBySrc(modules, midfix, src, modDict): else: mod = modDict[modNameNew] names.append(modNameNew) - seq += mod - return (names, seq) + task.add(mod) + return (names, task) def _addSelectorsByOriginalAlgoMask(modules, midfix, algoParam,modDict): - seq = cms.Sequence() + task = cms.Task() names = [] for modName in modules: if modName[-2:] == "Hp": @@ -120,11 +122,11 @@ def _addSelectorsByOriginalAlgoMask(modules, midfix, algoParam,modDict): else: mod = modDict[modNameNew] names.append(modNameNew) - seq += mod - return (names, seq) + task.add(mod) + return (names, task) def _addSeedToTrackProducers(seedProducers,modDict): names = [] - seq = cms.Sequence() + task = cms.Task() for seed in seedProducers: modName = "seedTracks"+seed if modName not in modDict: @@ -133,8 +135,8 @@ def _addSeedToTrackProducers(seedProducers,modDict): else: mod = modDict[modName] names.append(modName) - seq += mod - return (names, seq) + task.add(mod) + return (names, task) _relevantEras = _cfg.allEras() _relevantErasAndFastSim = _relevantEras + [("fastSim", "_fastSim", fastSim)] @@ -146,9 +148,9 @@ def _translateArgs(args, postfix, modDict): else: ret.append(modDict[arg+postfix]) return ret -def _sequenceForEachEra(function, args, names, sequence, modDict, plainArgs=[], modifySequence=None, includeFastSim=False): - if sequence[0] != "_": - raise Exception("Sequence name is expected to begin with _") +def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False): + if task[0] != "_": + raise Exception("Task name is expected to begin with _") _eras = _relevantErasAndFastSim if includeFastSim else _relevantEras for eraName, postfix, _era in _eras: @@ -156,23 +158,23 @@ def _sequenceForEachEra(function, args, names, sequence, modDict, plainArgs=[], _args.extend(plainArgs) ret = function(*_args, modDict=modDict) if len(ret) != 2: - raise Exception("_sequenceForEachEra is expected to return 2 values, but function returned %d" % len(ret)) + raise Exception("_taskForEachEra is expected to return 2 values, but function returned %d" % len(ret)) modDict[names+postfix] = ret[0] - modDict[sequence+postfix] = ret[1] + modDict[task+postfix] = ret[1] - # The sequence of the first era will be the default one - defaultSequenceName = sequence+_eras[0][0] - defaultSequence = modDict[defaultSequenceName] - modDict[defaultSequenceName[1:]] = defaultSequence # remove leading underscore + # The task of the first era will be the default one + defaultTaskName = task+_eras[0][0] + defaultTask = modDict[defaultTaskName] + modDict[defaultTaskName[1:]] = defaultTask # remove leading underscore - # Optionally modify sequences before applying the era - if modifySequence is not None: + # Optionally modify task before applying the era + if modifyTask is not None: for eraName, postfix, _era in _eras: - modifySequence(modDict[sequence+postfix]) + modifyTask(modDict[task+postfix]) # Apply eras for _eraName, _postfix, _era in _eras[1:]: - _era.toReplaceWith(defaultSequence, modDict[sequence+_postfix]) + _era.toReplaceWith(defaultTask, modDict[task+_postfix]) def _setForEra(module, eraName, era, **kwargs): if eraName == "": for key, value in six.iteritems(kwargs): @@ -242,10 +244,10 @@ def _getMVASelectors(postfix): locals()["_mvaSelectors"+_postfix] = _getMVASelectors(_postfix) # Validation iterative steps -_sequenceForEachEra(_addSelectorsByAlgo, args=["_algos"], names="_selectorsByAlgo", sequence="_tracksValidationSelectorsByAlgo", modDict=globals()) +_taskForEachEra(_addSelectorsByAlgo, args=["_algos"], names="_selectorsByAlgo", task="_tracksValidationSelectorsByAlgo", modDict=globals()) # high purity -_sequenceForEachEra(_addSelectorsByHp, args=["_algos"], names="_selectorsByAlgoHp", sequence="_tracksValidationSelectorsByAlgoHp", modDict=globals()) +_taskForEachEra(_addSelectorsByHp, args=["_algos"], names="_selectorsByAlgoHp", task="_tracksValidationSelectorsByAlgoHp", modDict=globals()) # by originalAlgo for _eraName, _postfix, _era in _relevantEras: @@ -254,9 +256,9 @@ def _getMVASelectors(postfix): locals()["_selectorsByAlgoAndHpNoGenTk"+_postfix] = [n for n in locals()["_selectorsByAlgoAndHp"+_postfix] if n not in ["generalTracks", "cutsRecoTracksHp"]] # For ByOriginalAlgo locals()["_selectorsByAlgoAndHpNoGenTkDupMerge"+_postfix] = [n for n in locals()["_selectorsByAlgoAndHpNoGenTk"+_postfix] if n not in ["cutsRecoTracksDuplicateMerge", "cutsRecoTracksDuplicateMergeHp"]] -_sequenceForEachEra(_addSelectorsByOriginalAlgoMask, modDict = globals(), +_taskForEachEra(_addSelectorsByOriginalAlgoMask, modDict = globals(), args = ["_selectorsByAlgoAndHpNoGenTkDupMerge"], plainArgs = ["ByOriginalAlgo", "originalAlgorithm"], - names = "_selectorsByOriginalAlgo", sequence = "_tracksValidationSelectorsByOriginalAlgo") + names = "_selectorsByOriginalAlgo", task = "_tracksValidationSelectorsByOriginalAlgo") for _eraName, _postfix, _era in _relevantEras: @@ -296,11 +298,11 @@ def _getMVASelectors(postfix): # select tracks with pT > 0.9 GeV (for upgrade fake rates) generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9) # and then the selectors -_sequenceForEachEra(_addSelectorsBySrc, modDict=globals(), - args=[["_generalTracksHp"]], - plainArgs=["Pt09", "generalTracksPt09"], - names="_selectorsPt09", sequence="_tracksValidationSelectorsPt09", - modifySequence=lambda seq:seq.insert(0, generalTracksPt09)) +_taskForEachEra(_addSelectorsBySrc, modDict=globals(), + args=[["_generalTracksHp"]], + plainArgs=["Pt09", "generalTracksPt09"], + names="_selectorsPt09", task="_tracksValidationSelectorsPt09", + modifyTask=lambda task:task.add(generalTracksPt09)) # select tracks from the PV from CommonTools.RecoAlgos.TrackWithVertexRefSelector_cfi import trackWithVertexRefSelector as _trackWithVertexRefSelector @@ -317,20 +319,20 @@ def _getMVASelectors(postfix): rhoVtx = 1e10, # intentionally no dxy cut ) # and then the selectors -_sequenceForEachEra(_addSelectorsBySrc, modDict=globals(), +_taskForEachEra(_addSelectorsBySrc, modDict=globals(), args=[["_generalTracksHp"]], plainArgs=["FromPV", "generalTracksFromPV"], - names="_selectorsFromPV", sequence="_tracksValidationSelectorsFromPV", - modifySequence=lambda seq: seq.insert(0, generalTracksFromPV)) + names="_selectorsFromPV", task="_tracksValidationSelectorsFromPV", + modifyTask=lambda task: task.add(generalTracksFromPV)) # select tracks with pT > 0.9 GeV from the PV generalTracksFromPVPt09 = generalTracksPt09.clone(src="generalTracksFromPV") # and then the selectors -_sequenceForEachEra(_addSelectorsBySrc, modDict=globals(), - args=[["_generalTracksHp"]], - plainArgs=["FromPVPt09", "generalTracksFromPVPt09"], - names="_selectorsFromPVPt09", sequence="_tracksValidationSelectorsFromPVPt09", - modifySequence=lambda seq: seq.insert(0, generalTracksFromPVPt09)) +_taskForEachEra(_addSelectorsBySrc, modDict=globals(), + args=[["_generalTracksHp"]], + plainArgs=["FromPVPt09", "generalTracksFromPVPt09"], + names="_selectorsFromPVPt09", task="_tracksValidationSelectorsFromPVPt09", + modifyTask=lambda task: task.add(generalTracksFromPVPt09)) ## Select conversion TrackingParticles, and define the corresponding associator trackingParticlesConversion = _trackingParticleConversionRefSelector.clone() @@ -447,6 +449,15 @@ def _getMVASelectors(postfix): _setForEra(trackValidatorAllTPEffic, _eraName, _era, label = ["generalTracks", locals()["_generalTracksHp"+_postfix]]) # Built tracks, in the standard sequence mainly for monitoring the track selection MVA +tpClusterProducerPreSplitting = tpClusterProducer.clone(pixelClusterSrc = "siPixelClustersPreSplitting") +quickTrackAssociatorByHitsPreSplitting = quickTrackAssociatorByHits.clone(cluster2TPSrc = "tpClusterProducerPreSplitting") +tpClusterProducerHeterogeneousPreSplitting = tpClusterProducerHeterogeneous.clone( + pixelClusterSrc = "siPixelClustersPreSplitting" +) +from Configuration.ProcessModifiers.gpu_cff import gpu +gpu.toReplaceWith(tpClusterProducerPreSplitting, tpClusterProducerConverter.clone( + src = "tpClusterProducerHeterogeneousPreSplitting" +)) _trackValidatorSeedingBuilding = trackValidator.clone( # common for built tracks and seeds (in trackingOnly) associators = ["quickTrackAssociatorByHits"], UseAssociators = True, @@ -459,11 +470,17 @@ def _getMVASelectors(postfix): dirName = "Tracking/TrackBuilding/", doMVAPlots = True, ) +trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone( + associators = ["quickTrackAssociatorByHitsPreSplitting"], + doMVAPlots = False, + doSummaryPlots = False, +) for _eraName, _postfix, _era in _relevantErasAndFastSim: _setForEra(trackValidatorBuilding, _eraName, _era, label = locals()["_trackProducers"+_postfix]) fastSim.toModify(trackValidatorBuilding, doMVAPlots=False) for _eraName, _postfix, _era in _relevantEras: _setForEra(trackValidatorBuilding, _eraName, _era, mvaLabels = locals()["_mvaSelectors"+_postfix]) + _setForEra(trackValidatorBuildingPreSplitting, _eraName, _era, label = locals()["_trackProducersPreSplitting"+_postfix]) # For conversions @@ -534,31 +551,34 @@ def _uniqueFirstLayers(layerList): # the track selectors -tracksValidationSelectors = cms.Sequence( - tracksValidationSelectorsByAlgo + - tracksValidationSelectorsByAlgoHp + - tracksValidationSelectorsByOriginalAlgo + - cutsRecoTracksBtvLike + - ak4JetTracksAssociatorExplicitAll + +tracksValidationSelectors = cms.Task( + tracksValidationSelectorsByAlgo, + tracksValidationSelectorsByAlgoHp, + tracksValidationSelectorsByOriginalAlgo, + cutsRecoTracksBtvLike, + ak4JetTracksAssociatorExplicitAll, cutsRecoTracksAK4PFJets ) -tracksValidationTruth = cms.Sequence( - tpClusterProducer + - quickTrackAssociatorByHits + - trackingParticleRecoTrackAsssociation + - VertexAssociatorByPositionAndTracks + +tracksValidationTruth = cms.Task( + tpClusterProducer, + tpClusterProducerHeterogeneousPreSplitting, + tpClusterProducerPreSplitting, + quickTrackAssociatorByHits, + quickTrackAssociatorByHitsPreSplitting, + trackingParticleRecoTrackAsssociation, + VertexAssociatorByPositionAndTracks, trackingParticleNumberOfLayersProducer ) fastSim.toModify(tracksValidationTruth, lambda x: x.remove(tpClusterProducer)) -tracksPreValidation = cms.Sequence( - tracksValidationSelectors + - tracksValidationSelectorsPt09 + - tracksValidationSelectorsFromPV + - tracksValidationSelectorsFromPVPt09 + - tracksValidationTruth + - cms.ignore(trackingParticlesSignal) + - cms.ignore(trackingParticlesElectron) + +tracksPreValidation = cms.Task( + tracksValidationSelectors, + tracksValidationSelectorsPt09, + tracksValidationSelectorsFromPV, + tracksValidationSelectorsFromPVPt09, + tracksValidationTruth, + trackingParticlesSignal, + trackingParticlesElectron, trackingParticlesConversion ) fastSim.toReplaceWith(tracksPreValidation, tracksPreValidation.copyAndExclude([ @@ -567,17 +587,19 @@ def _uniqueFirstLayers(layerList): ])) tracksValidation = cms.Sequence( - tracksPreValidation + trackValidator + trackValidatorTPPtLess09 + trackValidatorFromPV + trackValidatorFromPVAllTP + trackValidatorAllTPEffic + trackValidatorBuilding + + trackValidatorBuildingPreSplitting + trackValidatorConversion + - trackValidatorGsfTracks + trackValidatorGsfTracks, + tracksPreValidation ) fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([ + trackValidatorBuildingPreSplitting, trackValidatorConversion, trackValidatorGsfTracks, ])) @@ -585,27 +607,27 @@ def _uniqueFirstLayers(layerList): ### Then define stuff for standalone mode (i.e. MTV with RECO+DIGI input) # Select by originalAlgo and algoMask -_sequenceForEachEra(_addSelectorsByOriginalAlgoMask, modDict = globals(), - args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["ByAlgoMask", "algorithmMaskContains"], - names = "_selectorsByAlgoMask", sequence = "_tracksValidationSelectorsByAlgoMaskStandalone") +_taskForEachEra(_addSelectorsByOriginalAlgoMask, modDict = globals(), + args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["ByAlgoMask", "algorithmMaskContains"], + names = "_selectorsByAlgoMask", task = "_tracksValidationSelectorsByAlgoMaskStandalone") # Select pT>0.9 by iteration # Need to avoid generalTracks+HP because those are already included in the standard validator -_sequenceForEachEra(_addSelectorsBySrc, modDict = globals(), - args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["Pt09", "generalTracksPt09"], - names = "_selectorsPt09Standalone", sequence = "_tracksValidationSelectorsPt09Standalone") +_taskForEachEra(_addSelectorsBySrc, modDict = globals(), + args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["Pt09", "generalTracksPt09"], + names = "_selectorsPt09Standalone", task = "_tracksValidationSelectorsPt09Standalone") # Select fromPV by iteration # Need to avoid generalTracks+HP because those are already included in the standard validator -_sequenceForEachEra(_addSelectorsBySrc, modDict = globals(), - args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["FromPV", "generalTracksFromPV"], - names = "_selectorsFromPVStandalone", sequence = "_tracksValidationSelectorsFromPVStandalone") +_taskForEachEra(_addSelectorsBySrc, modDict = globals(), + args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["FromPV", "generalTracksFromPV"], + names = "_selectorsFromPVStandalone", task = "_tracksValidationSelectorsFromPVStandalone") # Select pt>0.9 and fromPV by iteration # Need to avoid generalTracks+HP because those are already included in the standard validator -_sequenceForEachEra(_addSelectorsBySrc, modDict = globals(), - args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["FromPVPt09", "generalTracksFromPVPt09"], - names = "_selectorsFromPVPt09Standalone", sequence = "_tracksValidationSelectorsFromPVPt09Standalone") +_taskForEachEra(_addSelectorsBySrc, modDict = globals(), + args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["FromPVPt09", "generalTracksFromPVPt09"], + names = "_selectorsFromPVPt09Standalone", task = "_tracksValidationSelectorsFromPVPt09Standalone") # MTV instances trackValidatorStandalone = trackValidator.clone() @@ -632,13 +654,13 @@ def _uniqueFirstLayers(layerList): # sequences tracksPreValidationStandalone = tracksPreValidation.copy() -tracksPreValidationStandalone += trackingParticlesBHadron +tracksPreValidationStandalone.add(trackingParticlesBHadron) fastSim.toReplaceWith(tracksPreValidationStandalone, tracksPreValidation) -tracksValidationSelectorsStandalone = cms.Sequence( - tracksValidationSelectorsByAlgoMaskStandalone + - tracksValidationSelectorsPt09Standalone + - tracksValidationSelectorsFromPVStandalone + +tracksValidationSelectorsStandalone = cms.Task( + tracksValidationSelectorsByAlgoMaskStandalone, + tracksValidationSelectorsPt09Standalone, + tracksValidationSelectorsFromPVStandalone, tracksValidationSelectorsFromPVPt09Standalone ) @@ -659,16 +681,18 @@ def _uniqueFirstLayers(layerList): tracksValidationStandalone = cms.Sequence( ak4PFL1FastL2L3CorrectorChain + - tracksPreValidationStandalone + - tracksValidationSelectorsStandalone + - trackValidatorsStandalone + trackValidatorsStandalone, + tracksPreValidationStandalone, + tracksValidationSelectorsStandalone ) ### TrackingOnly mode (i.e. MTV with DIGI input + tracking-only reconstruction) # selectors tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets]) # selectors using track information only (i.e. no PF) -_sequenceForEachEra(_addSeedToTrackProducers, args=["_seedProducers"], names="_seedSelectors", sequence="_tracksValidationSeedSelectorsTrackingOnly", includeFastSim=True, modDict=globals()) +_taskForEachEra(_addSeedToTrackProducers, args=["_seedProducers"], names="_seedSelectors", task="_tracksValidationSeedSelectorsTrackingOnly", includeFastSim=True, modDict=globals()) +_taskForEachEra(_addSeedToTrackProducers, args=["_seedProducersPreSplitting"], names="_seedSelectorsPreSplitting", task="_tracksValidationSeedSelectorsPreSplittingTrackingOnly", modDict=globals()) +tracksValidationSeedSelectorsTrackingOnly.add(tracksValidationSeedSelectorsPreSplittingTrackingOnly) # MTV instances trackValidatorTrackingOnly = trackValidatorStandalone.clone(label = [ x for x in trackValidatorStandalone.label if x != "cutsRecoTracksAK4PFJets"] ) @@ -678,8 +702,16 @@ def _uniqueFirstLayers(layerList): label = _seedSelectors, doSeedPlots = True, ) +trackValidatorSeedingPreSplittingTrackingOnly = trackValidatorSeedingTrackingOnly.clone( + associators = ["quickTrackAssociatorByHitsPreSplitting"], + label = _seedSelectorsPreSplitting, + doSummaryPlots = False, + +) for _eraName, _postfix, _era in _relevantErasAndFastSim: _setForEra(trackValidatorSeedingTrackingOnly, _eraName, _era, label = locals()["_seedSelectors"+_postfix]) +for _eraName, _postfix, _era in _relevantEras: + _setForEra(trackValidatorSeedingPreSplittingTrackingOnly, _eraName, _era, label = locals()["_seedSelectorsPreSplitting"+_postfix]) trackValidatorConversionTrackingOnly = trackValidatorConversion.clone(label = [x for x in trackValidatorConversion.label if x not in ["ckfInOutTracksFromConversions", "ckfOutInTracksFromConversions"]]) @@ -693,41 +725,32 @@ def _uniqueFirstLayers(layerList): trackValidatorsTrackingOnly = _trackValidatorsBase.copy() trackValidatorsTrackingOnly.replace(trackValidatorStandalone, trackValidatorTrackingOnly) trackValidatorsTrackingOnly += trackValidatorSeedingTrackingOnly +trackValidatorsTrackingOnly += trackValidatorSeedingPreSplittingTrackingOnly trackValidatorsTrackingOnly += trackValidatorBuilding +trackValidatorsTrackingOnly += trackValidatorBuildingPreSplitting trackValidatorsTrackingOnly.replace(trackValidatorConversionStandalone, trackValidatorConversionTrackingOnly) trackValidatorsTrackingOnly.remove(trackValidatorGsfTracks) trackValidatorsTrackingOnly.replace(trackValidatorBHadronStandalone, trackValidatorBHadronTrackingOnly) -fastSim.toModify(trackValidatorsTrackingOnly, lambda x: x.remove(trackValidatorConversionTrackingOnly)) -fastSim.toModify(trackValidatorsTrackingOnly, lambda x: x.remove(trackValidatorBHadronTrackingOnly)) +fastSim.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([ + trackValidatorBuildingPreSplitting, + trackValidatorSeedingPreSplittingTrackingOnly, + trackValidatorConversionTrackingOnly, + trackValidatorBHadronTrackingOnly +])) tracksValidationTrackingOnly = cms.Sequence( - tracksPreValidationTrackingOnly + - tracksValidationSelectorsStandalone + - tracksValidationSeedSelectorsTrackingOnly + - trackValidatorsTrackingOnly + trackValidatorsTrackingOnly, + tracksPreValidationTrackingOnly, + tracksValidationSelectorsStandalone, + tracksValidationSeedSelectorsTrackingOnly ) ### Pixel tracking only mode (placeholder for now) - -tpClusterProducerHeterogeneousPixelTrackingOnly = tpClusterProducerHeterogeneous.clone( - pixelClusterSrc = "siPixelClustersPreSplitting" -) -tpClusterProducerPixelTrackingOnly = tpClusterProducer.clone( - pixelClusterSrc = "siPixelClustersPreSplitting" -) -from Configuration.ProcessModifiers.gpu_cff import gpu -gpu.toReplaceWith(tpClusterProducerPixelTrackingOnly, tpClusterProducerConverter.clone( - src = "tpClusterProducerHeterogeneousPixelTrackingOnly" -)) - -quickTrackAssociatorByHitsPixelTrackingOnly = quickTrackAssociatorByHits.clone( - cluster2TPSrc = "tpClusterProducerPixelTrackingOnly" -) trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone( label_tr = "pixelTracks", - associator = "quickTrackAssociatorByHitsPixelTrackingOnly", + associator = "quickTrackAssociatorByHitsPreSplitting", ) PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone( trackAssociation = "trackingParticlePixelTrackAsssociation" @@ -770,25 +793,32 @@ def _uniqueFirstLayers(layerList): doSimPlots = False, doSimTrackPlots = False, ) +trackValidatorBHadronPixelTrackingOnly = trackValidatorPixelTrackingOnly.clone( + dirName = "Tracking/PixelTrackBHadron/", + label_tp_effic = "trackingParticlesBHadron", + label_tp_effic_refvector = True, + doSimPlots = True, + doRecoTrackPlots = False, # Fake rate is defined wrt. all TPs, and that is already included in trackValidator + dodEdxPlots = False, +) tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy() -tracksValidationTruthPixelTrackingOnly.replace(tpClusterProducer, tpClusterProducerPixelTrackingOnly) -tracksValidationTruthPixelTrackingOnly.replace(quickTrackAssociatorByHits, quickTrackAssociatorByHitsPixelTrackingOnly) tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation) tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks) +tracksValidationTruthPixelTrackingOnly.add(trackingParticlesBHadron) -_tracksValidationTruthPixelTrackingOnlyGPU = tracksValidationTruthPixelTrackingOnly.copy() -_tracksValidationTruthPixelTrackingOnlyGPU.insert(0, tpClusterProducerHeterogeneousPixelTrackingOnly) -gpu.toReplaceWith(tracksValidationTruthPixelTrackingOnly, _tracksValidationTruthPixelTrackingOnlyGPU) - +tracksPreValidationPixelTrackingOnly = cms.Task( + tracksValidationTruthPixelTrackingOnly, + trackingParticlesSignal, + pixelTracksFromPV, +) tracksValidationPixelTrackingOnly = cms.Sequence( - tracksValidationTruthPixelTrackingOnly + - cms.ignore(trackingParticlesSignal) + - pixelTracksFromPV + trackValidatorPixelTrackingOnly + trackValidatorFromPVPixelTrackingOnly + - trackValidatorFromPVAllTPPixelTrackingOnly + trackValidatorFromPVAllTPPixelTrackingOnly + + trackValidatorBHadronPixelTrackingOnly, + tracksPreValidationPixelTrackingOnly ) @@ -799,8 +829,8 @@ def _uniqueFirstLayers(layerList): ) tracksValidationLite = cms.Sequence( cutsRecoTracksHp + - tracksValidationTruth + - trackValidatorLite + trackValidatorLite, + tracksValidationTruth ) ## customization for timing diff --git a/Validation/RecoTrack/python/plotting/html.py b/Validation/RecoTrack/python/plotting/html.py index d3f593f6a7586..1cac97b736941 100644 --- a/Validation/RecoTrack/python/plotting/html.py +++ b/Validation/RecoTrack/python/plotting/html.py @@ -63,6 +63,8 @@ def _allToBTV(s): return s.replace("All", "BTV-like") def _ptCut(s): return s.replace("Tracks", "Tracks pT > 0.9 GeV").replace("tracks", "tracks pT > 0.9 GeV") +def _allToPixel(s): + return s.replace("All", "Pixel") def _toPixel(s): return s.replace("Tracks", "Pixel tracks") _trackQualityNameOrder = collections.OrderedDict([ @@ -198,6 +200,7 @@ def _toPixel(s): ("pixel", "Pixel tracks"), ("pixelFromPV", _toPixel(_fromPVName)), ("pixelFromPVAllTP", _toPixel(_fromPVAllTPName)), + ("pixelbhadron", _allToPixel(_bhadronName)), # These are for vertices ("genvertex", "Gen vertices"), ("pixelVertices", "Pixel vertices"), @@ -248,6 +251,7 @@ def _sectionNameLegend(): "bhadron_btvLike": _bhadronLegend.replace("All tracks", _btvLegend), "pixelFromPV": _fromPVLegend, "pixelFromPVAllTP": _fromPVAllTPLegend, + "pixelbhadron": _bhadronLegend, } class Table: diff --git a/Validation/RecoTrack/python/plotting/trackingPlots.py b/Validation/RecoTrack/python/plotting/trackingPlots.py index f14650a8d92ff..a14dbe41dfc9b 100644 --- a/Validation/RecoTrack/python/plotting/trackingPlots.py +++ b/Validation/RecoTrack/python/plotting/trackingPlots.py @@ -572,6 +572,8 @@ def _trackingSubFoldersFallbackFromPV(subfolder): return subfolder.replace("trackingParticleRecoAsssociation", "trackingParticleRecoAsssociationSignal") def _trackingSubFoldersFallbackConversion(subfolder): return subfolder.replace("quickAssociatorByHits", "quickAssociatorByHitsConversion") +def _trackingSubFoldersFallbackPreSplitting(subfolder): + return subfolder.replace("quickAssociatorByHits", "quickAssociatorByHitsPreSplitting") # Additional "quality" flags than highPurity. In a separate list to # allow customization. @@ -1294,7 +1296,8 @@ def _appendTrackingPlots(lastDirName, name, algoPlots, onlyForPileup=False, only ], **limiters) common = dict(fallbackDqmSubFolders=[ _trackingSubFoldersFallbackSLHC_Phase1PU140, - _trackingSubFoldersFallbackFromPV, _trackingSubFoldersFallbackConversion]) + _trackingSubFoldersFallbackFromPV, _trackingSubFoldersFallbackConversion, + _trackingSubFoldersFallbackPreSplitting]) plotter.append(name, folders, TrackingPlotFolder(*algoPlots, **commonForTPF), **common) extendedPlots = [] if building: @@ -1357,6 +1360,7 @@ def _appendPixelTrackingPlots(lastDirName, name): _appendPixelTrackingPlots("PixelTrack", "pixel") _appendPixelTrackingPlots("PixelTrackFromPV", "pixelFromPV") _appendPixelTrackingPlots("PixelTrackFromPVAllTP", "pixelFromPVAllTP") +_appendPixelTrackingPlots("PixelTrackBHadron", "pixelbhadron") # MiniAOD diff --git a/Validation/RecoVertex/python/VertexValidation_cff.py b/Validation/RecoVertex/python/VertexValidation_cff.py index 3b7a1aef78ea4..91a6c35d2ddbb 100644 --- a/Validation/RecoVertex/python/VertexValidation_cff.py +++ b/Validation/RecoVertex/python/VertexValidation_cff.py @@ -10,17 +10,17 @@ from Validation.RecoTrack.TrackValidation_cff import tracksValidationTruth, tracksValidationTruthPixelTrackingOnly vertexValidationStandalone = cms.Sequence( + vertexValidation, tracksValidationTruth - * vertexValidation ) vertexValidationTrackingOnly = cms.Sequence( + v0Validator + + vertexAnalysisSequenceTrackingOnly, tracksValidationTruth - + v0Validator - + vertexAnalysisSequenceTrackingOnly ) vertexValidationPixelTrackingOnly = cms.Sequence( + vertexAnalysisSequencePixelTrackingOnly, tracksValidationTruthPixelTrackingOnly - + vertexAnalysisSequencePixelTrackingOnly )