Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track-gen matching passing through TrackingParticle #33774

Merged
merged 15 commits into from Jun 13, 2021

Conversation

elusian
Copy link

@elusian elusian commented May 19, 2021

PR description:

This PR adds a way to match generalTracks (in AOD) and packedPFCandidates and lostTracks (in miniAOD) to a subset of genParticles, using association by hit on TrackingParticles.
The association is performed on step3 and just replicated in the miniAOD.
Since the track association by hit needs both TrackingParticles and SimLink for pixel and strips and the SimLink collections are not available in RAWSIM, two plugins are created to be run in step2 to add two pruned collections and avoid adding the all the SimLink, which have a non negligible size.

The changes contained are:

  • a plugin for pruning TrackingParticles in step2 based on their association to specific GenParticles. The genParticle selection is taken from the GenParticlePruner class and can be configured.
  • a plugin for pruning SimLink collections based on the SimTrack association to a TrackingParticle
  • a plugin for adding an association between PackedCandidates and GenParticles based on an existing association between tracks and GenParticles
  • Needed configuration changes to add this to standard sequences

No plugin is needed for association between tracks and GenParticles through TrackingParticle as it is already present in CMSSW (MCTrackMatcher).

PR validation:

On a B+->Psi2SK sample (one of the possible targets for this PR) we registered this increases in size, timing and memory

Size Timing Memory
RAWSIM +0.05% +0.08% +5MB
RECOSIM < +0.01% +0.07% +2MB
AODSIM +0.06%
MINIAODSIM +0.4% +0.08% +400kB

if this PR is a backport please specify the original PR and why you need to backport that PR:

Not a backport, but if possible we would like to backport this to 10_6 for MC production for BParking reprocessing

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-33774/22739

  • This PR adds an extra 16KB to repository

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-33774/22772

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @elusian for master.

It involves the following packages:

SimTracker/TrackAssociation

@cmsbuild, @civanch, @mdhildreth can you please review it and eventually sign? Thanks.
@makortel, @mtosi, @abbiendi, @GiacomoSguazzoni, @JanFSchulte, @rovere, @VinInn, @jhgoh, @threus, @dgulhan this is something you requested to watch as well.
@silviodonato, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@mariadalfonso
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-dfca37/15210/summary.html
COMMIT: cfd802f
CMSSW: CMSSW_12_0_X_2021-05-19-2300/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/33774/15210/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 37
  • DQMHistoTests: Total histograms compared: 2648902
  • DQMHistoTests: Total failures: 7
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2648873
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 36 files compared)
  • Checked 155 log files, 37 edm output root files, 37 DQM output files
  • TriggerResults: no differences found

// class declaration
//

class PackedCandidateGenAssociationProducer : public edm::stream::EDProducer<> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this could be edm::global module.

// class declaration
//

class SimLinkPruner : public edm::stream::EDProducer<> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this too could be edm::global module.

using namespace edm;

if (firstEvent_) {
PdgEntryReplacer rep(iSetup);
Copy link
Contributor

@makortel makortel May 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be migrated to EventSetup consumes. (I understand it would have implications outside of the code added in this PR, so this may be a note more for @cms-sw/simulation-l2)

Copy link
Contributor

@mmusich mmusich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I think a lot of the event data access boilerplate can be simplified to improve readability as you don't check the validity of the handles, as suggested at: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEDMGetDataFromEvent#get.
Also I would suggest a better naming for SimLinkPruner -> DigiSimLinkPruner

Comment on lines 72 to 74
edm::Handle<edm::Association<reco::GenParticleCollection>> htrackToGenAssoc;
iEvent.getByToken(trackToGenToken_, htrackToGenAssoc);
const auto& trackToGenAssoc = *htrackToGenAssoc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edm::Handle<edm::Association<reco::GenParticleCollection>> htrackToGenAssoc;
iEvent.getByToken(trackToGenToken_, htrackToGenAssoc);
const auto& trackToGenAssoc = *htrackToGenAssoc;
const auto& trackToGenAssoc = iEvent.get(trackToGenToken_);

Comment on lines 77 to 79
edm::Handle<edm::Association<pat::PackedCandidateCollection>> htrackToPackedCandidatesAssoc;
iEvent.getByToken(trackToPcToken_, htrackToPackedCandidatesAssoc);
const auto& trackToPackedCandidatesAssoc = *htrackToPackedCandidatesAssoc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edm::Handle<edm::Association<pat::PackedCandidateCollection>> htrackToPackedCandidatesAssoc;
iEvent.getByToken(trackToPcToken_, htrackToPackedCandidatesAssoc);
const auto& trackToPackedCandidatesAssoc = *htrackToPackedCandidatesAssoc;
const auto& trackToPackedCandidatesAssoc = iEvent.get(trackToPcToken_);

Comment on lines 82 to 84
edm::Handle<edm::Association<reco::GenParticleCollection>> hgenToPrunedAssoc;
iEvent.getByToken(genToPrunedToken_, hgenToPrunedAssoc);
const auto& genToPrunedAssoc = *hgenToPrunedAssoc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edm::Handle<edm::Association<reco::GenParticleCollection>> hgenToPrunedAssoc;
iEvent.getByToken(genToPrunedToken_, hgenToPrunedAssoc);
const auto& genToPrunedAssoc = *hgenToPrunedAssoc;
const auto& genToPrunedAssoc = iEvent.get(genToPrunedToken_);

Comment on lines 87 to 89
edm::Handle<edm::Association<reco::GenParticleCollection>> hgenToPrunedAssocWSO;
iEvent.getByToken(genToPrunedWSOToken_, hgenToPrunedAssocWSO);
const auto& genToPrunedAssocWSO = *hgenToPrunedAssocWSO;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edm::Handle<edm::Association<reco::GenParticleCollection>> hgenToPrunedAssocWSO;
iEvent.getByToken(genToPrunedWSOToken_, hgenToPrunedAssocWSO);
const auto& genToPrunedAssocWSO = *hgenToPrunedAssocWSO;
const auto& genToPrunedAssocWSO = iEvent.get(genToPrunedWSOToken_);

Comment on lines 91 to 93
edm::Handle<edm::View<reco::Track>> htracks;
iEvent.getByToken(tracksToken_, htracks);
const auto& tracks = *htracks;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edm::Handle<edm::View<reco::Track>> htracks;
iEvent.getByToken(tracksToken_, htracks);
const auto& tracks = *htracks;
const auto& tracks = iEvent.get(tracksToken_);

firstEvent_ = false;
}

