Skip to content

Adding new variables#4285

Closed
Ishangoel11 wants to merge 6 commits into
sPHENIX-Collaboration:masterfrom
Ishangoel11:branch
Closed

Adding new variables#4285
Ishangoel11 wants to merge 6 commits into
sPHENIX-Collaboration:masterfrom
Ishangoel11:branch

Conversation

@Ishangoel11

@Ishangoel11 Ishangoel11 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

TODOs (if applicable)

Links to other PRs in macros and calibration repositories (if applicable)

Pull Request Summary: Adding TrkrClusterv6 and new TrkrCluster accessors

Motivation / context

  • Provide richer per-cluster information to support the TPC Debugger and downstream diagnostics/algorithms by introducing a concrete v6 cluster type and extending the TrkrCluster convenience interface so new per-cluster quantities are discoverable through the generic API.

Key changes

  • New concrete cluster class TrkrClusterv6
    • Files added/modified: offline/packages/trackbase/TrkrClusterv6.h, TrkrClusterv6.cc, TrkrClusterv6LinkDef.h
    • Expanded stored state: 2D local (rphi,z) position, subsurface key, adc/max/centroid fields, pad/tbin centroid and max, RPhi/Z errors, r/phi/z sizes, overlap/edge flags (multiple edge directions), SL/SR/TL/TR mix fields, phi/tbin bin low/high and phase fields, rsize metric.
    • Implements identify(), isValid(), CloneMe(), CopyFrom(...) and full accessors/setters; constructor initializes local coords to NaN and sets sensible defaults.
    • ROOT dictionary / LinkDef and ClassDefOverride added for persistence/reflection.
  • Base-class API extension
    • File modified: offline/packages/trackbase/TrkrCluster.h
    • Adds many virtual getters (e.g., getCenAdc, getPadCen, getTBinCen, getPadMax, getTBinMax, per-edge getters, SL/SR/TL/TR mix getters, phi/tbin lo/hi, pad/tbin phase, getRSize, etc.) that return sentinel defaults when not implemented.
  • Build and dictionary updates
    • File: offline/packages/trackbase/Makefile.am
    • Installs TrkrClusterv6.h and adds TrkrClusterv6.cc / TrkrClusterv6_Dict.cc to sources and ROOTDICTS.
  • Miscellaneous
    • Many whitespace/formatting and small refactors across trackbase sources; a clang-tidy fix commit was included (remove redundant inline on constexpr etc.). Reviewer comments indicate clang-tidy warnings stem from constexpr implying inline.

Potential risk areas

  • IO / persistent format
    • New persistent class and ROOT dictionary entries may affect on-disk compatibility. Verify ROOT schema/versioning and test read/write across older/newer builds; ensure dictionaries are available where needed.
  • Reconstruction behavior / API compatibility
    • Adding virtual getters increases the public virtual interface; although default sentinel returns were provided, virtual dispatch changes should be validated for existing callers.
    • TrkrClusterv6::isValid() uses NaN local coordinates and m_adc == 0xFFFF as invalid markers — confirm downstream code handles these semantics.
    • Deprecated global-coordinate accessors print to std::cout; this may produce unexpected log spam.
  • Memory, performance & threading
    • Per-cluster memory footprint increases (many additional fields) — could impact memory use and cache locality for large datasets; benchmark typical reconstruction jobs.
    • Use of std::cout for warnings is not thread-safe and may interleave in multi-threaded execution; replace with thread-aware logging where appropriate.
  • Tooling / CI
    • clang-tidy fixes are present; run repository tooling (automatic clang-tidy fixes and CI) to ensure no new warnings remain.

Possible future improvements

  • Document each new field (meaning, units, sentinel values) and update calibration/macro documentation.
  • Add unit and serialization tests for read/write compatibility and dictionary presence/absence.
  • Replace std::cout-based deprecation notices with a thread-safe, configurable logging facility.
  • Provide migration or compatibility utilities for on-disk data if required.
  • Consider compact/sparse storage (packing or optional fields) to reduce memory impact if many fields remain unused.
  • Benchmark reconstruction memory/CPU with realistic cluster loads.

