Skip to content

Back to original try. No change in previous classes. And new v6 class.#4291

Merged
pinkenburg merged 3 commits into
sPHENIX-Collaboration:masterfrom
Ishangoel11:branch
Jun 9, 2026
Merged

Back to original try. No change in previous classes. And new v6 class.#4291
pinkenburg merged 3 commits into
sPHENIX-Collaboration:masterfrom
Ishangoel11:branch

Conversation

@Ishangoel11

@Ishangoel11 Ishangoel11 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

that I uses.

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)

Motivation / context

  • Introduce a new cluster version (TrkrClusterv6) following the established v1–v5 pattern to capture additional per-cluster metadata needed by reconstruction and downstream analysis, while leaving existing classes unchanged. Also standardize numeric sentinel usage (replace NaN macros/values with std::numeric_limits where applicable).

Key changes

  • New TrkrClusterv6 class
    • Added header and implementation (TrkrClusterv6.h / TrkrClusterv6.cc), ROOT LinkDef entry, and Makefile.am integration (headers, dictionary, and compilation into libtrack_io).
    • Implements PHObject-compatible methods: identify(), Reset(), CloneMe(), CopyFrom(const TrkrCluster&), isValid().
    • Stores local coordinates, subsurface key, ADC/max/centroid ADC, pad/time-bin center & max, RPhi/Z errors and sizes, and getRSize.
    • Tracks overlap/edge flags and mix parameters for 8 directional combinations (SL, SR, TL, TR, DL, DR, HL, HR).
    • Provides phi/time-bin low/high ranges and pad/time-bin phase accessors.
  • Base interface extensions
    • TrkrCluster base class extended with many new virtual getters (centroid/max ADCs, pad/tbin centers/max, edge/mix getters, bin-range getters, phase getters, getRSize, etc.) implemented to return sentinel values to preserve backward compatibility.
  • Numeric sentinel change
    • Replaced usage of NaN macros/values with std::numeric_limits for float/char/int sentinel returns in relevant getters and internal initializers.
  • Build-system updates
    • Makefile.am and LinkDef updated to include and expose TrkrClusterv6 for ROOT dictionary generation and installation.

Potential risk areas

  • IO / persistence: New persistent ROOT class/version may affect file I/O and downstream tools; validate ROOT schema evolution, dictionary availability, and ability to read legacy/mixed-version files.
  • Reconstruction correctness & validation: New fields change in-memory representation; algorithms consuming clusters must be audited and validated to ensure semantics (CopyFrom, isValid, sentinel values) match reconstruction assumptions.
  • Thread-safety & initialization: Ensure all members are reliably initialized and Reset works as intended to avoid NaNs/stale values in multithreaded workflows or when reusing objects from pools.
  • Performance & memory: Increased per-cluster footprint may impact memory usage, I/O size, and processing throughput in high-multiplicity or production workflows.
  • ABI/override subtleties: Some setters are added without explicit override markers; double-check virtual signatures to avoid subtle override/ABI issues across versions.

Possible future improvements

  • Add unit and integration tests for IO (write/read), CopyFrom(), isValid(), and common consumers to validate behavior and schema evolution.
  • Document binary compatibility, ROOT streaming/IO expectations for v6, and provide migration guidance for analysis/reconstruction code.
  • Consider packing, bitfield optimizations, or optional storage to reduce per-cluster memory/I/O footprint if profiling indicates impact.
  • Audit and consolidate setter signatures and add explicit override markings where appropriate to prevent ABI issues.

Caveat

  • This summary was prepared with AI assistance. AI can make mistakes; please verify details (especially semantics of edge/mix flags, exact CopyFrom behavior, and ROOT persistence implications) before making production decisions.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1de270c3-a47d-47c2-a6ea-2c8dfd14faed

📥 Commits

Reviewing files that changed from the base of the PR and between badf5c7 and 95f0073.

📒 Files selected for processing (1)
  • offline/packages/trackbase/TrkrCluster.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • offline/packages/trackbase/TrkrCluster.h

📝 Walkthrough

Walkthrough

This PR adds TrkrClusterv6 (a TrkrCluster subclass), extends TrkrCluster with many new virtual getters and updated float sentinels, implements TrkrClusterv6 non-inline methods (identify, isValid, CopyFrom), and integrates the class into the build and ROOT LinkDef.

Changes

TrkrClusterv6 Implementation

