-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Adding vertex recovery step for 2018 heavy ion miniAOD production. #31676
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
Changes from 7 commits
a0881f5
9f7ab42
21e5a2b
f473f65
f55dc9b
0b5056b
ee65572
280b0c5
d552e8b
7d0d84c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
|
|
||
| from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices | ||
|
|
||
| offlinePrimaryVerticesRecovery = offlinePrimaryVertices.clone( | ||
|
|
||
| isRecoveryIteration = True, | ||
| recoveryVtxCollection = "offlinePrimaryVertices", | ||
|
|
||
| TkFilterParameters = dict( | ||
| maxNormalizedChi2 = 999.0, | ||
| minPixelLayersWithHits= 0, | ||
| minSiliconLayersWithHits = 0, | ||
| maxD0Significance = 999.0, | ||
| minPt = 0.0, | ||
| maxEta = 999.0, | ||
| trackQuality = "any" | ||
| ), | ||
|
|
||
| TkClusParameters = dict( | ||
| algorithm = "gap", | ||
| TkGapClusParameters = dict( | ||
| zSeparation = 1.0 | ||
| ) | ||
| ), | ||
|
|
||
| vertexCollections = [offlinePrimaryVertices.vertexCollections[0].clone()] | ||
| ) | ||
|
|
||
| from PhysicsTools.PatAlgos.slimming.offlineSlimmedPrimaryVertices_cfi import offlineSlimmedPrimaryVertices | ||
| offlineSlimmedPrimaryVerticesRecovery = cms.EDProducer("PATVertexSlimmer", | ||
| src = cms.InputTag("offlinePrimaryVerticesRecovery"), | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,13 @@ PrimaryVertexProducer::PrimaryVertexProducer(const edm::ParameterSet& conf) : th | |
| algorithms.push_back(algorithm); | ||
| produces<reco::VertexCollection>(algorithm.label); | ||
| } | ||
|
|
||
| //check if this is a recovery iteration | ||
| fRecoveryIteration = conf.getParameter<bool>("isRecoveryIteration"); | ||
| if (fRecoveryIteration) { | ||
| assert(algorithms.size() == 1); | ||
| recoveryVtxToken = consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("recoveryVtxCollection")); | ||
| } | ||
| } | ||
|
|
||
| PrimaryVertexProducer::~PrimaryVertexProducer() { | ||
|
|
@@ -149,6 +156,22 @@ void PrimaryVertexProducer::produce(edm::Event& iEvent, const edm::EventSetup& i | |
| edm::LogError("UnusableBeamSpot") << "Beamspot with invalid errors " << beamVertexState.error().matrix(); | ||
| } | ||
|
|
||
| //if this is a recovery iteration, check if we already have a valid PV | ||
| if (fRecoveryIteration) { | ||
| auto const& oldVertices = iEvent.get(recoveryVtxToken); | ||
| //look for the first valid (not-BeamSpot) vertex | ||
| for (auto const& old : oldVertices) { | ||
| if (!(old.isFake())) { | ||
| //found a valid vertex, write the first one to the collection and return | ||
| //otherwise continue with regular vertexing procedure | ||
| auto result = std::make_unique<reco::VertexCollection>(); | ||
| result->push_back(old); | ||
| iEvent.put(std::move(result), algorithms.begin()->label); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same should be done for all available algorithms or there should be an assert in the constructor that only one algorithm exists if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added an assert() in the constructor. For our purposes of event selection, we only need one algorithm run for the recovery. |
||
| return; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // get RECO tracks from the event | ||
| // `tks` can be used as a ptr to a reco::TrackCollection | ||
| edm::Handle<reco::TrackCollection> tks; | ||
|
|
@@ -414,6 +437,8 @@ void PrimaryVertexProducer::fillDescriptions(edm::ConfigurationDescriptions& des | |
| psd0.add<std::string>("algorithm", "DA_vect"); | ||
| desc.add<edm::ParameterSetDescription>("TkClusParameters", psd0); | ||
| } | ||
| desc.add<bool>("isRecoveryIteration", false); | ||
| desc.add<edm::InputTag>("recoveryVtxCollection", {""}); | ||
|
|
||
| descriptions.add("primaryVertexProducer", desc); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To report configuration mistakes an (explanatory) exception would be easier to understand than assertion failure.