Note about AI assistance

  • This summary was produced with AI assistance. The model can make mistakes; please verify implementation details (semantic intent, ClassDef/versioning, I/O compatibility, new getters’ semantics and isValid behavior) against the code and run the appropriate tests before merging.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds TrkrClusterv6: extends TrkrCluster with new virtual getters, provides a full v6 implementation (constructor, identify, isValid, CopyFrom), and integrates the new class into the package build and ROOT dictionary.

Changes

TrkrClusterv6 Variant Implementation

Layer / File(s) Summary
Base class interface extension
offline/packages/trackbase/TrkrCluster.h
TrkrCluster gains new virtual getter methods for center ADC, centroid/max pad/tbin, multiple edge getters, mixing parameters, phi/tbin bin bounds, phases, and getRSize() that return sentinel defaults (UINT_MAX, NAN, max char/int).
TrkrClusterv6 class definition
offline/packages/trackbase/TrkrClusterv6.h
New TrkrClusterv6 derives from TrkrCluster, declares constructors/Clone/Copy/identify/isValid, and provides inline getters/setters for local position, subsurf key, ADC/max/centroid, pad/tbin centroid/max, RPhi/Z errors, size/overlap/edge fields, mix params, bin ranges, phases, deprecated global accessors, backing fields, and ClassDefOverride.
TrkrClusterv6 implementation
offline/packages/trackbase/TrkrClusterv6.cc
Implements constructor (initializes members and sets m_local to NaN), identify() output, isValid() (checks NaN or ADC sentinel 0xFFFF), and CopyFrom() that delegates to base and copies all v6-specific fields via setters.
Build system and ROOT integration
offline/packages/trackbase/Makefile.am, offline/packages/trackbase/TrkrClusterv6LinkDef.h
Adds TrkrClusterv6.h to installed headers, TrkrClusterv6.cc to library sources, registers TrkrClusterv6_Dict.cc for ROOT dictionary generation, and adds a CINT-guarded #pragma link for the class.

(Additional edits in this PR: ActsGeometry neighbor-surface change and ClusterErrorPara refactor plus many formatting/include/LinkDef tweaks across trackbase; see hidden review stack artifact for ranged mapping.)

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
offline/packages/trackbase/ActsGeometry.cc

In file included from offline/packages/trackbase/ActsGeometry.cc:1:
In file included from offline/packages/trackbase/ActsGeometry.h:4:
In file included from offline/packages/trackbase/ActsSurfaceMaps.h:9:
offline/packages/trackbase/ActsTrackingGeometry.h:7:10: fatal error: 'Acts/Definitions/Algebra.hpp' file not found
7 | #include <Acts/Definitions/Algebra.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
offline/packages/trackbase/ActsGeometry.cc:57:3-10: ERROR translating statement 'ReturnStmt'
Aborting translation of method 'ActsGeometry::getGlobalPosition' in file 'offline/packages/trackbase/ActsGeometry.cc': "Assert_failure src/clang/cAst_utils.ml:249:53"
Uncaught Internal Error: "Assert_failure src/clang/cAst_utils.ml:249:53"
Error backtrace:
Raised at ClangFrontend__CAst_utils.get_decl_from_typ_ptr in file "src/clang/cAst_utils.ml", line 249, characters 53-65
Called from ClangFrontend__CTrans.CTrans_funct.get_destructor_decl_ref in file "src/clang/cTran

... [truncated 2200 characters] ...

ns.CTrans_funct.instruction_log.(fun) in file "src/clang/cTrans.ml", line 4782, characters 12-47
Re-raised at IStdlib__IExn.reraise_after in file "src/istd/IExn.ml" (inlined), line 13, characters 2-50
Called from ClangFrontend__CTrans.CTrans_funct.instruction_log.(fun) in file "src/clang/cTrans.ml", line 4784, characters 10-1023
Called from ClangFrontend__CTrans.CTrans_funct.instruction in file "src/clang/cTrans.ml" (inlined), line 4765, characters 38-71
Called from ClangFrontend__CTrans.CTrans_funct.exec_with_node_creation in file "src/clang/cTrans.ml" (inlined), line 104, characters 20-38
Called from ClangFrontend__CTrans.CTrans_funct.get_clang_stmt_trans in file "src/clang/cTrans.ml" (inlined), line 5395, characters 4-69
Called from ClangFrontend__CTrans.CTrans_funct.get_custom_stmt_tra

offline/packages/trackbase/AlignmentTransformation.cc

