Skip to content

Store observed sync tagger to BXCounterSync CDB TTree for use in EBDC which failed BXSync#4301

Merged
osbornjd merged 1 commit into
sPHENIX-Collaboration:masterfrom
blackcathj:TPCTimeFrameBuilder7
Jun 16, 2026
Merged

Store observed sync tagger to BXCounterSync CDB TTree for use in EBDC which failed BXSync#4301
osbornjd merged 1 commit into
sPHENIX-Collaboration:masterfrom
blackcathj:TPCTimeFrameBuilder7

Conversation

@blackcathj

@blackcathj blackcathj commented Jun 14, 2026

Copy link
Copy Markdown
Member

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, ...)

This deals a rare problem in TPC data that was identified in the last iteration of production: some time the beam crossing clock sync tagger (BX_COUNTER_SYNC_T) which record the time when the FEE clock is reset. BX_COUNTER_SYNC_T is used to predict the synchronization of FEE to sPHENIX clock, without which the event building does not work reliably. This tagger is identical cross 48 independent TPC data streams.

This PR introduce storing BX_COUNTER_SYNC_T to CDB file by default. Then this CDB file can be used to recover the rare cases for one of the 48 TPC data stream missing this tagger.

How to use

The output CDB file is available after the first event execution and save out at the end of Fun4All macro by default such as

void TpcTimeFrameBuilderRun3::write_bx_counter_sync_cdb_tree() const - saved 26 BX_COUNTER_SYNC_T observations to TpcTimeFrameBuilderRun3_Packet4110_BXCounterSyncCDBTTree.root

And the location can be over written with

      SingleTpcTimeFrameInput *tpc_sngl = new SingleTpcTimeFrameInput("SingleTpcTimeFrameInput_" + to_string(i));
      tpc_sngl->setBXCounterSyncCDBTTreeName(iter + "_BXCounterSyncCDBTTree.root");

TODOs (if applicable)

Add the read function with a problematic run is identified and its CDB file installed.

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

#4292

BX Counter Sync Observation CDB Storage

Motivation

During TPC data production, the beam crossing counter sync tagger (BX_COUNTER_SYNC_T) occasionally goes missing from one of the 48 independent TPC data streams. This tagger records the FEE clock reset time and is critical for predicting FEE-to-sPHENIX master clock synchronization. When missing from any stream, event building becomes unreliable. This PR implements automated capture of these synchronization observations to enable recovery in affected runs.

Key Changes

  • TpcTimeFrameBuilderRun3: Captures the first 4 BX_COUNTER_SYNC_T observations per FEE (stored in BXCounterSyncObservation records) with associated GTM and reference BCO values, fixed clock offsets (GTM: 0, FEE: 12)
  • CDB Output: Writes observations to a CDBTTree file with per-FEE records indexed as channels, storing packet ID, FEE, observation count, and metadata
  • Default Behavior: Automatically generates CDB files with naming pattern TpcTimeFrameBuilderRun3_Packet<id>_BXCounterSyncCDBTTree.root after first event execution
  • API: Added setBXCounterSyncCDBTTreeName() on SingleTpcTimeFrameInput to customize output location; defaults to empty string (no-op on base class)
  • Virtual Interface: Extended TpcTimeFrameBuilderBase with pure virtual SaveBXCounterSyncCDBTTree() method; implemented in TpcTimeFrameBuilderRun3, empty stub in TpcTimeFrameBuilder

Potential Risk Areas

  • IO Changes: New CDB files generated automatically; disk space implications for repeated data collection
  • Data Storage Design: Storage limited to 4 observations per FEE and per packet builder; exceeding this limit silently discards additional observations—verify this cap is sufficient for production use cases
  • Clock Synchronization Dependencies: Uses fixed hardcoded offsets for GTM and FEE BCO; any hardware or FEE changes may require offset recalibration
  • CDB Integration: Production readiness depends on CDB installation infrastructure; no read-back function implemented yet (deferred to future iteration per PR notes)

Possible Future Improvements

  • Implement read-back functionality to reconstruct missing taggers using stored CDB observations
  • Increase observation storage limit or implement dynamic allocation
  • Add configurable BCO offsets for different hardware configurations
  • Monitor observation capture statistics and alert on insufficient synchronization events

