diff --git a/PWGCF/EbyEFluctuations/Tasks/stronglyIntensiveCorr.cxx b/PWGCF/EbyEFluctuations/Tasks/stronglyIntensiveCorr.cxx index 75055d0fb41..e203411a377 100644 --- a/PWGCF/EbyEFluctuations/Tasks/stronglyIntensiveCorr.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/stronglyIntensiveCorr.cxx @@ -26,10 +26,14 @@ #include #include #include +#include #include #include #include +#include +#include + #include #include #include @@ -72,6 +76,16 @@ struct StronglyIntensiveCorr { Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Remove time intervals with bad ITS layers"}; Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV", true, "Good z-vertex FT0 vs PV cut"}; + // Eta-vertex-phi QA and occupancy selection. + Configurable cfgUseNoCollInTimeRangeStandard{"cfgUseNoCollInTimeRangeStandard", true, "Reject nearby collisions"}; + Configurable cfgUseOccupancyCut{"cfgUseOccupancyCut", true, "Apply track occupancy cut"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 500, "Minimum track occupancy (inclusive)"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 3000, "Maximum track occupancy (inclusive)"}; + Configurable cfgUseNoITSROFrameBorder{"cfgUseNoITSROFrameBorder", true, "Reject ITS readout frame borders"}; + Configurable cfgUseNoTimeFrameBorder{"cfgUseNoTimeFrameBorder", true, "Reject time frame borders"}; + Configurable cfgFillEtaVtxQA{"cfgFillEtaVtxQA", true, "Fill centrality-resolved eta versus vertex QA for data"}; + Configurable cfgFillEtaVtxPhiQA{"cfgFillEtaVtxPhiQA", true, "Fill centrality-resolved eta, vertex and phi QA for data"}; + Configurable cfgUseOnlyPhysicalPrimary{"cfgUseOnlyPhysicalPrimary", true, "MC truth: require physical primary"}; Configurable cfgUseOnlyChargedMC{"cfgUseOnlyChargedMC", true, "MC truth: require charged particle"}; @@ -136,6 +150,10 @@ struct StronglyIntensiveCorr { // ------------------------------------------------------------------ void init(InitContext&) { + if (cfgUseOccupancyCut.value && (cfgMinOccupancy.value < 0 || cfgMaxOccupancy.value < cfgMinOccupancy.value)) { + LOGF(fatal, "Invalid occupancy interval: require 0 <= cfgMinOccupancy <= cfgMaxOccupancy"); + } + AxisSpec centAxis = {100, 0.0, 100.0, "centrality (%)"}; std::vector centClassEdges(centEdges.begin(), centEdges.end()); AxisSpec centClassAxis = {centClassEdges, "centrality class (%)"}; @@ -205,6 +223,52 @@ struct StronglyIntensiveCorr { histos.add("eventQA/before/centFT0CvsFT0M", "before;FT0C;FT0M", kTH2D, {centAxis, centAxis}); histos.add("eventQA/after/centFT0CvsFT0M", "after;FT0C;FT0M", kTH2D, {centAxis, centAxis}); + // The centrality coordinate is the percentile, with full 10%-wide classes. + // The 4D QA has coarser z/eta bins to limit memory; its axes are cent,z,eta,phi. + if (cfgFillEtaVtxQA.value || cfgFillEtaVtxPhiQA.value) { + AxisSpec etaVtxZAxis = {400, -10.0, 10.0, "z_{vtx} (cm)"}; + histos.add("eventQA/after/vtxZvsCentClass", "Selected data events;centrality (%);z_{vtx} (cm)", kTH2D, {centClassAxis, etaVtxZAxis}); + histos.add("eventQA/after/centralityForEtaVtx", "Selected data events;centrality (%);events", kTH1D, {centAxis}); + if (cfgFillEtaVtxQA.value) { + AxisSpec etaVtxEtaBeforeAxis = {200, -1.0, 1.0, "#eta"}; + AxisSpec etaVtxEtaAfterAxis = {160, -0.8, 0.8, "#eta"}; + histos.add("trackQA/before/etaVsVtxZCent", "Tracks before manual selection in selected data events;centrality (%);z_{vtx} (cm);#eta", kTH3D, {centClassAxis, etaVtxZAxis, etaVtxEtaBeforeAxis}); + histos.add("trackQA/after/etaVsVtxZCent", "Selected data tracks;centrality (%);z_{vtx} (cm);#eta", kTH3D, {centClassAxis, etaVtxZAxis, etaVtxEtaAfterAxis}); + } + } + if (cfgFillEtaVtxPhiQA.value) { + AxisSpec etaVtxPhiZAxis = {200, -10.0, 10.0, "z_{vtx} (cm)"}; + AxisSpec etaVtxPhiEtaBeforeAxis = {100, -1.0, 1.0, "#eta"}; + AxisSpec etaVtxPhiEtaAfterAxis = {80, -0.8, 0.8, "#eta"}; + AxisSpec etaVtxPhiAxis = {36, 0.0, TwoPi, "#varphi (rad)"}; + // Dense THnD: about 108 MiB for both histograms, including flow bins. + histos.add("trackQA/before/etaVsVtxZPhiCent", "Tracks before manual selection in selected data events;centrality (%);z_{vtx} (cm);#eta;#varphi (rad)", kTHnD, {centClassAxis, etaVtxPhiZAxis, etaVtxPhiEtaBeforeAxis, etaVtxPhiAxis}); + histos.add("trackQA/after/etaVsVtxZPhiCent", "Selected data tracks;centrality (%);z_{vtx} (cm);#eta;#varphi (rad)", kTHnD, {centClassAxis, etaVtxPhiZAxis, etaVtxPhiEtaAfterAxis, etaVtxPhiAxis}); + } + + // Fine 1D occupancy retains the exact integer cut boundaries and -1. + // Coarser 2D occupancy keeps -1 in its own bin; >=20000 is overflow there. + AxisSpec occupancyAxis = {20002, -1.5, 20000.5, "track occupancy"}; + std::vector occupancyEdges = {-1.5, -0.5}; + for (int upper = 10; upper <= 20000; upper += 10) { + occupancyEdges.push_back(upper - 0.5); + } + AxisSpec occupancyVsCentAxis = {occupancyEdges, "track occupancy"}; + histos.add("eventQA/occupancy/beforeExtraCuts", "After original event-quality cuts, before extra cuts;track occupancy;events", kTH1D, {occupancyAxis}); + histos.add("eventQA/occupancy/beforeExtraCutsVsCent", "After original event-quality cuts, before extra cuts;centrality (%);track occupancy", kTH2D, {centAxis, occupancyVsCentAxis}); + histos.add("eventQA/occupancy/beforeOccupancyCut", "After nearby-collision rejection, before occupancy cut;track occupancy;events", kTH1D, {occupancyAxis}); + histos.add("eventQA/occupancy/beforeOccupancyCutVsCent", "After nearby-collision rejection, before occupancy cut;centrality (%);track occupancy", kTH2D, {centAxis, occupancyVsCentAxis}); + histos.add("eventQA/occupancy/after", "After all event selections including centrality;track occupancy;events", kTH1D, {occupancyAxis}); + histos.add("eventQA/occupancy/afterVsCent", "After all event selections including centrality;centrality (%);track occupancy", kTH2D, {centAxis, occupancyVsCentAxis}); + + const std::array eventSelectionLabels = { + "Input after collision filter", "Vertex z", "sel8", "Good ITS layers", "No same-bunch pileup", "Good FT0-PV z", "No ITS ROF border", "No TF border", "No nearby collision", "Occupancy interval", "Centrality / selected"}; + auto eventCounter = histos.get(HIST("QA/eventCounter")); + eventCounter->SetTitle("Sequential event selection;passed or disabled cut;collisions"); + for (unsigned int i = 0; i < eventSelectionLabels.size(); ++i) { + eventCounter->GetXaxis()->SetBinLabel(i + 1, eventSelectionLabels[i]); + } + // Track QA histos.add("trackQA/before/nITSClusters", "before;N ITS clusters;Counts", kTH1D, {itsClsAxis}); histos.add("trackQA/after/nITSClusters", "after;N ITS clusters;Counts", kTH1D, {itsClsAxis}); @@ -446,17 +510,51 @@ struct StronglyIntensiveCorr { } histos.fill(HIST("QA/eventCounter"), 6); + // Occupancy is supplied by EvSels, not the current event's nF or nB. + const int occupancy = coll.trackOccupancyInTimeRange(); + cent = getCentrality(coll); + const bool hasValidCentrality = std::isfinite(cent) && cent >= 0.f && cent < 100.f; + histos.fill(HIST("eventQA/occupancy/beforeExtraCuts"), occupancy); + if (hasValidCentrality) { + histos.fill(HIST("eventQA/occupancy/beforeExtraCutsVsCent"), cent, occupancy); + } + + if (cfgUseNoITSROFrameBorder.value && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; + } + histos.fill(HIST("QA/eventCounter"), 7); + + if (cfgUseNoTimeFrameBorder.value && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return false; + } + histos.fill(HIST("QA/eventCounter"), 8); + + if (cfgUseNoCollInTimeRangeStandard.value && !coll.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + histos.fill(HIST("QA/eventCounter"), 9); + + histos.fill(HIST("eventQA/occupancy/beforeOccupancyCut"), occupancy); + if (hasValidCentrality) { + histos.fill(HIST("eventQA/occupancy/beforeOccupancyCutVsCent"), cent, occupancy); + } + if (cfgUseOccupancyCut.value && (occupancy < cfgMinOccupancy.value || occupancy > cfgMaxOccupancy.value)) { + return false; + } + histos.fill(HIST("QA/eventCounter"), 10); + constexpr float MinCentrality = 0.f; constexpr float MaxCentrality = 100.f; - cent = getCentrality(coll); if (!std::isfinite(cent) || cent < MinCentrality || cent >= MaxCentrality) { return false; } if (cent < cfgCentMin.value || cent >= cfgCentMax.value) { return false; } - histos.fill(HIST("QA/eventCounter"), 7); + histos.fill(HIST("QA/eventCounter"), 11); + histos.fill(HIST("eventQA/occupancy/after"), occupancy); + histos.fill(HIST("eventQA/occupancy/afterVsCent"), cent, occupancy); return true; } @@ -985,6 +1083,30 @@ struct StronglyIntensiveCorr { fillSubsampleDifferentialEtaPtPhiMoments(subsampleIndex, nFPtPhi, nBPtPhi); } + template + void fillEtaVertexQA(float cent, float vertexZ, T const& track) + { + // Both stages use selected data events; "before" precedes selTrack(). + if (cfgFillEtaVtxQA.value) { + if constexpr (AfterSelection) { + histos.fill(HIST("trackQA/after/etaVsVtxZCent"), cent, vertexZ, track.eta()); + } else { + histos.fill(HIST("trackQA/before/etaVsVtxZCent"), cent, vertexZ, track.eta()); + } + } + if (cfgFillEtaVtxPhiQA.value && std::isfinite(track.phi())) { + double phi = std::fmod(static_cast(track.phi()), TwoPi); + if (phi < 0.0) { + phi += TwoPi; + } + if constexpr (AfterSelection) { + histos.fill(HIST("trackQA/after/etaVsVtxZPhiCent"), cent, vertexZ, track.eta(), phi); + } else { + histos.fill(HIST("trackQA/before/etaVsVtxZPhiCent"), cent, vertexZ, track.eta(), phi); + } + } + } + // ------------------------------------------------------------------ // Data // ------------------------------------------------------------------ @@ -998,6 +1120,10 @@ struct StronglyIntensiveCorr { return; } fillEventQAAfter(coll, cent); + if (cfgFillEtaVtxQA.value || cfgFillEtaVtxPhiQA.value) { + histos.fill(HIST("eventQA/after/vtxZvsCentClass"), cent, coll.posZ()); + histos.fill(HIST("eventQA/after/centralityForEtaVtx"), cent); + } std::array nF{}; std::array nB{}; @@ -1008,10 +1134,12 @@ struct StronglyIntensiveCorr { for (auto const& track : tracks) { fillTrackQABefore(track); + fillEtaVertexQA(cent, coll.posZ(), track); if (!selTrack(track)) { continue; } fillTrackQAAfter(track); + fillEtaVertexQA(cent, coll.posZ(), track); addToFBCounters(track.eta(), track.pt(), track.phi(), nF, nB, nFPtPhi, nBPtPhi); }