In file included from offline/packages/trackbase/AlignmentTransformation.cc:1:
In file included from offline/packages/trackbase/AlignmentTransformation.h:5:
In file included from offline/packages/trackbase/alignmentTransformationContainer.h:11:
In file included from offline/packages/trackbase/ActsGeometry.h:4:
In file included from offline/packages/trackbase/ActsSurfaceMaps.h:9:
offline/packages/trackbase/ActsTrackingGeometry.h:7:10: fatal error: 'Acts/Definitions/Algebra.hpp' file not found
7 | #include <Acts/Definitions/Algebra.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
offline/packages/trackbase/AlignmentTransformation.cc:502:3-10: ERROR translating statement 'ReturnStmt'
Aborting translation of method 'AlignmentTransformation::newMakeTransform' in file 'offline/packages/trackbase/AlignmentTransformation.cc': "Assert_failure src/clang/cAst_utils.ml:249:53"
Uncaught Internal Error: "Assert_failure src/clang/cAst_utils.ml:249:53"
Error backtrace:
Raise

... [truncated 2200 characters] ...

ile "src/clang/cTrans.ml", line 4866, characters 22-60
Called from ClangFrontend__CTrans.CTrans_funct.instruction_scope in file "src/clang/cTrans.ml", line 4850, characters 22-79
Called from ClangFrontend__CTrans.CTrans_funct.instruction_log.(fun) in file "src/clang/cTrans.ml", line 4782, characters 12-47
Re-raised at IStdlib__IExn.reraise_after in file "src/istd/IExn.ml" (inlined), line 13, characters 2-50
Called from ClangFrontend__CTrans.CTrans_funct.instruction_log.(fun) in file "src/clang/cTrans.ml", line 4784, characters 10-1023
Called from ClangFrontend__CTrans.CTrans_funct.instruction in file "src/clang/cTrans.ml" (inlined), line 4765, characters 38-71
Called from ClangFrontend__CTrans.CTrans_funct.exec_with_node_creation in file "src/clang/cTrans.ml" (inlined), line 104, character

offline/packages/trackbase/ClusterErrorPara.cc

In file included from offline/packages/trackbase/ClusterErrorPara.cc:1:
offline/packages/trackbase/ClusterErrorPara.h:6:10: fatal error: 'TF1.h' file not found
6 | #include <TF1.h>
| ^~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/92fb173add77d97c2d87bf43211c22936984d5b2-11102129ba01642c/tmp/clang_command_.tmp.ada209.txt
++Contents of '/tmp/coderabbit-infer/92fb173add77d97c2d87bf43211c22936984d5b2-11102129ba01642c/tmp/clang_command_.tmp.ada209.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"

... [truncated 1163 characters] ...

clude"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/11102129ba01642c/file.o" "-x" "c++"
"offline/packages/trackbase/ClusterErrorPara.cc" "-O0" "-fno-builtin"
"-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"

  • 11 others

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e308f7c3-fd1f-4f4a-b0a6-50240df0b478

📥 Commits

Reviewing files that changed from the base of the PR and between da072c1 and b2a8a47.

📒 Files selected for processing (5)
  • offline/packages/trackbase/Makefile.am
  • offline/packages/trackbase/TrkrCluster.h
  • offline/packages/trackbase/TrkrClusterv6.cc
  • offline/packages/trackbase/TrkrClusterv6.h
  • offline/packages/trackbase/TrkrClusterv6LinkDef.h