@blackcathj blackcathj requested a review from osbornjd June 14, 2026 11:58
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new SaveBXCounterSyncCDBTTree method is propagated through the TpcTimeFrameBuilderBase pure-virtual interface, a no-op override in TpcTimeFrameBuilder, and a full implementation in TpcTimeFrameBuilderRun3. The Run3 builder records BX_COUNTER_SYNC_T observations inside BcoMatchingInformation and writes them to a CDBTTree file on destruction. SingleTpcTimeFrameInput is extended with a setter and a conditional call in FillPool.

Changes

BX Counter Sync CDB TTree persistence

Layer / File(s) Summary
Base interface and TpcTimeFrameBuilder no-op stub
offline/framework/fun4allraw/TpcTimeFrameBuilderBase.h, offline/framework/fun4allraw/TpcTimeFrameBuilder.h, offline/framework/fun4allraw/TpcTimeFrameBuilder.cc
TpcTimeFrameBuilderBase adds SaveBXCounterSyncCDBTTree as a new pure-virtual method; TpcTimeFrameBuilder declares and provides an empty override stub.
BcoMatchingInformation observation data structures and recording
offline/framework/fun4allraw/TpcTimeFrameBuilderRun3.h, offline/framework/fun4allraw/TpcTimeFrameBuilderRun3.cc
Introduces BXCounterSyncObservation struct, kMaxBXCounterSyncObservations limit, accessors, member storage, and save_bx_counter_sync_observation helper in BcoMatchingInformation; updates save_gtm_bco_information to construct the reference pair and record an observation when modebits == BX_COUNTER_SYNC_T.
Run3 CDB TTree write-out lifecycle
offline/framework/fun4allraw/TpcTimeFrameBuilderRun3.h, offline/framework/fun4allraw/TpcTimeFrameBuilderRun3.cc
Adds m_bxCounterSyncCDBTTreeName and write_bx_counter_sync_cdb_tree; constructor sets a default filename, destructor triggers the write, public setter SaveBXCounterSyncCDBTTree stores the configured name, and write_bx_counter_sync_cdb_tree populates and commits a CDBTTree from accumulated observations.
SingleTpcTimeFrameInput FillPool wiring
offline/framework/fun4allraw/SingleTpcTimeFrameInput.h, offline/framework/fun4allraw/SingleTpcTimeFrameInput.cc
Adds setBXCounterSyncCDBTTreeName setter and m_bxCounterSyncCDBTTreeName member; FillPool conditionally calls SaveBXCounterSyncCDBTTree on each packet builder when the name is non-empty.

Possibly related PRs

  • sPHENIX-Collaboration/coresoftware#4292: Introduced the Run3-specific TpcTimeFrameBuilderRun3 and BcoMatchingInformation logic on which the new BX_COUNTER_SYNC_T observation recording and SaveBXCounterSyncCDBTTree implementation directly build.

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: e07f3266-0853-4fb3-a896-7a48b64bd656

📥 Commits

Reviewing files that changed from the base of the PR and between c723a58 and da627ac.

📒 Files selected for processing (7)
  • offline/framework/fun4allraw/SingleTpcTimeFrameInput.cc
  • offline/framework/fun4allraw/SingleTpcTimeFrameInput.h
  • offline/framework/fun4allraw/TpcTimeFrameBuilder.cc
  • offline/framework/fun4allraw/TpcTimeFrameBuilder.h
  • offline/framework/fun4allraw/TpcTimeFrameBuilderBase.h
  • offline/framework/fun4allraw/TpcTimeFrameBuilderRun3.cc
  • offline/framework/fun4allraw/TpcTimeFrameBuilderRun3.h

Comment thread offline/framework/fun4allraw/SingleTpcTimeFrameInput.cc
@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit da627ac20bdbc5b0542d6d12503c1f00f6d0f3cd:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@osbornjd osbornjd merged commit 0ff63d4 into sPHENIX-Collaboration:master Jun 16, 2026
22 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.

2 participants