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
Correct MTDGeomDet type problems #28590
Conversation
… of the static pointer casts in TrackerRecHit2D into dynamic reference casts
…ed, remove some code duplication
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-28590/13086
|
A new Pull Request was created by @dan131riley (Dan Riley) for master. It involves the following packages: DataFormats/TrackerRecHit2D @perrotta, @civanch, @Dr15Jones, @cvuosalo, @ianna, @mdhildreth, @cmsbuild, @kpedro88, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
Do the additional |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1 |
+upgrade |
+1
using MTDGeomDet = TrackerGeomDet; in Geometry/CommonTopologies/interface/MTDGeomDet.h
|
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 will now be reviewed by the release team before it's merged. @davidlange6, @slava77, @smuzaffar, @fabiocos, @silviodonato (and backports should be raised in the release meeting by the corresponding L2) |
@dan131riley please remove the mention to the move from static_cast's to dynamic_cast's which is still written in the PR description, for a correct reference |
@perrotta i updated the PR description and resolved the remaining conversation |
+1 |
PR description:
The
BaseTrackerRecHit
constructor implicitly assumes that theGeomDet
passed to it is aTrackerGeomDet
by doing astatic_cast
to that type:cmssw/DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h
Line 29 in 30a2ff8
Changing the
static_cast
todynamic_cast
revealed that this assumption is violated by theMTDTrackingRecHitProducer
, which passes anMTDGeomDet
here:cmssw/RecoLocalFastTime/FTLRecProducers/plugins/MTDTrackingRecHitProducer.cc
Line 120 in 30a2ff8
MTDGeomDet
does not inherit fromTrackerGeomDet
, but is instead a copy&paste copy ofTrackerGeomDet
that inherits directly fromGeomDet
:cmssw/Geometry/CommonDetUnit/interface/MTDGeomDet.h
Line 6 in 30a2ff8
This doesn't crash and isn't caught by the address sanitizer because the class layout is the same, but it is still a bug that could eventually lead to failures if the different classes evolve separately. Since
MTDGeomDet
currently has functionality identical toTrackerGeomDet
, this PR makesMTDGeomDet
a typedef forTrackerGeomDet
. If in the future additional functionality is needed inMTDGeomDet
it can be made a class that inherits fromTrackerGeomDet
. This resolves issue #28571.In addition, this PR also removes some casts that are unnecessary since
GeomDet
andGeomDetUnit
are now the same type, and makes a small change toAlignmentPositionError
inGeomDet
andTrackerGeomDet
to improve encapsulation and reduce code replication.PR validation:
A limited matrix was run with no new failures observed. This is strictly a technical fix that should have no effect on physics results.