Skip to content

Commit

Permalink
chore: Sonar fixes after detector refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Dec 9, 2024
1 parent 255c81e commit cbf8f78
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Geant4MaterialRecording final : public Geant4SimulationBase {
/// Algorithm execute method, called once per event with context
///
/// @param ctx the AlgorithmContext for this event
ProcessCode execute(const ActsExamples::AlgorithmContext& ctx) const final;
ProcessCode execute(const ActsExamples::AlgorithmContext& ctx) const override;

/// Readonly access to the configuration
const Config& config() const final { return m_cfg; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include "ActsExamples/DetectorCommons/Detector.hpp"
#include "ActsExamples/GenericDetector/GenericDetector.hpp"

#include <cstddef>

namespace ActsExamples {

class InternallyAlignedDetectorElement;
Expand All @@ -24,11 +22,11 @@ class AlignedDetector : public Detector {
public:
struct Config : public GenericDetector::Config {
/// Seed for the decorator random numbers.
std::size_t seed = 1324354657;
unsigned int seed = 1324354657;
/// Size of a valid IOV.
std::size_t iovSize = 100;
unsigned int iovSize = 100;
/// Span until garbage collection is active.
std::size_t flushSize = 200;
unsigned int flushSize = 200;
/// Run the garbage collection?
bool doGarbageCollection = true;
/// Sigma of the in-plane misalignment
Expand All @@ -46,8 +44,6 @@ class AlignedDetector : public Detector {

enum class Mode { Internal, External };
Mode mode = Mode::Internal;

std::shared_ptr<const Acts::IMaterialDecorator> materialDecorator;
};

explicit AlignedDetector(const Config& cfg);
Expand Down
38 changes: 19 additions & 19 deletions Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ std::unique_ptr<dd4hep::Detector> DD4hepDetector::buildDD4hepGeometry() const {

std::unique_ptr<dd4hep::Detector> detector =
dd4hep::Detector::make_unique(m_cfg.name);
for (auto& file : m_cfg.xmlFileNames) {
detector->fromCompact(file.c_str());
for (const auto& file : m_cfg.xmlFileNames) {
detector->fromCompact(file);
}
detector->volumeManager();
detector->apply("DD4hepVolumeManager", 0, nullptr);
Expand All @@ -106,7 +106,7 @@ void ActsExamples::sortFCChhDetElements(std::vector<dd4hep::DetElement>& det) {
std::vector<dd4hep::DetElement> eCal;
std::vector<dd4hep::DetElement> hCal;
std::vector<dd4hep::DetElement> muon;
for (auto& detElement : det) {
for (const auto& detElement : det) {
std::string detName = detElement.name();
if (detName.find("Muon") != std::string::npos) {
muon.push_back(detElement);
Expand All @@ -118,22 +118,22 @@ void ActsExamples::sortFCChhDetElements(std::vector<dd4hep::DetElement>& det) {
tracker.push_back(detElement);
}
}
sort(muon.begin(), muon.end(),
[](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
sort(eCal.begin(), eCal.end(),
[](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
sort(hCal.begin(), hCal.end(),
[](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
sort(tracker.begin(), tracker.end(),
[](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
std::ranges::sort(
muon, [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
std::ranges::sort(
eCal, [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
std::ranges::sort(
hCal, [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
std::ranges::sort(
tracker, [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
return (a.id() < b.id());
});
det.clear();
det = tracker;

Expand Down

0 comments on commit cbf8f78

Please sign in to comment.