edm::Handle<TrackingParticleCollection> tps;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above, but changing the loop at line 315

iEvent.getByToken(tpToken_, tps);

edm::Handle<reco::GenParticleCollection> gps;
iEvent.getByToken(gpToken_, gps);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above, but changing the calls below.

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
void SimLinkPruner::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("trackingParticles", edm::InputTag("mix", "MergedTrackTruth"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does premixing deal with this?
Or is this meant for Signal TPs only by construction?


void TrackingParticleSelectorByGen::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("trackingParticles", edm::InputTag("mix", "MergedTrackTruth"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is premixing going to be dealt with?
Or is this meant for Signal TPs only by construction?

// class declaration
//

class SimLinkPruner : public edm::stream::EDProducer<> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something like DigiSimLinkPruner would be more appropriate.

@civanch
Copy link
Contributor

civanch commented May 20, 2021

@elusian , what is the value of extra memory, which bring this PR?

@qliphy
Copy link
Contributor

qliphy commented Jun 12, 2021

+operations

@qliphy
Copy link
Contributor

qliphy commented Jun 12, 2021

@cms-sw/pdmv-l2 @cms-sw/upgrade-l2 Do you have further comments?

@srimanob
Copy link
Contributor

@elusian

Sorry, I somehow miss this. Could you please clarify few things? (It is maybe somewhere in the long discussion of this PR)

  • Is this PR support to work properly with premixing? Test on that? I see workflow .181 in PR test.
  • What is the PU description that you use to measure size addition? Do we have number for PU200? Since the additional products are on RAW without modifier, I assume it will propagate to Phase-2 also.

Thanks and sorry for my late.

@slava77
Copy link
Contributor

slava77 commented Jun 12, 2021

@elusian

Sorry, I somehow miss this. Could you please clarify few things? (It is maybe somewhere in the long discussion of this PR)

* Is this PR support to work properly with premixing? Test on that? I see workflow .181 in PR test.

* What is the PU description that you use to measure size addition? Do we have number for PU200? Since the additional products are on RAW without modifier, I assume it will propagate to Phase-2 also.

Thanks and sorry for my late.

as described in #33774 (comment) (even though it was done in 10_6_X), the code works with premixing. Note though that the code is making associations only to the signal tracking particles. So, the presence of pileup doesn't really matter that much.

@srimanob
Copy link
Contributor

+Upgrade

Thanks @slava77 for confirmation. That is what I understand from the code too that it will work with signal only for premixing. For Phase-2 size, I think the review can be done later, considering the need of PR for UL now.

@chayanit
Copy link

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @silviodonato, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@qliphy
Copy link
Contributor

qliphy commented Jun 13, 2021

+1

@chayanit
Copy link

Hello @elusian , just to inform you that because of this PR, we are not able to produce RECO-only RelVal for 12_0_0_pre3 campaign (both Run3 and Phase2). The production failed to find the module and complained product not found. Please see what we have tried here. https://dmytro.web.cern.ch/dmytro/cmsprodmon/workflows.php?campaign=CMSSW_12_0_0_pre3__fullsim_PU_2021_14TeV_RECOonly-1624276545

Fatal Exception (Exit code: 8006)
An exception of category 'ProductNotFound' occurred while
[0] Processing Event run: 1 lumi: 1 event: 2 stream: 0
[1] Running path 'RECOSIMoutput_step'
[2] Prefetching for module PoolOutputModule/'RECOSIMoutput'
[3] Prefetching for module MCTrackMatcher/'prunedTrackMCMatch'
[4] Prefetching for module QuickTrackAssociatorByHitsProducer/'quickPrunedTrackAssociatorByHits'
[5] Calling method for module ClusterTPAssociationProducer/'prunedTpClusterProducer'
Exception Message:
Principal::getByToken: Found zero products matching all criteria
Looking for type: std::vector
Looking for module label: prunedTrackingParticles
Looking for productInstanceName:

@srimanob
Copy link
Contributor

@chayanit
As mentioned in the PR description, there is a change in RAW content, two pruned collections are added to step-2 (DIGI step). So, it is not possible to do reco-only.

The change of RAW content is in
SimTracker/Configuration/python/SimTracker_EventContent_cff.py

@elusian
Copy link
Author

elusian commented Jun 28, 2021

That is correct, the missing product in the RAWSIM was not available on CMSSW_12_0_0_pre2, so it is not possible to run only on the old RAW without configuration changes

@chayanit
Copy link

chayanit commented Jun 28, 2021

Thanks for the confirmation! @srimanob
@elusian let me know if you find some difficulties to validate the campaign and if any other helps we could provide instead of RECO-only samples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet