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
Review of reco::PFCandidate::vertex() function #30895
Comments
A new Issue was created by @veelken Christian Veelken. @Dr15Jones, @dpiparo, @silviodonato, @smuzaffar, @makortel, @qliphy can you please review it and eventually sign/assign? Thanks. cms-bot commands are listed here |
assign reconstruction |
please provide a fully reproducible example for your case |
Hi, I send you instructions for reproducing the exception attached below [*], With kind regards, Christian [*] mkdir debugCMSSW [**] ... ----- End Fatal Exception ------------------------------------------------- |
My initial instructions contained an inaccessible file path (/home/veelken). I have copied the files to /afs/cern.ch/user/v/veelken/public/debugCMSSW/CMSSW_11_1_0/src/HLTrigger/TallinnHLTPFTauAnalyzer and updated the instructions above accordingly. The new instructions should work by simply copy & pasting them into a terminal. |
@veelken Thank you. I have to think what is the good thing to do. Is it sufficient to add some validity check of muonRef() and gsfTrackRef(), or do you have a better suggestion? |
@hatakeyamak Adding a validity check for muonRef().isAvailable() and gsfTrackRef().isAvailable() is what I have implemented as a temporary workaround in my CMSSW area for now. The corresponding code is attached below [*]. While adding a validity check solves my use-case, I see one potential issue: in case a user drops a muon or electron collection and the isAvailable() check fails, he or she may get a different vertex position, i.e. the physics behaviour may change. I think a better solution is to move the code from the PFCandidate::vertex() function to the PFProducer and set the LeafCandidate::m_state.vertex_ data-member to the return value of the PFCandidate::vertex() function directly in the PFProducer. [*] const math::XYZPoint& PFCandidate::vertex() const { |
I see. Your suggestion will add some to event size, right? If it is a minimal addition, this sounds good to me. If we don't hear objections, is it something you can help by making a PR? |
Hi Ken, I would prefer if someone else can do this change. I expect that changing the code will take only 1-2 hours of time, but unfortunately I don't have enough time for validation at the moment. |
Hi Christian. I understand. Just as a possibility, If you are available and can do some rough implementation, we can probably take it over. It's just that. we are operating with a very limited personpower, and trying to get help whenever possible. If not possible, I totally understand. |
Hi Ken, that will work. I will create a pull-request and get back to you. |
Dear Ken, here is the pull-request: #31298 I believe the code is fully implemented. I have verified that the code compiles, but I haven't tested it on a RelVal sample yet. Would be great if you could take care of that. Note that the vertex position for PFCandidates of type electron is taken from the gsfTrackRef->vertex(), which I believe is the intended behaviour, while the previous code took the vertex position of PFCandidates of type electron from the trackRef->vertex(), because the enum PFCandidate::kGSFVertex was never set (an LXR search for kGSFVertex returns nothing). I expect that the difference between gsfTrackRef->vertex() and trackRef->vertex() is small for most PFCandidates, but I just wanted to point this out, in case you do see some differences in the vertex position of PFCandidates of type electron in the validation. |
@veelken Thank you. I will take a look when I get a chance. It may have to be a couple of days later. |
Christian's branch to take over by someone: |
- set vertex position of PFCandidate in PFAlgo, PFEGammaAlgo, and PFMuonAlgo - remove vertex related member-functions from PFCandidate class (use the member-fuctions defined in the LeafCandidate base-class instead) - updated ClassDefs in classes_def.xml files accordingly
- set vertex position of PFCandidate in PFAlgo, PFEGammaAlgo, and PFMuonAlgo - remove vertex related member-functions from PFCandidate class (use the member-fuctions defined in the LeafCandidate base-class instead) - updated ClassDefs in classes_def.xml files accordingly
Fixed by #31456, can be closed. |
Hi,
I came across a 'ProductNotFound' exception when rerunning some tau reconstruction code on a ROOT file that contains a collection of PFCandidates ('particleFlowTmp' for Phase-2 HLT trigger studies).
The issue is that the reco::PFCandidate::vertex() function returns not simply a vertex position, but dereferences different types of edm::Refs, depending on the type of PFCandidate (vertexType_):
https://github.com/cms-sw/cmssw/blob/master/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc#L602-L634
This behaviour means that one must not drop the GSF electron collection and any of the muon collections from the ROOT file in case one wants to evaluate the position of the PFCandidate vertex later. I consider this to be quite a burden and wonder if this is really neccessary. Why not set the data-member (m_state.vertex_) for the vertex position in the reco::LeafCandidate base-class to the best estimate of the vertex position in the reco::PFCandidate producer code and simply return that data-member in the reco::PFCandidate::vertex() function ?
This is not an urgent issue for me personally, but I wanted to bring it to your attention, because the current behaviour of the code forces users to know all the different types of muon collections that were used as input to the PFCandidate producer and keep all those muon collections in their ROOT files, in order to analyze a collection of PFCandidates (even if they do not care about GSF electrons and muons at all).
The text was updated successfully, but these errors were encountered: