@@ -344,11 +344,11 @@ struct EnergyFlowGfw {
344344 registry.add (" zdc/energyZnVsNGlobalTracks" , " Triggered events with finite ZN energies;N_{global tracks};E_{ZNA}+E_{ZNC}" , HistType::kTH2F , {axisZdcTrackMultiplicity, axisZdcTotalEnergy});
345345 registry.add (" zdc/energyZpVsNGlobalTracks" , " Triggered events with finite ZP energies;N_{global tracks};E_{ZPA}+E_{ZPC}" , HistType::kTH2F , {axisZdcTrackMultiplicity, axisZdcTotalEnergy});
346346 registry.add (" zdc/energyTotalVsNGlobalTracks" , " Triggered events with finite common energies;N_{global tracks};#Sigma E_{ZDC}^{common}" , HistType::kTH2F , {axisZdcTrackMultiplicity, axisZdcTotalEnergy});
347- registry.add (" zdc/spectatorEstimateVsNGlobalTracks" , " Triggered events passing current nonnegative-energy requirement ;N_{global tracks};current N_{spectators} estimate" , HistType::kTH2F , {axisZdcTrackMultiplicity, axisTotalSpectators});
347+ registry.add (" zdc/spectatorEstimateVsNGlobalTracks" , " Triggered events with finite common energies ;N_{global tracks};N_{spectators} estimate" , HistType::kTH2F , {axisZdcTrackMultiplicity, axisTotalSpectators});
348348 registry.add (" zdc/energyZnVsCentrality" , " Triggered events with finite ZN energies;centrality (%);E_{ZNA}+E_{ZNC}" , HistType::kTH2F , {axisCentrality, axisZdcTotalEnergy});
349349 registry.add (" zdc/energyZpVsCentrality" , " Triggered events with finite ZP energies;centrality (%);E_{ZPA}+E_{ZPC}" , HistType::kTH2F , {axisCentrality, axisZdcTotalEnergy});
350350 registry.add (" zdc/energyTotalVsCentrality" , " Triggered events with finite common energies;centrality (%);#Sigma E_{ZDC}^{common}" , HistType::kTH2F , {axisCentrality, axisZdcTotalEnergy});
351- registry.add (" zdc/spectatorEstimateVsCentrality" , " Triggered events passing current nonnegative-energy requirement ;centrality (%);current N_{spectators} estimate" , HistType::kTH2F , {axisCentrality, axisTotalSpectators});
351+ registry.add (" zdc/spectatorEstimateVsCentrality" , " Triggered events with finite common energies ;centrality (%);N_{spectators} estimate" , HistType::kTH2F , {axisCentrality, axisTotalSpectators});
352352 registry.add (" zdc/meanZNAByNGlobalTracks" , " Mean ZNA response;N_{global tracks};#LT E_{ZNA} #GT" , HistType::kTProfile , {axisZdcTrackMultiplicity});
353353 registry.add (" zdc/meanZNCByNGlobalTracks" , " Mean ZNC response;N_{global tracks};#LT E_{ZNC} #GT" , HistType::kTProfile , {axisZdcTrackMultiplicity});
354354 registry.add (" zdc/meanZPAByNGlobalTracks" , " Mean ZPA response;N_{global tracks};#LT E_{ZPA} #GT" , HistType::kTProfile , {axisZdcTrackMultiplicity});
@@ -398,12 +398,14 @@ struct EnergyFlowGfw {
398398 float totalEnergy = 0 .f ;
399399 for (int index = 0 ; index < 4 ; ++index) {
400400 const float value = energies[index];
401- if (!std::isfinite (value) || value < 0 . f ) {
401+ if (!std::isfinite (value)) {
402402 return -1 .f ;
403403 }
404404 totalEnergy += value / responseFactors[index];
405405 }
406- return totalEnergy / cfgSpectatorEnergyPerNucleon.value ;
406+ const float spectators = totalEnergy / cfgSpectatorEnergyPerNucleon.value ;
407+ // Preserve signed pedestal fluctuations in the sum, then enforce the physical boundary.
408+ return std::isfinite (spectators) ? std::max (0 .f , spectators) : -1 .f ;
407409 }
408410
409411 template <typename TZdc>
@@ -553,8 +555,8 @@ struct EnergyFlowGfw {
553555 registry.fill (HIST (" zdc/energyTotalVsCentrality" ), centrality, totalEnergy);
554556 registry.fill (HIST (" zdc/meanTotalByCentrality" ), centrality, totalEnergy);
555557 }
556- if (allNonnegative) {
557- const float spectators = totalSpectators (zdc);
558+ const float spectators = totalSpectators (zdc);
559+ if ( spectators >= 0 . f ) {
558560 registry.fill (HIST (" zdc/spectatorEstimateVsNGlobalTracks" ), numberOfGlobalTracks, spectators);
559561 if (validCentrality) {
560562 registry.fill (HIST (" zdc/spectatorEstimateVsCentrality" ), centrality, spectators);
0 commit comments