Skip to content

Conversation

@minjungkim12
Copy link
Contributor

This PR implements a comprehensive ReducedFIT table infrastructure for PWGDQ framework to enable FIT detector information access in UPC (Ultra-Peripheral Collisions) analyses.

Key changes:

  • Created ReducedFITs table with 35 columns covering FT0, FDD, and FV0A detectors
  • Added complete set of FIT variables to VarManager (amplitudes, timing, trigger masks, fired channel counts, pileup flags, BC distances)
  • Implemented FIT info filling in tableMaker using newbc pattern for UPC events (consistent with existing ZDC implementation)
  • Added fired channel counts for all detector sides (FT0A/C, FDDA/C, FV0A)

Implementation follows PWGUD upchelpers::FITInfo structure and applies the established newbc pattern for correct BC association in RapidityGapFilter scenarios.

🤖 Generated with Claude Code

This PR implements a comprehensive ReducedFIT table infrastructure for PWGDQ framework to enable FIT detector information access in UPC (Ultra-Peripheral Collisions) analyses.

Key changes:
- Created ReducedFITs table with 35 columns covering FT0, FDD, and FV0A detectors
- Added complete set of FIT variables to VarManager (amplitudes, timing, trigger masks, fired channel counts, pileup flags, BC distances)
- Implemented FIT info filling in tableMaker using newbc pattern for UPC events (consistent with existing ZDC implementation)
- Added fired channel counts for all detector sides (FT0A/C, FDDA/C, FV0A) as requested

Implementation follows PWGUD upchelpers::FITInfo structure and applies the established newbc pattern for correct BC association in RapidityGapFilter scenarios.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Nov 10, 2025

O2 linter results: ❌ 347 errors, ⚠️ 653 warnings, 🔕 0 disabled