Comment on lines +82 to +105
virtual unsigned int getCenAdc() const { return UINT_MAX; }
virtual float getPadCen() const { return NAN; }
virtual float getTBinCen() const { return NAN; }
virtual float getPadMax() const { return NAN; }
virtual float getTBinMax() const { return NAN; }
virtual char getSLEdge() const { return std::numeric_limits<char>::max(); }
virtual char getSREdge() const { return std::numeric_limits<char>::max(); }
virtual char getTLEdge() const { return std::numeric_limits<char>::max(); }
virtual char getTREdge() const { return std::numeric_limits<char>::max(); }
virtual char getDLEdge() const { return std::numeric_limits<char>::max(); }
virtual char getDREdge() const { return std::numeric_limits<char>::max(); }
virtual char getHLEdge() const { return std::numeric_limits<char>::max(); }
virtual char getHREdge() const { return std::numeric_limits<char>::max(); }
virtual int getSLMix() const { return std::numeric_limits<int>::max(); }
virtual int getSRMix() const { return std::numeric_limits<int>::max(); }
virtual int getTLMix() const { return std::numeric_limits<int>::max(); }
virtual int getTRMix() const { return std::numeric_limits<int>::max(); }
virtual float getPhiBinLo() const { return NAN; }
virtual float getPhiBinHi() const { return NAN; }
virtual float getTBinLo() const { return NAN; }
virtual float getTBinHi() const { return NAN; }
virtual float getPadPhase() const { return NAN; }
virtual float getTBinPhase() const { return NAN; }
virtual float getRSize() const { return NAN; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Document ABI/API compatibility impact of the new virtual interface.

Adding these virtual getters to TrkrCluster changes the base-class vtable contract. Please include compatibility notes and required downstream rebuild/update guidance for any consumer built against older TrkrCluster headers.

As per coding guidelines, if interfaces change, ask for compatibility notes and any needed downstream updates.

Comment on lines +118 to +134
setRSize(source.getRSize());
setPhiSize(source.getPhiSize());
setZSize(source.getZSize());
setOverlap(source.getOverlap());
setEdge(source.getEdge());
setSLEdge(source.getSLEdge());
setSREdge(source.getSREdge());
setTLEdge(source.getTLEdge());
setTREdge(source.getTREdge());
setDLEdge(source.getDLEdge());
setDREdge(source.getDREdge());
setHLEdge(source.getHLEdge());
setHREdge(source.getHREdge());
setSLMix(source.getSLMix());
setSRMix(source.getSRMix());
setTLMix(source.getTLMix());
setTRMix(source.getTRMix());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Type-gate v6-only field copies to avoid invalid state propagation.

This block copies v6-only attributes from a generic TrkrCluster. For non-v6 sources, the base getters return sentinels (see TrkrCluster.h Line 95-Line 105), which then get narrowed into v6 storage (char-backed mix/size fields), corrupting copied cluster state. Please gate these assignments behind a dynamic_cast<const TrkrClusterv6*> (or explicit sentinel filtering) and reset v6-only fields when the cast fails.

As per coding guidelines, prioritize correctness, memory safety, error handling, and thread-safety.

Comment thread offline/packages/trackbase/TrkrClusterv6.h
Comment thread offline/packages/trackbase/TrkrClusterv6.h Outdated
#ifndef TRACKBASE_TRKRCLUSTERV6_H
#define TRACKBASE_TRKRCLUSTERV6_H

#include <iostream>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow our include ordering from
https://wiki.sphenix.bnl.gov/index.php?title=Codingconventions#Include_Files
it does matter here. I notice that this is a problem in other include files (e.g. v5), that should be fixed asap

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that's how it is done. TrkrCluster and TrkrDefs are local inside trackbase. iostream is in <>.

// float getPhiError() const override
//{ std::cout << "Deprecated getPhiError function"<< std::endl; return NAN;}

protected:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make members private, not protected

//{ std::cout << "Deprecated getPhiError function"<< std::endl; return NAN;}

protected:
float m_local[2]{}; //< 2D local position [cm] 2 * 32 64bit - cumul 1*64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since m_local is only size 2, you should use
float m_local[2] {std::numeric_limits::quiet_NaN(), std::numeric_limits::quiet_NaN()};
to initialize them to NAN

float m_padphase;
float m_tbinphase;

ClassDefOverride(TrkrClusterv6, 2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please start with version 1, not 2. (just FYI, 0 means no streamer which we only use for our virtual base classes which do not have data members)

int getTLMix() const override { return (int) m_tlmix; }
void setTLMix(char tlmix) { m_tlmix = tlmix; }

int getTRMix() const override { return (int) m_trmix; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not need the cast here, char automatically promotes to int:
int getTLMix() const override { return m_tlmix; }

float m_tbincen;
float m_padmax;
float m_tbinmax;
char m_rsize; // 8bit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you want char, not unsigned char? If your value is > 127, it will go negative

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit b2a8a4737fca38a31649879c8db38936a2a1ca2b:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

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/TrkrClusterv6.h (1)

261-264: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Signed char for mix members risks data corruption for values > 127.

The getter methods (getSLMix(), etc., lines 198-208) return int, and the base class uses std::numeric_limits<int>::max() as a sentinel. However, the backing members use signed char with range -128 to 127. Values greater than 127 will be stored as negative numbers, corrupting the data. Use unsigned char instead.

🔧 Proposed fix
- char m_slmix;                 // 8bit
- char m_srmix;                 // 8bit
- char m_tlmix;                 // 8bit
- char m_trmix;                 // 8bit
+ unsigned char m_slmix;                 // 8bit
+ unsigned char m_srmix;                 // 8bit
+ unsigned char m_tlmix;                 // 8bit
+ unsigned char m_trmix;                 // 8bit

Based on learnings from pinkenburg's previous review: signed char values > 127 go negative, which is typically not the intended behavior for these fields.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: db6a7132-57c6-4730-93bc-8d505d032109

📥 Commits

Reviewing files that changed from the base of the PR and between b2a8a47 and 3283cb3.

📒 Files selected for processing (1)
  • offline/packages/trackbase/TrkrClusterv6.h

Comment thread offline/packages/trackbase/TrkrClusterv6.h Outdated
@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 3283cb3a814ebcda2cbcaaff8dc232180314b515:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit f25df97ad25582e4432531984623b6588bf53e25:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 95b6c443a589719984662ee1c2c66b4e5667b797:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@Ishangoel11

Copy link
Copy Markdown
Contributor Author

I don't know about any of these clang-tidy errors. Those changes were not made by me. So can you please add this or do I have to change these clang tidy fixes myself?

@osbornjd

osbornjd commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

The clang-tidy warning is just because constexpr implies inline, so it is redundant. You should be able to just remove the inline syntax and it will resolve the issue

@osbornjd

osbornjd commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

You can always just run the following command on your code and it will fix the clang-tidy warnings for you

https://wiki.sphenix.bnl.gov/index.php?title=Tools#clang_tidy

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

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/ActsGeometry.cc (1)

202-218: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Wrap the -1 neighbor with signed arithmetic.

Line 208 mixes unsigned int nsurf with i = -1. When nsurf is 0, nsurf + i underflows before the modulo, so this fallback probes an unrelated surface instead of the previous one. Near the TPC φ boundary, that can return the wrong surface or nullptr for valid coordinates.

Suggested fix
-      unsigned int new_nsurf = (nsurf + i) % surf_vec.size();
+      const auto surf_count = static_cast<int>(surf_vec.size());
+      const auto new_nsurf = static_cast<unsigned int>(
+          (static_cast<int>(nsurf) + i + surf_count) % surf_count);

As per coding guidelines, C++ changes here should prioritize correctness.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c1d2f577-bf77-4108-84f5-b8ded5992e29

📥 Commits

Reviewing files that changed from the base of the PR and between 95b6c44 and 92fb173.

📒 Files selected for processing (64)
  • offline/packages/trackbase/.ActsGsfTrackFittingAlgorithm.h.swo
  • offline/packages/trackbase/ActsGeometry.cc
  • offline/packages/trackbase/ActsGeometry.h
  • offline/packages/trackbase/ActsGsfTrackFittingAlgorithm.h
  • offline/packages/trackbase/ActsTrackFittingAlgorithm.h
  • offline/packages/trackbase/ActsTrackingGeometry.h
  • offline/packages/trackbase/AlignmentTransformation.cc
  • offline/packages/trackbase/AlignmentTransformation.h
  • offline/packages/trackbase/Calibrator.h
  • offline/packages/trackbase/ClusterErrorPara.cc
  • offline/packages/trackbase/ClusterErrorPara.h
  • offline/packages/trackbase/CommonOptions.cc
  • offline/packages/trackbase/CommonOptions.h
  • offline/packages/trackbase/IBaseDetector.h
  • offline/packages/trackbase/InttDefs.cc
  • offline/packages/trackbase/LaserCluster.h
  • offline/packages/trackbase/LaserClusterContainer.h
  • offline/packages/trackbase/LaserClusterContainerLinkDef.h
  • offline/packages/trackbase/LaserClusterContainerv1.cc
  • offline/packages/trackbase/LaserClusterContainerv1.h
  • offline/packages/trackbase/LaserClusterContainerv1LinkDef.h
  • offline/packages/trackbase/LaserClusterLinkDef.h
  • offline/packages/trackbase/LaserClusterv1.cc
  • offline/packages/trackbase/LaserClusterv1.h
  • offline/packages/trackbase/LaserClusterv1LinkDef.h
  • offline/packages/trackbase/LaserClusterv2.cc
  • offline/packages/trackbase/LaserClusterv2.h
  • offline/packages/trackbase/LaserClusterv2LinkDef.h
  • offline/packages/trackbase/MagneticFieldOptions.cc
  • offline/packages/trackbase/MagneticFieldOptions.h
  • offline/packages/trackbase/Makefile.am
  • offline/packages/trackbase/MaterialWiper.h
  • offline/packages/trackbase/MvtxDefs.cc
  • offline/packages/trackbase/MvtxEventInfov2.h
  • offline/packages/trackbase/RawHitSetv1.h
  • offline/packages/trackbase/ResidualOutlierFinder.h
  • offline/packages/trackbase/SpacePoint.h
  • offline/packages/trackbase/TGeoDetectorWithOptions.cc
  • offline/packages/trackbase/TGeoDetectorWithOptions.h
  • offline/packages/trackbase/TpcDefs.cc
  • offline/packages/trackbase/TpcDefs.h
  • offline/packages/trackbase/TrackFitUtils.cc
  • offline/packages/trackbase/TrackFitUtils.h
  • offline/packages/trackbase/TrackFittingAlgorithmFunctionsKalman.cc
  • offline/packages/trackbase/TrackVertexCrossingAssoc_v1.cc
  • offline/packages/trackbase/TrkrClusterContainer.h
  • offline/packages/trackbase/TrkrClusterContainerv4.cc
  • offline/packages/trackbase/TrkrClusterHitAssoc.h
  • offline/packages/trackbase/TrkrClusterv6.h
  • offline/packages/trackbase/TrkrDefs.cc
  • offline/packages/trackbase/TrkrDefs.h
  • offline/packages/trackbase/TrkrHit.h
  • offline/packages/trackbase/TrkrHitSetContainerv2.cc
  • offline/packages/trackbase/TrkrHitSetContainerv2.h
  • offline/packages/trackbase/TrkrHitSetContainerv2LinkDef.h
  • offline/packages/trackbase/TrkrHitSetTpc.h
  • offline/packages/trackbase/TrkrHitSetTpcLinkDef.h
  • offline/packages/trackbase/TrkrHitSetTpcv1.h
  • offline/packages/trackbase/TrkrHitSetTpcv1LinkDef.h
  • offline/packages/trackbase/alignmentTransformationContainer.h
  • offline/packages/trackbase/autogen.sh
  • offline/packages/trackbase/configure.ac
  • offline/packages/trackbase/sPHENIXActsDetectorElement.cc
  • offline/packages/trackbase/sPHENIXActsDetectorElement.h
💤 Files with no reviewable changes (2)
  • offline/packages/trackbase/alignmentTransformationContainer.h
  • offline/packages/trackbase/TrackFittingAlgorithmFunctionsKalman.cc
✅ Files skipped from review due to trivial changes (53)
  • offline/packages/trackbase/Calibrator.h
  • offline/packages/trackbase/LaserClusterLinkDef.h
  • offline/packages/trackbase/LaserClusterContainerLinkDef.h
  • offline/packages/trackbase/TrkrHitSetTpcLinkDef.h
  • offline/packages/trackbase/TrkrHitSetContainerv2LinkDef.h
  • offline/packages/trackbase/TrkrHitSetTpcv1LinkDef.h
  • offline/packages/trackbase/TrkrClusterContainer.h
  • offline/packages/trackbase/TrkrClusterHitAssoc.h
  • offline/packages/trackbase/ActsGeometry.h
  • offline/packages/trackbase/InttDefs.cc
  • offline/packages/trackbase/IBaseDetector.h
  • offline/packages/trackbase/TrkrDefs.h
  • offline/packages/trackbase/LaserClusterv2LinkDef.h
  • offline/packages/trackbase/CommonOptions.h
  • offline/packages/trackbase/MaterialWiper.h
  • offline/packages/trackbase/SpacePoint.h
  • offline/packages/trackbase/TrkrHitSetContainerv2.h
  • offline/packages/trackbase/TpcDefs.cc
  • offline/packages/trackbase/ActsTrackFittingAlgorithm.h
  • offline/packages/trackbase/MvtxEventInfov2.h
  • offline/packages/trackbase/LaserClusterContainerv1LinkDef.h
  • offline/packages/trackbase/TrkrClusterContainerv4.cc
  • offline/packages/trackbase/MagneticFieldOptions.h
  • offline/packages/trackbase/sPHENIXActsDetectorElement.cc
  • offline/packages/trackbase/MvtxDefs.cc
  • offline/packages/trackbase/TrkrHitSetTpcv1.h
  • offline/packages/trackbase/TGeoDetectorWithOptions.h
  • offline/packages/trackbase/TpcDefs.h
  • offline/packages/trackbase/TrkrHitSetContainerv2.cc
  • offline/packages/trackbase/TrkrDefs.cc
  • offline/packages/trackbase/AlignmentTransformation.h
  • offline/packages/trackbase/LaserClusterContainerv1.h
  • offline/packages/trackbase/TrkrHitSetTpc.h
  • offline/packages/trackbase/TrackFitUtils.cc
  • offline/packages/trackbase/RawHitSetv1.h
  • offline/packages/trackbase/ActsTrackingGeometry.h
  • offline/packages/trackbase/TrkrHit.h
  • offline/packages/trackbase/sPHENIXActsDetectorElement.h
  • offline/packages/trackbase/ActsGsfTrackFittingAlgorithm.h
  • offline/packages/trackbase/TrackVertexCrossingAssoc_v1.cc
  • offline/packages/trackbase/TGeoDetectorWithOptions.cc
  • offline/packages/trackbase/AlignmentTransformation.cc
  • offline/packages/trackbase/LaserClusterv1.cc
  • offline/packages/trackbase/LaserClusterContainerv1.cc
  • offline/packages/trackbase/ClusterErrorPara.h
  • offline/packages/trackbase/LaserClusterContainer.h
  • offline/packages/trackbase/TrackFitUtils.h
  • offline/packages/trackbase/LaserCluster.h
  • offline/packages/trackbase/LaserClusterv2.h
  • offline/packages/trackbase/LaserClusterv1.h
  • offline/packages/trackbase/CommonOptions.cc
  • offline/packages/trackbase/LaserClusterv2.cc
  • offline/packages/trackbase/MagneticFieldOptions.cc
🚧 Files skipped from review as they are similar to previous changes (2)
  • offline/packages/trackbase/Makefile.am
  • offline/packages/trackbase/TrkrClusterv6.h

Comment on lines +1 to +8
#!/ bin / sh
srcdir =`dirname $0` test - z "$srcdir" &&srcdir =.

(cd $srcdir; aclocal -I ${OFFLINE_MAIN}/share;\
libtoolize --force; automake -a --add-missing; autoconf)

$srcdir/configure "$@"
(cd $srcdir; aclocal - I ${OFFLINE_MAIN} / share;
libtoolize-- force; automake - a-- add - missing; autoconf)

$srcdir /
configure "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Shell syntax errors render the script non-functional.

The formatting changes introduce multiple syntax errors that will prevent this bootstrap script from executing:

  1. Line 1: The shebang #!/ bin / sh is invalid. The kernel expects a single interpreter path without spaces.
  2. Line 2: Spaces around = break variable assignment (srcdir = should be srcdir=). The command separator is also malformed.
  3. Lines 4-5: Command options are broken by spaces (e.g., aclocal - I should be aclocal -I, libtoolize-- force should be libtoolize --force, automake - a-- add - missing should be automake -a --add-missing).
  4. Lines 7-8: The path separator is split across lines ($srcdir / and configure should be $srcdir/configure).

These errors will cause immediate build failures when developers run autogen.sh. The script must use correct shell syntax to bootstrap the autotools build system.

🔧 Revert to correct shell syntax
-#!/ bin / sh
-srcdir =`dirname $0` test - z "$srcdir" &&srcdir =.
+#!/bin/sh
+srcdir=`dirname $0`; test -z "$srcdir" && srcdir=.

-                                                  (cd $srcdir; aclocal - I ${OFFLINE_MAIN} / share;
-                                                   libtoolize-- force; automake - a-- add - missing; autoconf)
+(cd $srcdir; aclocal -I ${OFFLINE_MAIN}/share; \
+ libtoolize --force; automake -a --add-missing; autoconf)

-                                                      $srcdir /
-                                                  configure "$@"
+$srcdir/configure "$@"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#!/ bin / sh
srcdir =`dirname $0` test - z "$srcdir" &&srcdir =.
(cd $srcdir; aclocal -I ${OFFLINE_MAIN}/share;\
libtoolize --force; automake -a --add-missing; autoconf)
$srcdir/configure "$@"
(cd $srcdir; aclocal - I ${OFFLINE_MAIN} / share;
libtoolize-- force; automake - a-- add - missing; autoconf)
$srcdir /
configure "$@"
#!/bin/sh
srcdir=`dirname $0`; test -z "$srcdir" && srcdir=.
(cd $srcdir; aclocal -I ${OFFLINE_MAIN}/share; \
libtoolize --force; automake -a --add-missing; autoconf)
$srcdir/configure "$@"
🧰 Tools
🪛 Shellcheck (0.11.0)

[error] 1-1: On most OS, shebangs can only specify a single parameter.

(SC2096)


[error] 1-1: This shebang specifies a directory. Ensure the interpreter is a file.

(SC2246)


[error] 2-2: Remove spaces around = to assign (or use [ ] to compare, or quote '=' if literal).

(SC2283)


[warning] 2-2: Quote this to prevent word splitting.

(SC2046)


[style] 2-2: Use $(...) notation instead of legacy backticks ....

(SC2006)


[info] 2-2: Double quote to prevent globbing and word splitting.

(SC2086)


[warning] 2-2: srcdir is referenced but not assigned.

(SC2154)


[error] 2-2: Remove spaces around = to assign (or use [ ] to compare, or quote '=' if literal).

(SC2283)


[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[info] 4-4: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 4-4: Double quote to prevent globbing and word splitting.

(SC2086)


AC_PROG_CXX(CC g++)
LT_INIT([disable-static])
LT_INIT([disable - static])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Invalid libtool option syntax.

The LT_INIT argument has been changed to [disable - static] with spaces, which is not a valid libtool option. The correct form is [disable-static] as a single hyphenated string. This will likely cause libtool initialization to fail or ignore the option, resulting in unwanted static library builds.

🔧 Restore correct option syntax
-LT_INIT([disable - static])
+LT_INIT([disable-static])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LT_INIT([disable - static])
LT_INIT([disable-static])

Comment on lines +23 to +24
*) AC_MSG_ERROR(bad value ${
enableval} for --enable-online) ;;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Broken parameter expansion in error message.

The shell parameter expansion ${enableval} has been split across lines (${ on line 23 and enableval} on line 24). This breaks the shell variable substitution syntax and will prevent the error message from displaying the actual invalid value when --enable-online is given a bad argument.

🔧 Restore correct parameter expansion
-                *) AC_MSG_ERROR(bad value ${
-  enableval} for --enable-online) ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --enable-online) ;;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
*) AC_MSG_ERROR(bad value ${
enableval} for --enable-online) ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-online) ;;

