Skip to content

Refactor codebase to use modern C++ language features - #107

Merged
jbeirer merged 1 commit into
mainfrom
main-modernizeLib
Jul 9, 2026
Merged

Refactor codebase to use modern C++ language features#107
jbeirer merged 1 commit into
mainfrom
main-modernizeLib

Conversation

@jbeirer

@jbeirer jbeirer commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR refactors the FastCaloSim codebase to consistently use modern C++ language features without changing its intended behaviour.

The changes are primarily mechanical and focus on improving code readability, consistency, and maintainability.

Main changes

  • Replace typedef with using aliases.
  • Use auto and trailing return types where appropriate.
  • Default constructors and destructors where possible.
  • Add or simplify override declarations.
  • Replace legacy constructs such as NULL with nullptr.
  • Replace while (1) with while (true).
  • Apply a number of small consistency improvements across the codebase.

These updates span multiple components, including the core library, geometry, transport, and tests.

Notes

This PR is intended to be a non-functional refactoring. No changes to the physics behaviour or public interfaces are expected.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 244 files, which is 94 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 33e87433-4d2e-4475-96d6-99b1dc1a93d6

📥 Commits

Reviewing files that changed from the base of the PR and between 161a471 and ac9d57e.

📒 Files selected for processing (244)
  • CMakeLists.txt
  • include/FastCaloSim/Core/DoubleArray.h
  • include/FastCaloSim/Core/ISF_FastCaloSimEventDict.h
  • include/FastCaloSim/Core/IntArray.h
  • include/FastCaloSim/Core/MLogging.h
  • include/FastCaloSim/Core/TFCS1DFunction.h
  • include/FastCaloSim/Core/TFCS1DFunctionHistogram.h
  • include/FastCaloSim/Core/TFCS1DFunctionInt16Histogram.h
  • include/FastCaloSim/Core/TFCS1DFunctionInt32Histogram.h
  • include/FastCaloSim/Core/TFCS1DFunctionRegression.h
  • include/FastCaloSim/Core/TFCS1DFunctionRegressionTF.h
  • include/FastCaloSim/Core/TFCS1DFunctionSpline.h
  • include/FastCaloSim/Core/TFCS1DFunctionTemplateHelpers.h
  • include/FastCaloSim/Core/TFCS1DFunctionTemplateHistogram.h
  • include/FastCaloSim/Core/TFCS1DFunctionTemplateInterpolationHistogram.h
  • include/FastCaloSim/Core/TFCS2DFunction.h
  • include/FastCaloSim/Core/TFCS2DFunctionHistogram.h
  • include/FastCaloSim/Core/TFCS2DFunctionLateralShapeParametrization.h
  • include/FastCaloSim/Core/TFCS2DFunctionTemplateHistogram.h
  • include/FastCaloSim/Core/TFCS2DFunctionTemplateInterpolationExpHistogram.h
  • include/FastCaloSim/Core/TFCS2DFunctionTemplateInterpolationHistogram.h
  • include/FastCaloSim/Core/TFCSBinnedShower.h
  • include/FastCaloSim/Core/TFCSBinnedShowerBase.h
  • include/FastCaloSim/Core/TFCSBinnedShowerONNX.h
  • include/FastCaloSim/Core/TFCSCenterPositionCalculation.h
  • include/FastCaloSim/Core/TFCSEnergyAndHitGANV2.h
  • include/FastCaloSim/Core/TFCSEnergyBinParametrization.h
  • include/FastCaloSim/Core/TFCSEnergyInterpolationHistogram.h
  • include/FastCaloSim/Core/TFCSEnergyInterpolationLinear.h
  • include/FastCaloSim/Core/TFCSEnergyInterpolationPiecewiseLinear.h
  • include/FastCaloSim/Core/TFCSEnergyInterpolationSpline.h
  • include/FastCaloSim/Core/TFCSEnergyParametrization.h
  • include/FastCaloSim/Core/TFCSEnergyRenormalization.h
  • include/FastCaloSim/Core/TFCSExtrapolationState.h
  • include/FastCaloSim/Core/TFCSFlatLateralShapeParametrization.h
  • include/FastCaloSim/Core/TFCSFunction.h
  • include/FastCaloSim/Core/TFCSGANEtaSlice.h
  • include/FastCaloSim/Core/TFCSGANLWTNNHandler.h
  • include/FastCaloSim/Core/TFCSGANXMLParameters.h
  • include/FastCaloSim/Core/TFCSHistoLateralShapeGausLogWeight.h
  • include/FastCaloSim/Core/TFCSHistoLateralShapeGausLogWeightHitAndMiss.h
  • include/FastCaloSim/Core/TFCSHistoLateralShapeParametrization.h
  • include/FastCaloSim/Core/TFCSHistoLateralShapeParametrizationFCal.h
  • include/FastCaloSim/Core/TFCSHistoLateralShapeWeight.h
  • include/FastCaloSim/Core/TFCSHistoLateralShapeWeightHitAndMiss.h
  • include/FastCaloSim/Core/TFCSHitCellMapping.h
  • include/FastCaloSim/Core/TFCSHitCellMappingFCal.h
  • include/FastCaloSim/Core/TFCSHitCellMappingWiggle.h
  • include/FastCaloSim/Core/TFCSHitCellMappingWiggleEMB.h
  • include/FastCaloSim/Core/TFCSInitWithEkin.h
  • include/FastCaloSim/Core/TFCSInvisibleParametrization.h
  • include/FastCaloSim/Core/TFCSLateralShapeParametrization.h
  • include/FastCaloSim/Core/TFCSLateralShapeParametrizationFixedHitChain.h
  • include/FastCaloSim/Core/TFCSLateralShapeParametrizationFluctChain.h
  • include/FastCaloSim/Core/TFCSLateralShapeParametrizationHitBase.h
  • include/FastCaloSim/Core/TFCSLateralShapeParametrizationHitChain.h
  • include/FastCaloSim/Core/TFCSLateralShapeParametrizationHitNumberFromE.h
  • include/FastCaloSim/Core/TFCSLateralShapeTuning.h
  • include/FastCaloSim/Core/TFCSMLCalorimeterSimulator.h
  • include/FastCaloSim/Core/TFCSNetworkFactory.h
  • include/FastCaloSim/Core/TFCSONNXHandler.h
  • include/FastCaloSim/Core/TFCSPCAEnergyParametrization.h
  • include/FastCaloSim/Core/TFCSParametrization.h
  • include/FastCaloSim/Core/TFCSParametrizationAbsEtaSelectChain.h
  • include/FastCaloSim/Core/TFCSParametrizationBase.h
  • include/FastCaloSim/Core/TFCSParametrizationBinnedChain.h
  • include/FastCaloSim/Core/TFCSParametrizationChain.h
  • include/FastCaloSim/Core/TFCSParametrizationChain.icc
  • include/FastCaloSim/Core/TFCSParametrizationEbinChain.h
  • include/FastCaloSim/Core/TFCSParametrizationEkinSelectChain.h
  • include/FastCaloSim/Core/TFCSParametrizationEtaSelectChain.h
  • include/FastCaloSim/Core/TFCSParametrizationFloatSelectChain.h
  • include/FastCaloSim/Core/TFCSParametrizationPDGIDSelectChain.h
  • include/FastCaloSim/Core/TFCSParametrizationPlaceholder.h
  • include/FastCaloSim/Core/TFCSPhiModulationCorrection.h
  • include/FastCaloSim/Core/TFCSPredictExtrapWeights.h
  • include/FastCaloSim/Core/TFCSSimpleLWTNNHandler.h
  • include/FastCaloSim/Core/TFCSSimulationState.h
  • include/FastCaloSim/Core/TFCSTruthState.h
  • include/FastCaloSim/Core/TFCSVoxelHistoLateralCovarianceFluctuations.h
  • include/FastCaloSim/Core/VNetworkBase.h
  • include/FastCaloSim/Core/VNetworkLWTNN.h
  • include/FastCaloSim/Definitions/ParticleData.h
  • include/FastCaloSim/Extrapolation/FastCaloSimCaloExtrapolation.h
  • include/FastCaloSim/Geometry/Cell.h
  • include/FastCaloSim/Geometry/CellStore.h
  • include/FastCaloSim/Geometry/MeanAndRMS.h
  • include/FastCaloSim/Geometry/RTree.h
  • include/FastCaloSim/Geometry/RTreeBuilder.h
  • include/FastCaloSim/Geometry/RTreeHelpers.h
  • include/FastCaloSim/Geometry/RTreeQuery.h
  • include/FastCaloSim/LinkDef.h
  • include/FastCaloSim/Transport/G4CaloTransportTool.h
  • param/CMakeLists.txt
  • param/include/FastCaloSimParam/LinkDef.h
  • param/source/CMakeLists.txt
  • source/Core/CMakeLists.txt
  • source/Core/DoubleArray.cxx
  • source/Core/IntArray.cxx
  • source/Core/MLogging.cxx
  • source/Core/TFCS1DFunction.cxx
  • source/Core/TFCS1DFunctionHistogram.cxx
  • source/Core/TFCS1DFunctionInt16Histogram.cxx
  • source/Core/TFCS1DFunctionInt32Histogram.cxx
  • source/Core/TFCS1DFunctionRegression.cxx
  • source/Core/TFCS1DFunctionRegressionTF.cxx
  • source/Core/TFCS1DFunctionSpline.cxx
  • source/Core/TFCS1DFunctionTemplateHelpers.cxx
  • source/Core/TFCS1DFunctionTemplateHistogram.cxx
  • source/Core/TFCS1DFunctionTemplateInterpolationHistogram.cxx
  • source/Core/TFCS2DFunction.cxx
  • source/Core/TFCS2DFunctionHistogram.cxx
  • source/Core/TFCS2DFunctionLateralShapeParametrization.cxx
  • source/Core/TFCS2DFunctionTemplateHistogram.cxx
  • source/Core/TFCS2DFunctionTemplateInterpolationExpHistogram.cxx
  • source/Core/TFCS2DFunctionTemplateInterpolationHistogram.cxx
  • source/Core/TFCSBinnedShower.cxx
  • source/Core/TFCSBinnedShowerBase.cxx
  • source/Core/TFCSBinnedShowerONNX.cxx
  • source/Core/TFCSCenterPositionCalculation.cxx
  • source/Core/TFCSEnergyAndHitGANV2.cxx
  • source/Core/TFCSEnergyBinParametrization.cxx
  • source/Core/TFCSEnergyInterpolationHistogram.cxx
  • source/Core/TFCSEnergyInterpolationLinear.cxx
  • source/Core/TFCSEnergyInterpolationPiecewiseLinear.cxx
  • source/Core/TFCSEnergyInterpolationSpline.cxx
  • source/Core/TFCSEnergyParametrization.cxx
  • source/Core/TFCSEnergyRenormalization.cxx
  • source/Core/TFCSExtrapolationState.cxx
  • source/Core/TFCSFlatLateralShapeParametrization.cxx
  • source/Core/TFCSFunction.cxx
  • source/Core/TFCSGANEtaSlice.cxx
  • source/Core/TFCSGANLWTNNHandler.cxx
  • source/Core/TFCSGANXMLParameters.cxx
  • source/Core/TFCSHistoLateralShapeGausLogWeight.cxx
  • source/Core/TFCSHistoLateralShapeGausLogWeightHitAndMiss.cxx
  • source/Core/TFCSHistoLateralShapeParametrization.cxx
  • source/Core/TFCSHistoLateralShapeParametrizationFCal.cxx
  • source/Core/TFCSHistoLateralShapeWeight.cxx
  • source/Core/TFCSHistoLateralShapeWeightHitAndMiss.cxx
  • source/Core/TFCSHitCellMapping.cxx
  • source/Core/TFCSHitCellMappingFCal.cxx
  • source/Core/TFCSHitCellMappingWiggle.cxx
  • source/Core/TFCSHitCellMappingWiggleEMB.cxx
  • source/Core/TFCSInitWithEkin.cxx
  • source/Core/TFCSInvisibleParametrization.cxx
  • source/Core/TFCSLateralShapeParametrization.cxx
  • source/Core/TFCSLateralShapeParametrizationFixedHitChain.cxx
  • source/Core/TFCSLateralShapeParametrizationFluctChain.cxx
  • source/Core/TFCSLateralShapeParametrizationHitBase.cxx
  • source/Core/TFCSLateralShapeParametrizationHitChain.cxx
  • source/Core/TFCSLateralShapeParametrizationHitNumberFromE.cxx
  • source/Core/TFCSLateralShapeTuning.cxx
  • source/Core/TFCSMLCalorimeterSimulator.cxx
  • source/Core/TFCSNetworkFactory.cxx
  • source/Core/TFCSONNXHandler.cxx
  • source/Core/TFCSPCAEnergyParametrization.cxx
  • source/Core/TFCSParametrization.cxx
  • source/Core/TFCSParametrizationAbsEtaSelectChain.cxx
  • source/Core/TFCSParametrizationBase.cxx
  • source/Core/TFCSParametrizationBinnedChain.cxx
  • source/Core/TFCSParametrizationChain.cxx
  • source/Core/TFCSParametrizationEbinChain.cxx
  • source/Core/TFCSParametrizationEkinSelectChain.cxx
  • source/Core/TFCSParametrizationEtaSelectChain.cxx
  • source/Core/TFCSParametrizationFloatSelectChain.cxx
  • source/Core/TFCSParametrizationPDGIDSelectChain.cxx
  • source/Core/TFCSParametrizationPlaceholder.cxx
  • source/Core/TFCSPhiModulationCorrection.cxx
  • source/Core/TFCSPredictExtrapWeights.cxx
  • source/Core/TFCSSimpleLWTNNHandler.cxx
  • source/Core/TFCSSimulationState.cxx
  • source/Core/TFCSTruthState.cxx
  • source/Core/TFCSVoxelHistoLateralCovarianceFluctuations.cxx
  • source/Core/VNetworkBase.cxx
  • source/Core/VNetworkLWTNN.cxx
  • source/Definitions/CMakeLists.txt
  • source/Definitions/ParticleData.cxx
  • source/Extrapolation/CMakeLists.txt
  • source/Extrapolation/FastCaloSimCaloExtrapolation.cxx
  • source/Geometry/CMakeLists.txt
  • source/Geometry/RTree.cxx
  • source/Geometry/RTreeBuilder.cxx
  • source/Geometry/RTreeQuery.cxx
  • source/Transport/CMakeLists.txt
  • source/Transport/G4CaloTransportTool.cxx
  • test/CMakeLists.txt
  • test/TestConfig/AtlasGeoTestsConfig.h
  • test/TestConfig/AtlasSimTestsConfig.h
  • test/TestConfig/AtlasTransportTestsConfig.h
  • test/TestConfig/BasicSimTestsConfig.h
  • test/TestConfig/G4RunTestsConfig.h
  • test/TestHelpers/Container.h
  • test/TestHelpers/Event.h
  • test/TestHelpers/ExtrapStateContainer.h
  • test/TestHelpers/GeoPluginLoader.h
  • test/TestHelpers/IDCaloBoundary.h
  • test/TestHelpers/IOManager.h
  • test/TestHelpers/JsonComparer.h
  • test/TestHelpers/MagFieldPlugin.h
  • test/TestHelpers/Particle.h
  • test/TestHelpers/ParticleContainer.h
  • test/TestHelpers/ParticleSimParams.h
  • test/TestHelpers/ParticleTypes.h
  • test/TestHelpers/SimStateContainer.h
  • test/TestHelpers/Track.h
  • test/TestHelpers/TrackContainer.h
  • test/TestPlugins/ATLAS/ATLASFCalGeoPlugin/CMakeLists.txt
  • test/TestPlugins/ATLAS/ATLASFCalGeoPlugin/include/ATLASFCalGeoPlugin/FCAL_ChannelMap.h
  • test/TestPlugins/ATLAS/ATLASMagneticFieldMapPlugin/CMakeLists.txt
  • test/g4app/CMakeLists.txt
  • test/g4app/include/ActionInitialization.hh
  • test/g4app/include/DetectorConstruction.hh
  • test/g4app/include/EventAction.hh
  • test/g4app/include/FastSimModel.hh
  • test/g4app/include/PrimaryGeneratorAction.hh
  • test/g4app/include/RunAction.hh
  • test/g4app/src/ActionInitialization.cc
  • test/g4app/src/DetectorConstruction.cc
  • test/g4app/src/EventAction.cc
  • test/g4app/src/FastSimModel.cc
  • test/g4app/src/PrimaryGeneratorAction.cc
  • test/g4app/src/RunAction.cc
  • test/include/AtlasGeoTests.h
  • test/include/AtlasSimTests.h
  • test/include/AtlasTransportTests.h
  • test/include/BasicExtrapolTests.h
  • test/include/BasicSimTests.h
  • test/include/G4RunTests.h
  • test/include/SimStateTests.h
  • test/include/TruthStateTests.h
  • test/python/scripts/plot_extrapolation.py
  • test/python/scripts/plot_helpers.py
  • test/python/scripts/plot_simulation.py
  • test/python/scripts/plot_transport.py
  • test/source/AtlasGeoTests.cxx
  • test/source/AtlasSimTests.cxx
  • test/source/AtlasTransportTests.cxx
  • test/source/BasicExtrapolTests.cxx
  • test/source/BasicSimTests.cxx
  • test/source/SimStateTests.cxx
  • test/source/TruthStateTests.cxx
  • test/static-embed/main.cxx
  • test/static-embed/probe.cxx

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch main-modernizeLib

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added tests Issues affecting the CI tests cmake labels Jul 9, 2026
@jbeirer jbeirer changed the title Modernize cpp lib code Refactor codebase to use modern C++ language features Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.99792% with 380 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...e/FastCaloSim/Core/TFCS1DFunctionTemplateHelpers.h 0.00% 35 Missing ⚠️
include/FastCaloSim/Core/TFCSParametrizationBase.h 4.16% 23 Missing ⚠️
include/FastCaloSim/Core/TFCSParametrization.h 14.28% 12 Missing ⚠️
source/Core/TFCS1DFunctionHistogram.cxx 25.00% 9 Missing ⚠️
source/Core/TFCSBinnedShower.cxx 0.00% 9 Missing ⚠️
source/Core/TFCSPhiModulationCorrection.cxx 0.00% 9 Missing ⚠️
source/Core/TFCSEnergyAndHitGANV2.cxx 0.00% 8 Missing ⚠️
...FastCaloSim/Core/TFCS1DFunctionTemplateHistogram.h 0.00% 7 Missing ⚠️
...FastCaloSim/Core/TFCS2DFunctionTemplateHistogram.h 0.00% 7 Missing ⚠️
include/FastCaloSim/Core/TFCSEnergyAndHitGANV2.h 0.00% 7 Missing ⚠️
... and 98 more
Files with missing lines Coverage Δ
include/FastCaloSim/Core/DoubleArray.h 0.00% <ø> (ø)
include/FastCaloSim/Core/IntArray.h 0.00% <ø> (ø)
include/FastCaloSim/Core/TFCS1DFunctionHistogram.h 100.00% <100.00%> (ø)
...e/FastCaloSim/Core/TFCSCenterPositionCalculation.h 50.00% <ø> (ø)
...de/FastCaloSim/Core/TFCSEnergyBinParametrization.h 100.00% <100.00%> (ø)
include/FastCaloSim/Core/TFCSExtrapolationState.h 97.67% <ø> (ø)
...CaloSim/Core/TFCSFlatLateralShapeParametrization.h 0.00% <ø> (ø)
include/FastCaloSim/Core/TFCSGANLWTNNHandler.h 0.00% <ø> (ø)
...tCaloSim/Core/TFCSHistoLateralShapeGausLogWeight.h 0.00% <ø> (ø)
...ore/TFCSHistoLateralShapeGausLogWeightHitAndMiss.h 0.00% <ø> (ø)
... and 195 more

@jbeirer
jbeirer merged commit c3f4976 into main Jul 9, 2026
17 checks passed
@jbeirer
jbeirer deleted the main-modernizeLib branch July 9, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake tests Issues affecting the CI tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant