Fix include order#4298
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe PR standardizes C++ include organization, numeric limit usage, and class initialization across 44 files spanning reconstruction, calibration, generator, and simulation code. Changes replace legacy floating-point constants with ChangesRepository-wide nonfunctional cleanup
Possibly Related PRs
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
offline/packages/trackbase/ResidualOutlierFinder.h (1)
27-32:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftRaw ROOT object allocations lack RAII semantics and expose memory lifetime risks.
Lines 27, 29, and 31–32 use bare
newto initializehChi2,hDistance, andtreewithin the struct definition, with no correspondingdeletein a destructor or RAII wrapper (e.g.,std::unique_ptr). BecauseResidualOutlierFinderdefines no explicit destructor or deleted copy/move operations, default memberwise copying/moving will occur, creating double-delete and use-after-free hazards.Define an explicit destructor to clean up these pointers, or wrap them in appropriate RAII containers (
std::unique_ptr<TH2F>,std::unique_ptr<TNtuple>, or a smart ROOT manager class if available).Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c285fbb4-691d-46a3-a023-81a329ace7e9
📒 Files selected for processing (42)
calibrations/tpc/dEdx/dEdxFitter.hgenerators/flowAfterburner/flowAfterburner.hgenerators/sHijing/xml_test.ccoffline/QA/KFParticle/QAKFParticle.hoffline/database/cdbobjects/CDBTTree.ccoffline/packages/KFParticle_sPHENIX/KFParticle_Tools.ccoffline/packages/PHGenFitPkg/PHGenFit/Fitter.hoffline/packages/TruthNeutralMesonFinder/TruthNeutralMesonv1.hoffline/packages/bcolumicount/StreamingBcoLumiReco.ccoffline/packages/bcolumicount/StreamingBcoLumiReco.hoffline/packages/globalvertex/GlobalVertexMap.hoffline/packages/globalvertex/GlobalVertexReco.hoffline/packages/mvtx/MvtxCombinedRawDataDecoder.ccoffline/packages/mvtx/MvtxCombinedRawDataDecoder.hoffline/packages/tpc/TrainingHitsContainer.hoffline/packages/trackbase/ActsGeometry.ccoffline/packages/trackbase/MvtxEventInfov1.hoffline/packages/trackbase/MvtxEventInfov2.hoffline/packages/trackbase/MvtxEventInfov3.hoffline/packages/trackbase/ResidualOutlierFinder.hoffline/packages/trackbase/SpacePoint.hoffline/packages/trackbase/TrkrClusterv2.hoffline/packages/trackbase/TrkrClusterv3.hoffline/packages/trackbase/TrkrClusterv4.hoffline/packages/trackbase/TrkrClusterv5.hoffline/packages/trackbase/TrkrClusterv6.hoffline/packages/trackbase_historic/SvtxTrackSeed_v2.hoffline/packages/trackbase_historic/TrackAnalysisUtils.ccoffline/packages/trackbase_historic/TrackInfoContainer_v3.hoffline/packages/trackreco/ALICEKF.hoffline/packages/trackreco/PHActsGSF.ccoffline/packages/trackreco/PHActsTrackProjection.hoffline/packages/uspin/SpinDBNode.ccsimulation/g4simulation/g4eval/compressor_generator.hsimulation/g4simulation/g4eval/g4evalfn.ccsimulation/g4simulation/g4gdml/PHG4GDMLWrite.hhsimulation/g4simulation/g4gdml/PHG4GDMLWriteDefine.hhsimulation/g4simulation/g4gdml/PHG4GDMLWriteMaterials.hhsimulation/g4simulation/g4gdml/PHG4GDMLWriteSolids.hhsimulation/g4simulation/g4gdml/PHG4GDMLWriteStructure.hhsimulation/g4simulation/g4mvtx/PHG4MvtxDisplayAction.ccsimulation/g4simulation/g4tpc/PHG4TpcPadPlane.h
💤 Files with no reviewable changes (1)
- offline/packages/mvtx/MvtxCombinedRawDataDecoder.cc



Types of changes
What kind of change does this PR introduce? (Bug fix, feature, ...)
We had a bunch of sources where the include order was not correct, include "" before include <>: https://wiki.sphenix.bnl.gov/index.php?title=Codingconventions#Include_Files which can lead to very hard to debug problems when using private builds. This touched a few files which fail clang-tidy, I don't expect this PR to succeed on the first try
TODOs (if applicable)
Links to other PRs in macros and calibration repositories (if applicable)
Summary
This pull request addresses include-file ordering issues and modernizes member initialization across 37 source and header files to comply with the repository's coding convention (placing project-local includes before system/third-party includes) and resolve clang-tidy failures that occurred when using private builds.
Key Changes
Include Order Refactoring:
"") before system/external includes (angled<>), affecting files across calibration, generator, offline packages, and simulation modulesMember Initialization Modernization:
{}) with defaulted destructors (= default) in several classes (GlobalVertexMap, TrainingHitsContainer, others)= nullptr) to brace initialization ({nullptr}) for consistencyStandard Library Header Updates:
<climits>to<limits>and replacedFLT_MAXusage withstd::numeric_limits<float>::max()in KFParticle_Tools.cc and related headersTH1.h) to StreamingBcoLumiReco.ccCode Cleanup:
Init()andEnd()method overrides from MvtxCombinedRawDataDecoder that unconditionally returnedEVENT_OKInclude Path Modernization:
RtypesCore.h,PHG4DisplayAction.h)Potential Risk Areas
Init()andEnd()overrides assumes default behavior is acceptable; confirm no derived classes depend on these method signatures<climits>to<limits>and usingstd::numeric_limitsshould be functionally equivalent but may affect compilation on non-standard platforms= defaultare functionally equivalent to previous forms but may interact differently with move semantics or copy operations in edge casesNotes
The AI-generated change summaries may contain errors in interpretation. Manual verification of include dependency chains and method removal impacts is recommended before merging.
Possible Future Improvements
std::numeric_limits) in place of platform-specific macros