@minjungkim12 minjungkim12 marked this pull request as ready for review November 10, 2025 23:48
Comment on lines 5255 to 5259
void VarManager::FillFIT(uint64_t midbc, std::vector<std::pair<uint64_t, int64_t>>& bcMap, TBCs const& bcs, TFT0s const& /*ft0s*/, TFDDs const& /*fdds*/, TFV0As const& /*fv0as*/, float* values)
{
if (!values) {
values = fgValues;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

In this function you do not cover the case when the FIT data is in the reduced DQ data model and is being used from the analysis workflow (e.g. from table reader). Is this something you plan to add later or?

// The DQRapidityGapFilter contains the index of the bc we want to get FIT info from
auto newbc = bcs.rawIteratorAt(collision.newBcIndex());
// Fill FIT information from newbc
if (newbc.has_foundFT0()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for all this block of code you can just call the VarManager::FillFIT(), otherwise, this VarManager function does not seem to be used anywhere

minjungkim12 and others added 13 commits November 14, 2025 13:57
- Add template overload of VarManager::FillFIT() to handle both ReducedFIT (analysis workflows) and BC objects (tableMaker)
- Refactor tableMaker_withAssoc.cxx to use VarManager::FillFIT() instead of duplicating FIT filling logic
- Addresses review comments from @iarsene on PR AliceO2Group#13773

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add missing fired channels counts for FV0A and FDD detectors in tableMaker BC filling
- Implement complete pileup flag calculation (BB/BG flags for FT0A/C, FV0A, FDDA/C)
- Scan ±16 BCs around collision BC to fill pileup flags using BC selection bits
- Follow PWGUD UPCCandidateProducer::processFITInfo pattern for consistency
- Note: BC distance calculations (TOR, TSC, TVX, V0A, T0A) remain at default (999)

This completes the FIT detector information implementation for UPC analysis in PWGDQ framework.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Following the pattern of ZDC variables (kEnergyZNC2, etc.), add
fgVarNamesMap entries for all 35 FIT detector variables:
- FT0 variables (amplitude, time, trigger mask, fired channels, pileup flags)
- FDD variables (amplitude, time, trigger mask, fired channels, pileup flags)
- FV0A variables (amplitude, time, trigger mask, fired channels, pileup flags)
- BC distance variables (TOR, TSC, TVX, V0A, T0A)

This ensures FIT variables can be properly referenced by name in
histogram configurations and analysis code, similar to other detector
variables in VarManager.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add fgVariableNames and fgVariableUnits definitions for all 35 FIT
detector variables, following the same pattern as ZDC variables:

- FT0 variables: amplitude (a.u.), time (ns), trigger mask, fired channels
- FDD variables: amplitude (a.u.), time (ns), trigger mask, fired channels
- FV0A variables: amplitude (a.u.), time (ns), trigger mask, fired channels
- Pileup flags: BB/BG flags for FT0A/C, FV0A, FDDA/C (dimensionless)
- BC distances: TOR, TSC, TVX, V0A, T0A (in BC units)

This completes the FIT variable definition infrastructure in VarManager,
enabling histogram creation and analysis with proper axis labels and units.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed compilation error where bitwise OR operations (|=) were being
performed directly on float array elements. The pileup flags need
bit operations but are stored in the float values[] array.

Solution: Use int32_t temporary variables for bit operations, then
convert back to float for storage in the values array.

- Declare int32_t variables for all 10 pileup flags at scan start
- Perform bitwise operations on int32_t variables during BC scanning
- Convert int32_t results to float and store in values[] after scanning

This follows the same pattern as PWGUD UPCCandidateProducer which
stores pileup flags as int32_t in the FITInfo structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add simple FillFIT(bc) template function in VarManager.h that takes BC object directly
- Accesses FIT detectors via bc.has_foundFT0(), bc.foundFT0(), etc. like ZDC does
- No initialization overhead, only fills values when detectors are present
- Update tableMaker to use simple VarManager::FillFIT(newbc) call
- Remove FT0s, FDDs, FV0As table arguments from fullSkimming and skimCollisions
- Remove FIT detector subscriptions from processPbPbWithFilterBarrelOnly
- FIT information now accessed directly from BC objects, not from separate tables

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ith FIT detector info

- Created new process function using gkEventFillMapWithMultsRapidityGapFilterZdcFit
- This enables ReducedFit table filling for UPC Pb-Pb analysis
- Fixes segmentation fault caused by unfilled FIT table during framework shutdown
- Changed has_foundFT0() -> has_ft0(), foundFT0() -> ft0()
- Changed has_foundFV0() -> has_fv0a(), foundFV0() -> fv0a()
- Changed has_foundFDD() -> has_fdd(), foundFDD() -> fdd()
- Matches standard O2 BC table accessor naming convention
- Fix FT0/FV0A/FDD amplitude initialization to preserve -1 sentinel values
- Only overwrite amplitude if actual signal is present (nFired > 0)
- Fix fired channel counting: count only channels with amp > 0, not array size
- Add FT0s, FDDs, FV0As table subscriptions to processPbPbWithFilterBarrelOnlyWithFIT

This allows distinguishing between "no detector data" and "detector present but no signal"
…citly

- Add type traits to detect FT0, FV0A, FDD detector objects
- Modify FillFIT template to handle individual detector objects
- Follow ZDC pattern: extract detector objects from BC before filling
- Fix FT0 amplitude initialization to preserve sentinel values
- Count only fired channels (amp > 0) for all detectors

This fixes the issue where FT0 data was not being filled because
bc.has_ft0() was checking for associations that weren't established
when passing BC object directly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit refactors the FIT detector filling implementation to:
1. Remove unused FillFIT function that took individual detector collections
2. Simplify FillFIT for ReducedFIT tables to only read pre-computed columns
3. Add new BC-based FillFIT that processes all FIT detectors (FT0, FV0A, FDD) in one call
4. Implement background pileup calculation by scanning ±16 BCs following PWGUD pattern
5. Calculate distance to closest BCs with specific triggers (TOR, TSC, TVX, V0A, T0A)
6. Remove unused type traits (is_FT0, is_FV0A, is_FDD)
7. Optimize tableMaker_withAssoc.cxx to call FillFIT once per event instead of three times

Key changes:
- VarManager::FillFIT now has two clean overloads: one for ReducedFIT tables, one for raw BC data
- Background/beam-beam pileup flags stored as bit-packed integers (kBGFT0Apf, kBBFT0Apf, etc.)
- Distance variables track nearest BC with specific triggers within scan range
- Reduced code complexity and improved performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@alibuild
Copy link
Collaborator

Error while checking build/O2Physics/o2 for 56c66ad at 2025-11-18 04:48:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/13773-slc9_x86-64/0/PWGDQ/TableProducer/tableMaker_withAssoc.cxx:1710:64: error: unused parameter 'ft0s' [-Werror=unused-parameter]
/sw/SOURCES/O2Physics/13773-slc9_x86-64/0/PWGDQ/TableProducer/tableMaker_withAssoc.cxx:1710:87: error: unused parameter 'fdds' [-Werror=unused-parameter]
/sw/SOURCES/O2Physics/13773-slc9_x86-64/0/PWGDQ/TableProducer/tableMaker_withAssoc.cxx:1710:111: error: unused parameter 'fv0as' [-Werror=unused-parameter]
ninja: build stopped: subcommand failed.

Full log here.

Please consider the following formatting changes to AliceO2Group#13773
iarsene
iarsene previously approved these changes Nov 20, 2025
@iarsene iarsene enabled auto-merge (squash) November 20, 2025 10:31
Comment out the gkEventFillMapWithMultsRapidityGapFilterZdc constant to prevent build Error on Mac
auto-merge was automatically disabled November 20, 2025 16:02

Head branch was pushed to by a user without write access

Please consider the following formatting changes to AliceO2Group#13773
@iarsene iarsene enabled auto-merge (squash) November 20, 2025 16:06
@iarsene iarsene merged commit fe31180 into AliceO2Group:master Nov 21, 2025
12 of 14 checks passed
lmattei01 pushed a commit to lmattei01/O2Physics that referenced this pull request Dec 5, 2025
Co-authored-by: minjungkim12 <minjungkim12@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants