Skip to content

feat: add data/sim reco flag for tracking workflow#1279

Merged
osbornjd merged 3 commits intosPHENIX-Collaboration:masterfrom
osbornjd:test_silicon_seed_offsets
Jan 30, 2026
Merged

feat: add data/sim reco flag for tracking workflow#1279
osbornjd merged 3 commits intosPHENIX-Collaboration:masterfrom
osbornjd:test_silicon_seed_offsets

Conversation

@osbornjd
Copy link
Copy Markdown
Contributor

@osbornjd osbornjd commented Jan 29, 2026

This adds a global data/sim reconstruction flag that modules can use as appropriate. For the tracking it is set based on the CDB tag in the initialization, and we can test it using Tony's recent PR which shows differences between data and simulation since there is not a beam spot offset in the simulation.

Data/Simulation Reconstruction Flag for Tracking Workflow

Motivation and Context

Introduce an explicit global flag to let reconstruction modules distinguish data vs. simulation at runtime. This enables modules (notably tracking) to adapt behavior—e.g., disable beam-spot offsets for simulation to match differences demonstrated in coresoftware PR sPHENIX-Collaboration/coresoftware#4135—so we can compare data and simulation reliably.

Key Changes

  • Added CDB::is_data_reco (bool, default false) to common/GlobalVariables.C.
  • Initialization: TrackingInit() in common/Trkr_RecoInit.C now reads recoConsts::instance()->get_StringFlag("CDB_GLOBALTAG"); if the tag contains "MDC" it sets CDB::is_data_reco = false, otherwise sets it true and prints a diagnostic with the tag.
  • Tracking behavior: common/Trkr_Reco.C (Tracking_Reco_SiliconSeed_run2pp) now uses CDB::is_data_reco to disable silicon seed beam-spot offsets in simulation by calling set_beamSpotXY(0,0) for both silicon seeding iterations when !CDB::is_data_reco.
  • Added include of <phool/recoConsts.h> where needed; no file-format or persistent I/O changes.

Potential Risk Areas

  • Reconstruction behavior: Altering beam-spot handling changes seed formation and tracking results (efficiency, fake rate, resolution). Comparisons between data and simulation may shift.
  • CDB tag dependency: Mode detection relies on string matching ("MDC") in CDB_GLOBALTAG—fragile if tag naming conventions change or other tags are used.
  • Global mutable state: CDB::is_data_reco is a mutable global set at init time; ensure it is set only once before concurrent access. Multithreaded safety depends on no late writes after initialization.
  • Performance/thread-safety: No direct perf changes expected, but verify modules reading the flag are safe in multi-threaded contexts.
  • Logic correctness: The simple tag heuristic may misclassify edge cases (e.g., mixed or custom tags).

Possible Future Improvements

  • Replace magic-string heuristic with an explicit CDB boolean entry or dedicated condition in the conditions DB.
  • Make the flag immutable after initialization or provide a thread-safe accessor.
  • Add unit/integration tests and automated checks to validate detected mode against run metadata.
  • Broaden and document usage for other subsystems with known data/simulation differences and improve logging format (include resolved mode and tag).
  • Consider exposing the mode via configuration APIs rather than a raw global variable.

⚠️ Note: This summary was produced with AI assistance; AI can make mistakes—please review the diffs and code directly during code review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Adds a global boolean CDB::is_data_reco (default false), sets it at runtime from CDB_GLOBALTAG via recoConsts::instance(), and uses the flag in silicon seeding to reset beamSpotXY to (0,0) for both silicon seeds when running non-data reconstruction.

Changes

Cohort / File(s) Summary
Global State
common/GlobalVariables.C
Added bool is_data_reco = false in namespace CDB.
Tracking Initialization
common/Trkr_RecoInit.C
Added include <phool/recoConsts.h> and runtime check of CDB_GLOBALTAG (via recoConsts::instance()->get_StringFlag) to set CDB::is_data_reco (sets false if tag contains "MDC", true otherwise).
Silicon Seeding Logic
common/Trkr_Reco.C
In Tracking_Reco_SiliconSeed_run2pp, added conditionals to set silicon seed beamSpotXY to (0,0) for both first and second silicon seeds when CDB::is_data_reco is false.

Possibly related PRs

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

@sphenix-jenkins-ci
Copy link
Copy Markdown

For repository maintainers, please start the CI check manually (feedback)

This is an automatic message to assist manually starting CI check for this pull request, commit d1dc5effd282159ee184743dabfcd43043c6f50b. macros pull request require a manual start for CI checks, in particular selecting which coresoftware and calibrations versions to check against this macros pull request.

sPHENIX software maintainers: please make your input here and start the Build:

build

Note:

  1. if needed, fill in the pull request ID for the coresoftware pull request, e.g. origin/pr/1697/merge for PR#1697 in sha_coresoftware. Default is to check with the master branch.
  2. click Build button at the end of the long web page to start the test

Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link
Copy Markdown

For repository maintainers, please start the CI check manually (feedback)

This is an automatic message to assist manually starting CI check for this pull request, commit a0773504c99899a47b7307c3977db5fad6dde0b4. macros pull request require a manual start for CI checks, in particular selecting which coresoftware and calibrations versions to check against this macros pull request.

sPHENIX software maintainers: please make your input here and start the Build:

build

Note:

  1. if needed, fill in the pull request ID for the coresoftware pull request, e.g. origin/pr/1697/merge for PR#1697 in sha_coresoftware. Default is to check with the master branch.
  2. click Build button at the end of the long web page to start the test

Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link
Copy Markdown

For repository maintainers, please start the CI check manually (feedback)

This is an automatic message to assist manually starting CI check for this pull request, commit ec4eaf646e8cb7bcce10e7e9ebd032aac43a8aa6. macros pull request require a manual start for CI checks, in particular selecting which coresoftware and calibrations versions to check against this macros pull request.

sPHENIX software maintainers: please make your input here and start the Build:

build

Note:

  1. if needed, fill in the pull request ID for the coresoftware pull request, e.g. origin/pr/1697/merge for PR#1697 in sha_coresoftware. Default is to check with the master branch.
  2. click Build button at the end of the long web page to start the test

Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@osbornjd osbornjd merged commit d3540e1 into sPHENIX-Collaboration:master Jan 30, 2026
17 of 18 checks passed
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.

1 participant