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
RPCRecHits nan protection #18955
RPCRecHits nan protection #18955
Conversation
A new Pull Request was created by @jhgoh (Junghwan John Goh) for master. It involves the following packages: RecoLocalMuon/RPCRecHit @perrotta, @cmsbuild, @slava77, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@cmsbuild please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@@ -26,11 +26,11 @@ int RPCCluster::bx() const { return bunchx; } | |||
|
|||
bool RPCCluster::hasTime() const { return nTime > 0; } | |||
float RPCCluster::time() const { return hasTime() ? sumTime/nTime : 0; } | |||
float RPCCluster::timeRMS() const { return hasTime() ? sqrt((sumTime2*nTime - sumTime*sumTime)/nTime) : -1; } | |||
float RPCCluster::timeRMS() const { return hasTime() ? sqrt(std::max(0.F, sumTime2*nTime - sumTime*sumTime)/nTime) : -1; } |
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.
Is the problem appearing only for n=1?
It seems more appropriate to handle n=1 case explicitly.
Furthermore, applicable to yRMS as well as timeRMS: these are supposed to correspond to estimated rec hit y and t uncertainties.
- I expect that the formula should be
sqrt( 1/(n - 1) * ( sumTime2 - sumTime*sumTime/n ) )
from the unbiased estimator of the variance. There is 1/(n-1) term missing.- more hits should give a better cluster estimation, while the current formula e.g. for time mean = 0 gives a plain sqrt(sumTime2) which keeps growing.
Then, in addition, I do not see where the uncertainty of a single time or y measurement is added. Current version gives timeRMS = 0 in this case.
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.
There was typo and the formula simply got wrong. Fixing it now.
Pull request #18955 was updated. @perrotta, @cmsbuild, @slava77, @davidlange6 can you please check and sign again. |
@slava77 Thank you for comment. It turned out the the parenthesis were place at wrong place in the previous version. Regarding on adding 1/(n-1) factor, I would like to keep it unchanged for now. |
@cmsbuild please test |
@jhgoh please confirm that max(0, is needed only in cases of numerical round-off (a few printouts would help). |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@slava77
|
On 5/28/17 4:03 AM, Junghwan John Goh wrote:
@slava77 <https://github.com/slava77>
I confirm that the nan issue comes from the numerical truncation - there
are some entries with small negative value.
|CHECKTIME -1.165753 0.000000
please clarify what is printed (perhaps just point me to the diff with
printouts on github)
Thank you.
… CHECKTIME 3.279032 -0.000005
CHECKTIME
1.504020 0.000000 CHECKTIME 1.045554 0.000000 CHECKTIME -1.314781
0.000000 CHECKTIME -3.226450 0.000003 CHECKTIME 0.904386 0.000000
CHECKTIME 0.461982 0.000000 CHECKTIME 1.686430 0.000000 CHECKTIME
-1.354682 0.000000 CHECKTIME 0.047267 -0.000000 |
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18955 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/AEdcbiOwSg89rlSsEtRKZ5I49FtnLOCFks5r-VSGgaJpZM4NnEpX>.
|
For the print out,
And the same for the bugfixed one
Time average and rms are printed out, diff before the fix(left) and after the fix(right)
Is this clear? |
On 5/28/17 6:48 AM, Junghwan John Goh wrote:
Is this clear?
yes
thank you
|
With some debug I verified that the fix is needed because those RPCClusters, made up from nearby RPC digis, could:
The two situations above represent the vast majority of RPCClusters, as seen in my debug session. Those RPCCluster's are made inside RPCClusterizer.cc. Now, I have two questions for the experts:
|
@perrotta for the 2nd question - yes, there are digis with time but without y. |
It is possible to have digis with hasTime()=true, but with (hasY()=false). An additional upgrade is foreseen for 2023, by adding a completely new chambers in stations RE3/1 and RE4/1. These chambers (RE3/1 and RE4/1) would provide precise timing (i.e. hasTime()=true) and Y coordinate (hasY()=true). So, both the systems would co-exist (one with Y coordinate and one without Y coordinate), both with precise time. |
On 5/29/17 3:19 AM, perrotta wrote:
# be formed by one single digi, and in that case obviously rms is zero
modulo some possible rund-off
the single time measurement uncertainty is ignored,
which is rather unphysical by itself (given that this RMS is used to
assign the rechit time uncertainty).
Hence, the RMS=0 which has a somewhat limited meaning.
|
Thank you all for the explanations. Then, if I understand it correctly, also having clusters made of several digis with identical time/y is also an expected feature of the system: correct? @jhgoh , just to know about your plans: do you plan to add in quadrature some fixed uncertainty, which is basically the suggestion made in #18955 (comment) in order to have something more physical for the recHit uncertainties? If so, we'll wait for it before approving; otherwise, well keep the fix as such and sign this one, even if the meaning of these uncertainties remain rather limited, as also Slava said. Please clarify. |
I would like to keep this codes even though the quantity has limited meaning. If we introduce fixed numbers here, maybe we have to tune them sometime. But it is a free parameter of simulation until we finalize actual hardware performance. |
+1 |
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 requires discussion in the ORP meeting before it's merged. @davidlange6, @smuzaffar |
+1 |
(modified) RMS of timing in the RPC local reconstruction had bug in the fomula and gave nan values.
This PR fixes fomula, but also forces the variance to have non-negative value, protect from possible crash or undefined behaviour.
We found unphysical peak at time=0 in the phase-II RPCRecHit validation and this must be linked with this problem.
(https://cmsweb.cern.ch/dqm/relval/plotfairy/archive/1/RelValSingleMuPt100Extended/CMSSW_9_1_1-91X_upgrade2023_realistic_v1_D17-v1/DQMIO/RPC/RPCRecHitV/SimVsReco/HitProperty/RecHitTimeBarrel?session=0vLmrp;v=1495479251889465704;w=924;h=715)
With the limited number of events, the peak is disappeared after the fix (red=before, blue=after).
The current data taking is not affected. The timing information is filled only for the phase-II upgrade.
@bapavlov @mileva