-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ele/ph mass fix #36889
ele/ph mass fix #36889
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36889/28160
|
A new Pull Request was created by @rgoldouz (Reza Goldouzian) for master. It involves the following packages:
@jpata, @cmsbuild, @clacaputo, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
} | ||
} else { | ||
math::XYZVector gamma_momentum = direction.unit() * scRef->energy(); | ||
math::XYZTLorentzVectorD p4(gamma_momentum.x(), gamma_momentum.y(), gamma_momentum.z(), scRef->energy()); | ||
newCandidate.setP4(p4); | ||
newCandidate.setMass(0); |
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.
use PolarLorentzVector. This is the internal representation of reco candidate p4
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.
Hello Slava,
The setMass function does this transformation.
https://cmssdt.cern.ch/lxr/source/DataFormats/Candidate/interface/ParticleState.h#0159
Do you mean to use,
math::PtEtaPhiMLorentzVector p4(gamma_momentum.Pt(), gamma_momentum.Eta(), gamma_momentum.Phi(), 0.0);
I could not find Pt function in math::XYZVector.
Please let me know your opinion.
Thanks,
Reza
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.
yes, I meant to replace the XYZT p4 construction and setP4;setMass with just a construction of Polar p4 followed by setP4
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.
Hi Slava,
As I mentioned, math::XYZVector does not have the Pt function. I need to recalculate it and I afraid to introduce bug there. What is wrong with using setMass function?
It does this transformation automatically using setCartesian function,
https://cmssdt.cern.ch/lxr/source/DataFormats/Candidate/interface/ParticleState.h#0159
Thanks,
Reza
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.
typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; |
are we sure we want to set the electron mass to 0.5 MeV? As far as I'm aware, all E/gamma code treats the electron as massless and has for ever (modulo this bug where it its not exactly zero due to rounding errors. Why not continue to set it to zero as was intended. Is there is a compelling use case to need to adjust the momentum such that the mass is 0.5 MeV? It seems like such a small effect which is best ignored. Otherwise, thanks for the fix Reza! |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36889/28216
|
Pull request #36889 was updated. @jpata, @cmsbuild, @clacaputo, @slava77 can you please check and sign again. |
Thanks Sam, Please let me know if you have any further comment. Thanks, |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36889/28218
|
Pull request #36889 was updated. @jpata, @cmsbuild, @clacaputo, @slava77 can you please check and sign again. |
@cmsbuild please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-36176d/22288/summary.html Comparison SummarySummary:
|
to be a bit more verbose, I think Slava's suggestion to use more precise arithmetic through |
Hi @jpata , Please let me know your opinion. Thanks, |
Perhaps something like this? math::PtEtaPhiMLorentzVector p4(gamma_momentum.rho(), gamma_momentum.eta(), gamma_momentum.phi(), 0.0);
newCandidate.setP4(p4); |
PR description:
Hello,
The electron and photon mass are not saved properly and nanoAOD users reported that many times. It is not related to nanoAOD. The problem is available in miniAOD too.
You can check the printout here
http://dalfonso.web.cern.ch/dalfonso/NANO/massDump.txt
I checked and found that the problem is not from the EGamma code but from TLorentzVector root class. I found that the TLorentz vector is set via pxpypzE for all object candidates. It seems fine but when I tested locally for a particle with pxpypzE=(1,1,1,sqrt(3)) I did not get the mass==0. You can easily reproduce it
root -l
root [1] typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D > XYZTLorentzVectorD
root [2] XYZTLorentzVectorD newP4(1,1,1,sqrt(3));
root [3] newP4.M()
(double) -2.1073424e-08
It is because of the precision problem in TLorentz vector and it is recommended to use PxPyPzM to have correct masses for low mass objects.
https://root.cern.ch/doc/master/classROOT_1_1Math_1_1PxPyPzM4D.html
So I set the electron and photon masses by hand to 0.0005 and 0 GeV , respectively.
PR validation:
I generated electron and photon up to reco level using fastsim cmsDriver command and checked the photon and electron mass before and after this fix. Wrong mass values before the fix are corrected after the fix.
please let me know if you have any question.
Thanks ,
Reza