Skip to content

Commit 09176f5

Browse files
authored
[PWGCF] accept negative ZDC channel energies in custom event-sel in energyFlo… (#18466)
1 parent fd8302a commit 09176f5

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎PWGCF/GenericFramework/Tasks/energyFlowGfw.cxx‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ struct EnergyFlowGfw {
348348
registry.add("zdc/energyZnVsNGlobalTracks", "Triggered events with finite ZN energies;N_{global tracks};E_{ZNA}+E_{ZNC}", HistType::kTH2F, {axisZdcTrackMultiplicity, axisZdcTotalEnergy});
349349
registry.add("zdc/energyZpVsNGlobalTracks", "Triggered events with finite ZP energies;N_{global tracks};E_{ZPA}+E_{ZPC}", HistType::kTH2F, {axisZdcTrackMultiplicity, axisZdcTotalEnergy});
350350
registry.add("zdc/energyTotalVsNGlobalTracks", "Triggered events with finite common energies;N_{global tracks};#Sigma E_{ZDC}^{common}", HistType::kTH2F, {axisZdcTrackMultiplicity, axisZdcTotalEnergy});
351-
registry.add("zdc/spectatorEstimateVsNGlobalTracks", "Triggered events passing current nonnegative-energy requirement;N_{global tracks};current N_{spectators} estimate", HistType::kTH2F, {axisZdcTrackMultiplicity, axisTotalSpectators});
351+
registry.add("zdc/spectatorEstimateVsNGlobalTracks", "Triggered events with finite common energies;N_{global tracks};N_{spectators} estimate", HistType::kTH2F, {axisZdcTrackMultiplicity, axisTotalSpectators});
352352
registry.add("zdc/energyZnVsCentrality", "Triggered events with finite ZN energies;centrality (%);E_{ZNA}+E_{ZNC}", HistType::kTH2F, {axisCentrality, axisZdcTotalEnergy});
353353
registry.add("zdc/energyZpVsCentrality", "Triggered events with finite ZP energies;centrality (%);E_{ZPA}+E_{ZPC}", HistType::kTH2F, {axisCentrality, axisZdcTotalEnergy});
354354
registry.add("zdc/energyTotalVsCentrality", "Triggered events with finite common energies;centrality (%);#Sigma E_{ZDC}^{common}", HistType::kTH2F, {axisCentrality, axisZdcTotalEnergy});
355-
registry.add("zdc/spectatorEstimateVsCentrality", "Triggered events passing current nonnegative-energy requirement;centrality (%);current N_{spectators} estimate", HistType::kTH2F, {axisCentrality, axisTotalSpectators});
355+
registry.add("zdc/spectatorEstimateVsCentrality", "Triggered events with finite common energies;centrality (%);N_{spectators} estimate", HistType::kTH2F, {axisCentrality, axisTotalSpectators});
356356
registry.add("zdc/meanZNAByNGlobalTracks", "Mean ZNA response;N_{global tracks};#LT E_{ZNA} #GT", HistType::kTProfile, {axisZdcTrackMultiplicity});
357357
registry.add("zdc/meanZNCByNGlobalTracks", "Mean ZNC response;N_{global tracks};#LT E_{ZNC} #GT", HistType::kTProfile, {axisZdcTrackMultiplicity});
358358
registry.add("zdc/meanZPAByNGlobalTracks", "Mean ZPA response;N_{global tracks};#LT E_{ZPA} #GT", HistType::kTProfile, {axisZdcTrackMultiplicity});
@@ -402,12 +402,14 @@ struct EnergyFlowGfw {
402402
float totalEnergy = 0.f;
403403
for (int index = 0; index < 4; ++index) {
404404
const float value = energies[index];
405-
if (!std::isfinite(value) || value < 0.f) {
405+
if (!std::isfinite(value)) {
406406
return -1.f;
407407
}
408408
totalEnergy += value / responseFactors[index];
409409
}
410-
return totalEnergy / cfgSpectatorEnergyPerNucleon.value;
410+
const float spectators = totalEnergy / cfgSpectatorEnergyPerNucleon.value;
411+
// Preserve signed pedestal fluctuations in the sum, then enforce the physical boundary.
412+
return std::isfinite(spectators) ? std::max(0.f, spectators) : -1.f;
411413
}
412414

413415
template <typename TZdc>
@@ -557,8 +559,8 @@ struct EnergyFlowGfw {
557559
registry.fill(HIST("zdc/energyTotalVsCentrality"), centrality, totalEnergy);
558560
registry.fill(HIST("zdc/meanTotalByCentrality"), centrality, totalEnergy);
559561
}
560-
if (allNonnegative) {
561-
const float spectators = totalSpectators(zdc);
562+
const float spectators = totalSpectators(zdc);
563+
if (spectators >= 0.f) {
562564
registry.fill(HIST("zdc/spectatorEstimateVsNGlobalTracks"), numberOfGlobalTracks, spectators);
563565
if (validCentrality) {
564566
registry.fill(HIST("zdc/spectatorEstimateVsCentrality"), centrality, spectators);

0 commit comments

Comments
 (0)