Layer / File(s) Summary
Base class interface extension
offline/packages/trackbase/TrkrCluster.h
Adds many new virtual getters (ADC centroid, pad/tbin centers and maxima, edge flags, mix parameters, phi/tbin ranges, phase getters, getRSize) returning sentinel defaults; updates float sentinel returns to std::numeric_limits<float>::quiet_NaN().
TrkrClusterv6 class declaration
offline/packages/trackbase/TrkrClusterv6.h
Declares TrkrClusterv6: PHObject overrides, inline position API with bounds checks, ADC/max/centroid/pad/tbin accessors, size/overlap/edge/mix/bin-range/phase getters/setters, private members (m_local initialized to quiet NaNs), and ClassDefOverride.
TrkrClusterv6 non-inline implementation
offline/packages/trackbase/TrkrClusterv6.cc
Implements identify(std::ostream&) (prints local coords and validity), isValid() (rejects NaN positions or ADC==0xFFFF), and CopyFrom(const TrkrCluster&) (self-guard, base-class CopyFrom, field-by-field setter copies).
Build system and ROOT integration
offline/packages/trackbase/Makefile.am, offline/packages/trackbase/TrkrClusterv6LinkDef.h
Adds TrkrClusterv6.h to installed headers, compiles TrkrClusterv6.cc into libtrack_io, includes TrkrClusterv6_Dict.cc in ROOTDICTS, and adds a #pragma link C++ class TrkrClusterv6 + ; under __CINT__.

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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 74a80369-6d69-410b-9c5b-60d3a6602b7f

📥 Commits

Reviewing files that changed from the base of the PR and between 82cee04 and 6f71eb4.

📒 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 +118 to +120
setRSize(source.getRSize());
setPhiSize(source.getPhiSize());
setZSize(source.getZSize());

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify sentinel-producing base getters and narrowing assignments in CopyFrom
rg -n -C2 'virtual (float getRSize|float getPhiSize|float getZSize|int getSLMix|int getSRMix|int getTLMix|int getTRMix)' offline/packages/trackbase/TrkrCluster.h
rg -n -C2 'set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\(' offline/packages/trackbase/TrkrClusterv6.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1706


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect TrkrClusterv6.cc around the reported CopyFrom assignments (and any nearby mix/size members)
sed -n '90,170p' offline/packages/trackbase/TrkrClusterv6.cc

# Inspect TrkrCluster.h around the sentinel defaults for the base getters
sed -n '60,140p' offline/packages/trackbase/TrkrCluster.h

# Confirm the exact setter signatures/types used by TrkrClusterv6 (so we know what conversions happen)
rg -n "void set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\(" offline/packages/trackbase/TrkrClusterv6.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 5306


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Line numbers for CopyFrom assignments in TrkrClusterv6.cc
rg -n "set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\(source\.get" offline/packages/trackbase/TrkrClusterv6.cc

# Setter signatures/definitions in TrkrClusterv6.cc (parameter types)
rg -n "void set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\s*\(" offline/packages/trackbase/TrkrClusterv6.cc

# If setters are inline or inherited, also search for "setRSize" declarations
rg -n "set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\s*[,)]" offline/packages/trackbase/TrkrClusterv6.cc | head -n 50

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 327


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find where setters are declared/overridden in TrkrClusterv6.cc (or any directly-included header within same file scope)
rg -n "setRSize|setPhiSize|setZSize|setSLMix|setSRMix|setTLMix|setTRMix" offline/packages/trackbase/TrkrClusterv6.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 327


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate setter signatures in TrkrCluster.h (or others) to confirm conversion targets/types
rg -n "set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\s*\(" offline/packages/trackbase/TrkrCluster.h

# If not present there, search within trackbase for declarations
rg -n "set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\s*\(" offline/packages/trackbase | head -n 50

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 60


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Broader search for setter declarations/definitions (type-agnostic)
rg -n "set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)\s*\(" offline/packages/trackbase | head -n 200

# Also search for plain names without "(" in case of different syntax (e.g., member functions declared in classes)
rg -n "set(RSize|PhiSize|ZSize|SLMix|SRMix|TLMix|TRMix)" offline/packages/trackbase | head -n 200

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 4010


Guard sentinel-to-narrow assignments in TrkrClusterv6::CopyFrom to prevent corrupted cluster state.

TrkrCluster base getters return NAN for getRSize/getPhiSize/getZSize and std::numeric_limits<int>::max() for getSLMix/getSRMix/getTLMix/getTRMix. TrkrClusterv6::CopyFrom then writes these directly into narrow types (setRSize(unsigned char), setPhiSize(char), setZSize(char), and set*Mix(char)) at lines 118-120 and 131-134, so NAN→integer conversion is undefined and INT_MAXchar produces invalid/corrupted values for non-v6 sources.

Add sentinel/range checks (or only copy these fields when the source is known-valid for v6) before calling the narrow setters.

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 6f71eb405aa24369a8d075a22214b0d7741be0ee:
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 badf5c7fab8c9abd5f02f6ca80bef2620ab9759f:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@osbornjd osbornjd 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.

I think this is good to go now unless @pinkenburg has any other requests

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 95f0073ffcaf5a2772ccd6ad67ec11fbe2787d19:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg pinkenburg merged commit de6c5f6 into sPHENIX-Collaboration:master Jun 9, 2026
22 checks passed
@Ishangoel11 Ishangoel11 deleted the branch branch June 9, 2026 20:39
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