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
Const only access to GeometricSearchTracker Geometry #3635
Conversation
Converted to be compatible with changes to geometry to only give const access to objects.
Converted to be compatible with changes to geometry to only give const access to objects.
When returning or passing a DetLayer as an argument to a member function use const.
The interface to access DetLayer classes is now always const. This commit updates the client code to match that change.
A new Pull Request was created by @Dr15Jones (Chris Jones) for CMSSW_7_1_X. Const only access to GeometricSearchTracker Geometry It involves the following packages: CalibTracker/SiStripHitEfficiency @diguida, @giamman, @lveldere, @danduggan, @rovere, @cmsbuild, @anton-a, @thspeer, @rcastello, @deguio, @slava77, @Degano, @ojeda, @nclopezo can you please review it and eventually sign? Thanks. |
@@ -37,7 +37,7 @@ using namespace std; | |||
/// Constructor | |||
MuonNavigationSchool::MuonNavigationSchool(const MuonDetLayerGeometry * muonLayout, bool enableRPC ) : theMuonDetLayerGeometry(muonLayout) { | |||
|
|||
theAllDetLayersInSystem=&muonLayout->allLayers(); | |||
theAllDetLayersInSystem=reinterpret_cast<const std::vector<const DetLayer*>*>(&muonLayout->allLayers()); |
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.
This is needed temporarily until we also update the MuonDetLayerGeometry. The problem is the code assumes MuonDetLayerGeometry and the base class agree on the type. However MuonDetLayerGeometry is using a std::vector<DetLayer*>
while the base class is now using std::vector<const DetLayer*>
. The two have the same binary layout so the conversion, although strange, is OK.
Changed the interface to MuonDetLayerGeometry to only give const access to the data it holds. This is needed to enforce thread-safety. All clients were updated to adapt to the new interface. This change is part of the GeometricSearchTracker change since MuonNavigationSchool assumes both geometry providing classes have compatible interfaces.
It turned out that updating MuonDetLayerGeometry wasn't that hard so I did it as well. The two changes are linked by MuonNavigationSchool and touch many of the same files. Therefore it is |
+1 |
I'll run some longer tests just because of the number of modifications. |
+1 |
+1 |
Geometry -- Const only access to GeometricSearchTracker Geometry
Modified the interface to GeometricSearchTracker to only give const access to the underlying geometry objects. This allows us to guarantee proper thread-safe interactions with the class.
All clients of GeometricSearchTracker were updated to be compatible with the new interface.