-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Adding vertex recovery step for 2018 heavy ion miniAOD production. #31676
Changes from 5 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,49 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices | ||
|
||
offlinePrimaryVerticesRecovery = offlinePrimaryVertices.clone( | ||
|
||
isRecoveryIteration = cms.bool(True), | ||
recoveryVtxCollection = cms.InputTag("offlinePrimaryVertices"), | ||
|
||
TkFilterParameters = cms.PSet( | ||
algorithm=cms.string('filter'), | ||
maxNormalizedChi2 = cms.double(999.0), | ||
minPixelLayersWithHits=cms.int32(0), | ||
minSiliconLayersWithHits = cms.int32(0), | ||
maxD0Significance = cms.double(999.0), | ||
minPt = cms.double(0.0), | ||
maxEta = cms.double(999.0), | ||
trackQuality = cms.string("any") | ||
), | ||
|
||
TkClusParameters = cms.PSet( | ||
algorithm = cms.string("gap"), | ||
TkGapClusParameters = cms.PSet( | ||
zSeparation = cms.double(1.0) | ||
) | ||
), | ||
|
||
vertexCollections = cms.VPSet( | ||
[cms.PSet(label=cms.string(""), | ||
algorithm=cms.string("AdaptiveVertexFitter"), | ||
chi2cutoff = cms.double(2.5), | ||
minNdof=cms.double(0.0), | ||
useBeamConstraint = cms.bool(False), | ||
maxDistanceToBeam = cms.double(1.0) | ||
), | ||
] | ||
) | ||
|
||
) | ||
|
||
from PhysicsTools.PatAlgos.slimming.offlineSlimmedPrimaryVertices_cfi import offlineSlimmedPrimaryVertices | ||
offlineSlimmedPrimaryVerticesRecovery = cms.EDProducer("PATVertexSlimmer", | ||
src = cms.InputTag("offlinePrimaryVerticesRecovery"), | ||
) | ||
|
||
#offlineSlimmedPrimaryVerticesRecovery = offlineSlimmedPrimaryVertices.clone( | ||
# src = cms.InputTag("offlinePrimaryVerticesRecovery"), | ||
# score = cms.InputTag(""), | ||
#) | ||
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. what's the reason for not cloning with a replace? 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. When using the clone implementation, 'score' is still defined which causes issues with a existsAs() call in the PATVertexSlimmer to look for a collection that is not created (and not needed for our use). Thus, I have remove the commented section and gone with the first implementation. 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. You can remove parameters in offlineSlimmedPrimaryVerticesRecovery = offlineSlimmedPrimaryVertices.clone(
src = "offlinePrimaryVerticesRecovery",
score = None
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -82,6 +82,9 @@ class PrimaryVertexProducer : public edm::stream::EDProducer<> { | |||||
edm::ParameterSet theConfig; | ||||||
bool fVerbose; | ||||||
|
||||||
bool isRecoveryIteration; | ||||||
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.
Suggested change
to follow the style of naming of other flags in this module |
||||||
edm::EDGetTokenT<reco::VertexCollection> recoveryVtxToken; | ||||||
|
||||||
edm::EDGetTokenT<reco::BeamSpot> bsToken; | ||||||
edm::EDGetTokenT<reco::TrackCollection> trkToken; | ||||||
edm::EDGetTokenT<edm::ValueMap<float> > trkTimesToken; | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -24,6 +24,12 @@ PrimaryVertexProducer::PrimaryVertexProducer(const edm::ParameterSet& conf) : th | |||||||||||||||||||||||||||
bsToken = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpotLabel")); | ||||||||||||||||||||||||||||
f4D = false; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
//check if this is a recovery iteration | ||||||||||||||||||||||||||||
isRecoveryIteration = conf.getParameter<bool>("isRecoveryIteration"); | ||||||||||||||||||||||||||||
if (isRecoveryIteration) { | ||||||||||||||||||||||||||||
recoveryVtxToken = consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("recoveryVtxCollection")); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
// select and configure the track selection | ||||||||||||||||||||||||||||
std::string trackSelectionAlgorithm = | ||||||||||||||||||||||||||||
conf.getParameter<edm::ParameterSet>("TkFilterParameters").getParameter<std::string>("algorithm"); | ||||||||||||||||||||||||||||
|
@@ -149,6 +155,26 @@ 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 (isRecoveryIteration) { | ||||||||||||||||||||||||||||
edm::Handle<reco::VertexCollection> oldPVs; | ||||||||||||||||||||||||||||
iEvent.getByToken(recoveryVtxToken, oldPVs); | ||||||||||||||||||||||||||||
const reco::VertexCollection* oldVertices; | ||||||||||||||||||||||||||||
oldVertices = oldPVs.product(); | ||||||||||||||||||||||||||||
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.
Suggested change
more modern less verbose syntax |
||||||||||||||||||||||||||||
//look for the first valid (not-BeamSpot) vertex | ||||||||||||||||||||||||||||
for (size_t i = 0; i < oldVertices->size(); ++i) { | ||||||||||||||||||||||||||||
if (!((*oldVertices)[i].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>(); | ||||||||||||||||||||||||||||
reco::VertexCollection& vColl = (*result); | ||||||||||||||||||||||||||||
vColl.push_back((*oldVertices)[i]); | ||||||||||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||||||||||
iEvent.put(std::move(result), algorithms.begin()->label); | ||||||||||||||||||||||||||||
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 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 +440,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", edm::InputTag("offlinePrimaryVertices")); | ||||||||||||||||||||||||||||
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.
Suggested change
to match what's actually added in RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVertices_cfi.py |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
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.
please drop type specifications for all parameters which already exist.
This is a safer way to protect from parameter name mistakes and will also help in possible parameter migrations.
Also, replace only parameters that were actually changed.
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.
@slava77 The default offlinePrimaryVertices has a default minPt of 0, but is modified by the pp_on_AA_2018 era to have minPt = 0.7. When the clone is done, is the default value (0) taken, or does the era-modified version get taken for the new module (in which case we need to specify minPt = 0 again).
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.
I expect that the modified version after
pp_on_AA_2018
is what you will see hereThere 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.
Thanks for the info, this is also what I expected. I will need to include a few extra parameters that are not listed in the example here.