Skip to content
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

chore: readability-redundant-smartptr-get #4064

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Checks: >
readability-inconsistent-declaration-parameter-name,
readability-named-parameter,
readability-operators-representation,
readability-redundant-smartptr-get
HeaderFilterRegex: '.*(?<!nlohmann\/json)\.(hpp|cpp|ipp)$'
CheckOptions:
readability-operators-representation.BinaryOperators: '&&;&=;&;|;~;!;!=;||;|=;^;^='
Expand Down
1 change: 1 addition & 0 deletions CI/clang_tidy/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ limits:
"readability-inconsistent-declaration-parameter-name": 0
"readability-named-parameter": 0
"readability-operators-representation": 0
"readability-redundant-smartptr-get": 0
2 changes: 1 addition & 1 deletion Core/include/Acts/Geometry/BoundarySurfaceT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class BoundarySurfaceT {
template <class volume_t>
inline const RegularSurface& BoundarySurfaceT<volume_t>::surfaceRepresentation()
const {
return (*(m_surface.get()));
return *m_surface;
}

template <class volume_t>
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Detector/DetectorVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Acts::Vector3 Acts::Experimental::DetectorVolume::center(

const Acts::VolumeBounds& Acts::Experimental::DetectorVolume::volumeBounds()
const {
return (*m_bounds.get());
return *m_bounds;
}

std::vector<std::shared_ptr<Acts::Experimental::Portal>>&
Expand Down Expand Up @@ -195,7 +195,7 @@ void Acts::Experimental::DetectorVolume::construct(
const GeometryContext& gctx, const PortalGenerator& portalGenerator) {
// Create portals with the given generator
auto portalSurfaces =
portalGenerator(transform(gctx), *(m_bounds.get()), getSharedPtr());
portalGenerator(transform(gctx), *m_bounds, getSharedPtr());
m_portals = ObjectStore<std::shared_ptr<Portal>>(portalSurfaces);
createBoundingBox(gctx);
}
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Detector/Portal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Portal::Portal(std::shared_ptr<RegularSurface> surface)
}

const Acts::RegularSurface& Portal::surface() const {
return *m_surface.get();
return *m_surface;
}

Acts::RegularSurface& Portal::surface() {
return *m_surface.get();
return *m_surface;
}

const std::array<Acts::Experimental::ExternalNavigationDelegate, 2u>&
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Material/MaterialMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Acts::MaterialMapper::mapMaterial(State& state, const GeometryContext& gctx,

// The material interactions
m_cfg.surfaceMaterialAccumulater->accumulate(
*state.surfaceMaterialAccumulaterState.get(), assigned, emptyBinSurfaces);
*state.surfaceMaterialAccumulaterState, assigned, emptyBinSurfaces);

// The function to calculate the total material before returning
auto calculateTotalMaterial = [](RecordedMaterialTrack& rTrack) -> void {
Expand All @@ -86,7 +86,7 @@ Acts::MaterialMapper::DetectorMaterialMaps Acts::MaterialMapper::finalizeMaps(
// The surface maps
detectorMaterialMaps.first =
m_cfg.surfaceMaterialAccumulater->finalizeMaterial(
*state.surfaceMaterialAccumulaterState.get());
*state.surfaceMaterialAccumulaterState);

return detectorMaterialMaps;
}
2 changes: 1 addition & 1 deletion Core/src/Surfaces/ConeSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Vector3 ConeSurface::normal(const GeometryContext& gctx,

const ConeBounds& ConeSurface::bounds() const {
// is safe because no constructor w/o bounds exists
return (*m_bounds.get());
return *m_bounds;
}

Polyhedron ConeSurface::polyhedronRepresentation(
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Surfaces/CylinderSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ double CylinderSurface::pathCorrection(const GeometryContext& gctx,
}

const CylinderBounds& CylinderSurface::bounds() const {
return (*m_bounds.get());
return *m_bounds;
}

Polyhedron CylinderSurface::polyhedronRepresentation(
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Surfaces/DiscSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ std::string DiscSurface::name() const {

const SurfaceBounds& DiscSurface::bounds() const {
if (m_bounds) {
return (*(m_bounds.get()));
return *m_bounds;
}
return s_noBounds;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Surfaces/LineSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Vector3 LineSurface::normal(const GeometryContext& gctx, const Vector3& pos,

const SurfaceBounds& LineSurface::bounds() const {
if (m_bounds) {
return (*m_bounds.get());
return *m_bounds;
}
return s_noBounds;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Surfaces/PlaneSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ std::string PlaneSurface::name() const {

const SurfaceBounds& PlaneSurface::bounds() const {
if (m_bounds) {
return (*m_bounds.get());
return *m_bounds;
}
return s_noBounds;
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/Algorithms/Geant4/src/Geant4Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void Geant4SimulationBase::commonInitialization() {
}

G4RunManager& Geant4SimulationBase::runManager() const {
return *m_geant4Instance->runManager.get();
return *m_geant4Instance->runManager;
}

Geant4::EventStore& Geant4SimulationBase::eventStore() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ExternalAlignmentDecorator::ExternalAlignmentDecorator(
: m_cfg(cfg), m_logger(std::move(logger)) {
if (m_cfg.trackingGeometry != nullptr) {
// parse and populate
parseGeometry(*m_cfg.trackingGeometry.get());
parseGeometry(*m_cfg.trackingGeometry);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ ProtoLayerCreatorT<detector_element_t>::centralProtoLayers(
m_cfg.centralModuleFrontsideStereo.at(icl) != 0.) {
// twist by the stereo angle
double stereo = m_cfg.centralModuleFrontsideStereo.at(icl);
(*mutableModuleTransform.get()) *=
(*mutableModuleTransform) *=
Acts::AngleAxis3(-stereo, Acts::Vector3::UnitZ());
}
// count the modules
Expand Down Expand Up @@ -304,7 +304,7 @@ ProtoLayerCreatorT<detector_element_t>::centralProtoLayers(
if (!m_cfg.centralModuleBacksideStereo.empty()) {
// twist by the stereo angle
double stereoBackSide = m_cfg.centralModuleBacksideStereo.at(icl);
(*mutableModuleTransform.get()) *=
(*mutableModuleTransform) *=
Acts::AngleAxis3(-stereoBackSide, Acts::Vector3::UnitZ());
}
// Finalize the transform
Expand Down Expand Up @@ -478,7 +478,7 @@ ProtoLayerCreatorT<detector_element_t>::createProtoLayers(
// twist by the stereo angle
double stereoBackSide =
m_cfg.posnegModuleBacksideStereo.at(ipnl).at(ipnR);
(*mutableModuleTransform.get()) *=
(*mutableModuleTransform) *=
Acts::AngleAxis3(-stereoBackSide, Acts::Vector3::UnitZ());
}
// Finalize the transform
Expand Down
5 changes: 2 additions & 3 deletions Examples/Io/Csv/src/CsvTrackingGeometryWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,8 @@ void writeVolume(SurfaceWriter& sfWriter, SurfaceGridWriter& sfGridWriter,
// step down into hierarchy to process all child volumnes
if (volume.confinedVolumes()) {
for (const auto& confined : volume.confinedVolumes()->arrayObjects()) {
writeVolume(sfWriter, sfGridWriter, lvWriter, *confined.get(),
writeSensitive, writeBoundary, writeSurfaceGrid,
writeLayerVolume, geoCtx);
writeVolume(sfWriter, sfGridWriter, lvWriter, *confined, writeSensitive,
writeBoundary, writeSurfaceGrid, writeLayerVolume, geoCtx);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/Io/Json/src/JsonSurfacesWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void collectSurfaces(std::vector<SurfaceContainer::InputElement>& cSurfaces,
// Step down into hierarchy to process all child volumnes
if (volume.confinedVolumes()) {
for (const auto& confined : volume.confinedVolumes()->arrayObjects()) {
collectSurfaces(cSurfaces, *confined.get(), writeLayer, writeApproach,
collectSurfaces(cSurfaces, *confined, writeLayer, writeApproach,
writeSensitive, writeBoundary);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Plugins/DD4hep/src/DD4hepDetectorSurfaceFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Acts::DD4hepDetectorSurfaceFactory::constructSensitiveComponents(
}

// Attach surface material if present
attachSurfaceMaterial(gctx, "acts_surface_", dd4hepElement, *sSurface.get(),
attachSurfaceMaterial(gctx, "acts_surface_", dd4hepElement, *sSurface,
dd4hepDetElement->thickness(), options);
// return the surface
return {dd4hepDetElement, sSurface};
Expand Down
8 changes: 4 additions & 4 deletions Plugins/Geant4/src/Geant4Converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ std::shared_ptr<Acts::Surface> Acts::Geant4PhysicalVolumeConverter::surface(
auto orientedToGlobal = axesOriented(toGlobal, axes);
surface = Acts::Surface::makeShared<PlaneSurface>(orientedToGlobal,
std::move(bounds));
assignMaterial(*surface.get(), original, compressed);
assignMaterial(*surface, original, compressed);
return surface;
} else {
throw std::runtime_error("Can not convert 'G4Box' into forced shape.");
Expand All @@ -386,7 +386,7 @@ std::shared_ptr<Acts::Surface> Acts::Geant4PhysicalVolumeConverter::surface(
auto orientedToGlobal = axesOriented(toGlobal, axes);
surface = Acts::Surface::makeShared<PlaneSurface>(orientedToGlobal,
std::move(bounds));
assignMaterial(*surface.get(), original, compressed);
assignMaterial(*surface, original, compressed);
return surface;
} else {
throw std::runtime_error("Can not convert 'G4Trd' into forced shape.");
Expand All @@ -403,7 +403,7 @@ std::shared_ptr<Acts::Surface> Acts::Geant4PhysicalVolumeConverter::surface(
auto orientedToGlobal = axesOriented(toGlobal, axes);
surface = Acts::Surface::makeShared<PlaneSurface>(orientedToGlobal,
std::move(bounds));
assignMaterial(*surface.get(), original, compressed);
assignMaterial(*surface, original, compressed);
return surface;
} else {
throw std::runtime_error("Can not convert 'G4Trap' into forced shape.");
Expand Down Expand Up @@ -437,7 +437,7 @@ std::shared_ptr<Acts::Surface> Acts::Geant4PhysicalVolumeConverter::surface(
} else {
throw std::runtime_error("Can not convert 'G4Tubs' into forced shape.");
}
assignMaterial(*surface.get(), original, compressed);
assignMaterial(*surface, original, compressed);
return surface;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GeoModelBlueprintCreater {
throw std::runtime_error(
"GeoModelBlueprintCreater::Blueprint: No top node created");
}
return *(topNode.get());
return *topNode;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GeoModelDetectorElement : public DetectorElementBase {
// First create the detector element with a nullptr
auto detElement = std::make_shared<GeoModelDetectorElement>(
geoPhysVol, nullptr, sfTransform, thickness);
auto surface = Surface::makeShared<SurfaceType>(bounds, *detElement.get());
auto surface = Surface::makeShared<SurfaceType>(bounds, *detElement);
detElement->attachSurface(surface);
return detElement;
}
Expand Down
2 changes: 1 addition & 1 deletion Plugins/GeoModel/src/GeoModelDetectorElementITk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Acts::GeoModelDetectorElementITk::convertFromGeomodel(
detEl->physicalVolume(), nullptr, detEl->transform(gctx),
detEl->thickness(), hardware, barrelEndcap, layerWheel, etaModule,
phiModule, side);
auto surface = Surface::makeShared<surface_t>(bounds, *itkEl.get());
auto surface = Surface::makeShared<surface_t>(bounds, *itkEl);

itkEl->attachSurface(surface);
itkEl->setDatabaseEntryName(detEl->databaseEntryName());
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Json/src/SurfaceJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ void Acts::to_json(nlohmann::json& j, const Acts::Surface& surface) {
void Acts::to_json(nlohmann::json& j,
const std::shared_ptr<const Acts::Surface>& surface) {
Acts::GeometryContext gctx;
j = SurfaceJsonConverter::toJson(gctx, *(surface.get()));
j = SurfaceJsonConverter::toJson(gctx, *surface);
}

void Acts::toJson(nlohmann::json& j,
const std::shared_ptr<const Acts::Surface>& surface,
const Acts::GeometryContext& gctx) {
j = SurfaceJsonConverter::toJson(gctx, *(surface.get()));
j = SurfaceJsonConverter::toJson(gctx, *surface);
}

std::shared_ptr<Acts::Surface> Acts::SurfaceJsonConverter::fromJson(
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void testProtoLayer() {
auto addSurface =
Surface::makeShared<PlaneSurface>(Transform3::Identity(), rB);

pLayerSf.add(tgContext, *addSurface.get());
pLayerSf.add(tgContext, *addSurface);
// CHECK That if you now have 5 surfaces
BOOST_CHECK_EQUAL(pLayerSf.surfaces().size(), 5);

Expand Down
1 change: 1 addition & 0 deletions Tests/UnitTests/Core/TrackFitting/FitterTestsCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Acts/MagneticField/ConstantBField.hpp"
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Propagator/Navigator.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/StraightLineStepper.hpp"
#include "Acts/Surfaces/CurvilinearSurface.hpp"
#include "Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp"
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Plugins/Geant4/Geant4DetectorElementTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ BOOST_AUTO_TEST_CASE(Geant4DetectorElement_construction) {
auto rSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
rTransform, std::move(rBounds));
// A detector element
Acts::Geant4DetectorElement g4DetElement(rSurface, *g4physVol.get(),
rTransform, 0.1);
Acts::Geant4DetectorElement g4DetElement(rSurface, *g4physVol, rTransform,
0.1);

BOOST_CHECK_EQUAL(g4DetElement.thickness(), 0.1);
BOOST_CHECK_EQUAL(&g4DetElement.surface(), rSurface.get());
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(TGeoParser_Pixel) {
ObjVisualization3D objVis;
for (auto& snode : tgpState.selectedNodes) {
const auto& shape = *(snode.node->GetVolume()->GetShape());
const auto& transform = *(snode.transform.get());
const auto& transform = *snode.transform;
auto [surface, thickness] =
TGeoSurfaceConverter::toSurface(shape, transform, axes, scale);
GeometryView3D::drawSurface(objVis, *surface, tgContext);
Expand Down Expand Up @@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(TGeoParser_Pixel_SelectInnermost) {
ObjVisualization3D objVis;
for (auto& snode : tgpState.selectedNodes) {
const auto& shape = *(snode.node->GetVolume()->GetShape());
const auto& transform = *(snode.transform.get());
const auto& transform = *snode.transform;
auto [surface, thickness] = TGeoSurfaceConverter::toSurface(
shape, transform, axes, tgpOptions.unit);
GeometryView3D::drawSurface(objVis, *surface, tgContext);
Expand Down
Loading