Skip to content

Commit

Permalink
Fix the validation of initialStepPreSplitting to use the correct clus…
Browse files Browse the repository at this point in the history
…ters in TP matching
  • Loading branch information
makortel committed Nov 21, 2018
1 parent c573124 commit f76bb62
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 13 deletions.
14 changes: 14 additions & 0 deletions Validation/RecoTrack/plugins/MultiTrackValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ MultiTrackValidator::MultiTrackValidator(const edm::ParameterSet& pset):
doMVAPlots_(pset.getUntrackedParameter<bool>("doMVAPlots")),
simPVMaxZ_(pset.getUntrackedParameter<double>("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");

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -481,6 +490,11 @@ void MultiTrackValidator::trackDR(const edm::View<reco::Track>& 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"
Expand Down
48 changes: 35 additions & 13 deletions Validation/RecoTrack/python/TrackValidation_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -447,6 +449,8 @@ 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")
_trackValidatorSeedingBuilding = trackValidator.clone( # common for built tracks and seeds (in trackingOnly)
associators = ["quickTrackAssociatorByHits"],
UseAssociators = True,
Expand All @@ -459,11 +463,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
Expand Down Expand Up @@ -544,7 +554,9 @@ def _uniqueFirstLayers(layerList):
)
tracksValidationTruth = cms.Task(
tpClusterProducer,
tpClusterProducerPreSplitting,
quickTrackAssociatorByHits,
quickTrackAssociatorByHitsPreSplitting,
trackingParticleRecoTrackAsssociation,
VertexAssociatorByPositionAndTracks,
trackingParticleNumberOfLayersProducer
Expand Down Expand Up @@ -573,11 +585,13 @@ def _uniqueFirstLayers(layerList):
trackValidatorFromPVAllTP +
trackValidatorAllTPEffic +
trackValidatorBuilding +
trackValidatorBuildingPreSplitting +
trackValidatorConversion +
trackValidatorGsfTracks,
tracksPreValidation
)
fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([
trackValidatorBuildingPreSplitting,
trackValidatorConversion,
trackValidatorGsfTracks,
]))
Expand Down Expand Up @@ -669,6 +683,8 @@ def _uniqueFirstLayers(layerList):
# selectors
tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets]) # selectors using track information only (i.e. no PF)
_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"] )
Expand All @@ -678,8 +694,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"]])
Expand All @@ -693,12 +717,18 @@ 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(
Expand All @@ -710,15 +740,9 @@ def _uniqueFirstLayers(layerList):


### Pixel tracking only mode (placeholder for now)
tpClusterProducerPixelTrackingOnly = tpClusterProducer.clone(
pixelClusterSrc = "siPixelClustersPreSplitting"
)
quickTrackAssociatorByHitsPixelTrackingOnly = quickTrackAssociatorByHits.clone(
cluster2TPSrc = "tpClusterProducerPixelTrackingOnly"
)
trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone(
label_tr = "pixelTracks",
associator = "quickTrackAssociatorByHitsPixelTrackingOnly",
associator = "quickTrackAssociatorByHitsPreSplitting",
)
PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone(
trackAssociation = "trackingParticlePixelTrackAsssociation"
Expand All @@ -736,8 +760,6 @@ def _uniqueFirstLayers(layerList):
)

tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy()
tracksValidationTruthPixelTrackingOnly.replace(tpClusterProducer, tpClusterProducerPixelTrackingOnly)
tracksValidationTruthPixelTrackingOnly.replace(quickTrackAssociatorByHits, quickTrackAssociatorByHitsPixelTrackingOnly)
tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation)
tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks)
tracksValidationPixelTrackingOnly = cms.Sequence(
Expand Down

0 comments on commit f76bb62

Please sign in to comment.