Skip to content

Commit 5c4394f

Browse files
minjungkim12claude
andcommitted
[PWGDQ] Fix pileup flag bit operations for float values array
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>
1 parent a7a895f commit 5c4394f

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

PWGDQ/Core/VarManager.h

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5359,6 +5359,18 @@ void VarManager::FillFIT(uint64_t midbc, std::vector<std::pair<uint64_t, int64_t
53595359
uint64_t leftBC = midbc >= scanRange ? midbc - scanRange : 0;
53605360
uint64_t rightBC = midbc + scanRange;
53615361

5362+
// Use int32_t for bit operations, then convert to float for storage
5363+
int32_t bgFT0Apf = static_cast<int32_t>(values[kBGFT0Apf]);
5364+
int32_t bgFT0Cpf = static_cast<int32_t>(values[kBGFT0Cpf]);
5365+
int32_t bbFT0Apf = static_cast<int32_t>(values[kBBFT0Apf]);
5366+
int32_t bbFT0Cpf = static_cast<int32_t>(values[kBBFT0Cpf]);
5367+
int32_t bgFV0Apf = static_cast<int32_t>(values[kBGFV0Apf]);
5368+
int32_t bbFV0Apf = static_cast<int32_t>(values[kBBFV0Apf]);
5369+
int32_t bgFDDApf = static_cast<int32_t>(values[kBGFDDApf]);
5370+
int32_t bgFDDCpf = static_cast<int32_t>(values[kBGFDDCpf]);
5371+
int32_t bbFDDApf = static_cast<int32_t>(values[kBBFDDApf]);
5372+
int32_t bbFDDCpf = static_cast<int32_t>(values[kBBFDDCpf]);
5373+
53625374
// Find starting BC in bcMap
53635375
std::pair<uint64_t, int64_t> searchPair(leftBC, 0);
53645376
auto scanIt = std::lower_bound(bcMap.begin(), bcMap.end(), searchPair,
@@ -5377,25 +5389,25 @@ void VarManager::FillFIT(uint64_t midbc, std::vector<std::pair<uint64_t, int64_t
53775389

53785390
// Fill pileup flags using BC selection bits (following PWGUD pattern)
53795391
if (!bc.selection_bit(o2::aod::evsel::kNoBGT0A))
5380-
values[kBGFT0Apf] |= (1 << bit);
5392+
bgFT0Apf |= (1 << bit);
53815393
if (!bc.selection_bit(o2::aod::evsel::kNoBGT0C))
5382-
values[kBGFT0Cpf] |= (1 << bit);
5394+
bgFT0Cpf |= (1 << bit);
53835395
if (bc.selection_bit(o2::aod::evsel::kIsBBT0A))
5384-
values[kBBFT0Apf] |= (1 << bit);
5396+
bbFT0Apf |= (1 << bit);
53855397
if (bc.selection_bit(o2::aod::evsel::kIsBBT0C))
5386-
values[kBBFT0Cpf] |= (1 << bit);
5398+
bbFT0Cpf |= (1 << bit);
53875399
if (!bc.selection_bit(o2::aod::evsel::kNoBGV0A))
5388-
values[kBGFV0Apf] |= (1 << bit);
5400+
bgFV0Apf |= (1 << bit);
53895401
if (bc.selection_bit(o2::aod::evsel::kIsBBV0A))
5390-
values[kBBFV0Apf] |= (1 << bit);
5402+
bbFV0Apf |= (1 << bit);
53915403
if (!bc.selection_bit(o2::aod::evsel::kNoBGFDA))
5392-
values[kBGFDDApf] |= (1 << bit);
5404+
bgFDDApf |= (1 << bit);
53935405
if (!bc.selection_bit(o2::aod::evsel::kNoBGFDC))
5394-
values[kBGFDDCpf] |= (1 << bit);
5406+
bgFDDCpf |= (1 << bit);
53955407
if (bc.selection_bit(o2::aod::evsel::kIsBBFDA))
5396-
values[kBBFDDApf] |= (1 << bit);
5408+
bbFDDApf |= (1 << bit);
53975409
if (bc.selection_bit(o2::aod::evsel::kIsBBFDC))
5398-
values[kBBFDDCpf] |= (1 << bit);
5410+
bbFDDCpf |= (1 << bit);
53995411
}
54005412

54015413
++scanIt;
@@ -5405,6 +5417,18 @@ void VarManager::FillFIT(uint64_t midbc, std::vector<std::pair<uint64_t, int64_t
54055417
}
54065418
}
54075419

5420+
// Convert back to float and store in values array
5421+
values[kBGFT0Apf] = static_cast<float>(bgFT0Apf);
5422+
values[kBGFT0Cpf] = static_cast<float>(bgFT0Cpf);
5423+
values[kBBFT0Apf] = static_cast<float>(bbFT0Apf);
5424+
values[kBBFT0Cpf] = static_cast<float>(bbFT0Cpf);
5425+
values[kBGFV0Apf] = static_cast<float>(bgFV0Apf);
5426+
values[kBBFV0Apf] = static_cast<float>(bbFV0Apf);
5427+
values[kBGFDDApf] = static_cast<float>(bgFDDApf);
5428+
values[kBGFDDCpf] = static_cast<float>(bgFDDCpf);
5429+
values[kBBFDDApf] = static_cast<float>(bbFDDApf);
5430+
values[kBBFDDCpf] = static_cast<float>(bbFDDCpf);
5431+
54085432
// Note: Distance to closest BCs with specific triggers (TOR, TSC, TVX, V0A, T0A)
54095433
// would require scanning a larger range and checking trigger information.
54105434
// For now, these remain at default values (999) as the implementation would need

0 commit comments

Comments
 (0)