struct ResidualOutlierFinder
{
ActsGeometry* m_tGeometry = nullptr;
ActsGeometry *m_tGeometry = nullptr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don’t terminate the whole job from this predicate on missing geometry.

m_tGeometry still defaults to nullptr, so any default-constructed or partially configured ResidualOutlierFinder now aborts the entire process via exit(1). That turns a local configuration error into an unrecoverable job failure and bypasses normal framework cleanup/reporting. Please surface this as a caller-visible failure instead of terminating from inside operator().

Safer fallback
-    if (!m_tGeometry)
-    {
-      std::cout << PHWHERE << "no geometry set in residual outlier finder" << std::endl;
-      exit(1);
-    }
+    if (!m_tGeometry)
+    {
+      std::cout << PHWHERE << "no geometry set in residual outlier finder" << std::endl;
+      return false;
+    }

As per coding guidelines, header changes should make ownership/lifetime requirements explicit and avoid unclear lifetime assumptions.

Also applies to: 78-81

@Ishangoel11

Copy link
Copy Markdown
Contributor Author

I don't understand these ActsGsf errors.

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 92fb173add77d97c2d87bf43211c22936984d5b2:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@Ishangoel11 Ishangoel11 closed this Jun 5, 2026
@Ishangoel11 Ishangoel11 deleted the branch branch June 5, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants