diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h index 267d71d7fc4..aa42565e5ea 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h @@ -269,6 +269,9 @@ class EMCPhotonCut : public TNamed /// \param fRegistry HistogramRegistry pointer of the main task void AreSelectedRunning(EMBitFlags& flags, o2::soa::is_table auto const& clusters, IsTrackContainer auto const& emcmatchedtracks, IsTrackContainer auto const& secondaries, o2::framework::HistogramRegistry* fRegistry = nullptr) const { + if (clusters.size() <= 0) { + return; + } auto emcmatchedtrackIter = emcmatchedtracks.begin(); auto emcmatchedtrackEnd = emcmatchedtracks.end(); auto secondaryIter = secondaries.begin(); diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index d1b2edc3949..ba430be368b 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -345,6 +345,9 @@ class V0PhotonCut : public TNamed template void AreSelectedRunning(EMBitFlags& flags, TV0 const& v0s, o2::framework::HistogramRegistry* fRegistry = nullptr) const { + if (v0s.size() <= 0) { + return; + } // auto legIter = legs.begin(); // auto legEnd = legs.end(); size_t iV0 = 0; diff --git a/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx b/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx index 7c0d8af29fe..26820affed9 100644 --- a/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx +++ b/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx @@ -813,6 +813,11 @@ struct CalibTaskEmc { // Pi0 from EMCal void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } + EMBitFlags flags(clusters.size()); fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds, ®istry); @@ -836,6 +841,10 @@ struct CalibTaskEmc { // Pi0 from EMCal void processEMCalMixed(FilteredCollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags flags(clusters.size()); fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds); @@ -921,11 +930,19 @@ struct CalibTaskEmc { // PCM-EMCal same event void processEMCalPCMC(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0 && photons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags emcFlags(clusters.size()); - fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); + if (clusters.size() > 0) { + fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); + } EMBitFlags v0flags(photons.size()); - fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); + if (photons.size() > 0) { + fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); + } for (const auto& collision : collisions) { @@ -989,6 +1006,10 @@ struct CalibTaskEmc { // PCM-EMCal mixed event void processEMCalPCMMixed(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0 && pcmPhotons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } using BinningTypeMixed = ColumnBinningPolicy>; BinningTypeMixed binningOnPositions{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true}; @@ -997,10 +1018,14 @@ struct CalibTaskEmc { Pair pairPCMEMC{binningOnPositions, mixingConfig.cfgMixingDepth, -1, collisions, associatedTables, &cache}; // indicates that mixingConfig.cfgMixingDepth events should be mixed and under/overflow (-1) to be ignored EMBitFlags emcFlags(clusters.size()); - fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds); + if (clusters.size() > 0) { + fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds); + } EMBitFlags v0flags(pcmPhotons.size()); - fV0PhotonCut.AreSelectedRunning(v0flags, pcmPhotons); + if (pcmPhotons.size() > 0) { + fV0PhotonCut.AreSelectedRunning(v0flags, pcmPhotons); + } for (const auto& [c1, photonEMC, c2, photonPCM] : pairPCMEMC) { if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) { @@ -1067,6 +1092,10 @@ struct CalibTaskEmc { // Pi0 from EMCal void processPCM(CollsWithQvecs const& collisions, PCMPhotons const& photons, aod::V0Legs const&) { + if (photons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags v0flags(photons.size()); fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); for (const auto& collision : collisions) { @@ -1120,7 +1149,10 @@ struct CalibTaskEmc { // PCM-EMCal mixed event void processPCMMixed(FilteredCollsWithQvecs const& collisions, PCMPhotons const& pcmPhotons, aod::V0Legs const&) { - + if (pcmPhotons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } using BinningType = ColumnBinningPolicy>; BinningType binningMixedEvent{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true}; diff --git a/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx b/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx index 2c6cecf0a27..238f5b77715 100644 --- a/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx +++ b/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx @@ -423,11 +423,18 @@ struct PhotonResoTask { // PCM-EMCal same event void processPcmEmcal(Colls const& collisions, EMCalPhotons const& clusters, PcmPhotons const& photons, PcmMcLegs const& legs, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds, EMMCParticles const& mcParticles) { + if (clusters.size() <= 0 && photons.size() < 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags emcFlags(clusters.size()); - fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); - + if (clusters.size() > 0) { + fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); + } EMBitFlags v0flags(photons.size()); - fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); + if (photons.size() > 0) { + fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); + } // create iterators for photon mc particles auto mcPhoton1 = mcParticles.begin(); diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 97e1228323f..dfb0d5532ec 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -1100,6 +1100,10 @@ struct TaskPi0FlowEMC { // Pi0 from EMCal void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags flags(clusters.size()); fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds, ®istry); @@ -1149,6 +1153,10 @@ struct TaskPi0FlowEMC { // Pi0 from EMCal void processEMCalMixed(FilteredCollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags flags(clusters.size()); fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds); energyCorrectionFactor = 1.f; @@ -1244,11 +1252,19 @@ struct TaskPi0FlowEMC { // PCM-EMCal same event void processEMCalPCMC(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0 && photons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags emcFlags(clusters.size()); - fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); + if (clusters.size() > 0) { + fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); + } EMBitFlags v0flags(photons.size()); - fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); + if (photons.size() > 0) { + fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); + } energyCorrectionFactor = 1.f; if (cfgDoReverseScaling.value) { @@ -1333,6 +1349,11 @@ struct TaskPi0FlowEMC { // PCM-EMCal mixed event void processEMCalPCMMixed(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0 && pcmPhotons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } + using BinningTypeMixed = ColumnBinningPolicy>; BinningTypeMixed binningOnPositions{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true}; @@ -1342,10 +1363,14 @@ struct TaskPi0FlowEMC { energyCorrectionFactor = 1.f; EMBitFlags emcFlags(clusters.size()); - fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds); + if (clusters.size() > 0) { + fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, ®istry); + } EMBitFlags v0flags(pcmPhotons.size()); - fV0PhotonCut.AreSelectedRunning(v0flags, pcmPhotons); + if (pcmPhotons.size() > 0) { + fV0PhotonCut.AreSelectedRunning(v0flags, pcmPhotons, ®istry); + } for (const auto& [c1, photonEMC, c2, photonPCM] : pairPCMEMC) { if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) { @@ -1417,6 +1442,10 @@ struct TaskPi0FlowEMC { // Pi0 from EMCal void processM02(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { + if (clusters.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags emcFlags(clusters.size()); fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds); @@ -1493,6 +1522,10 @@ struct TaskPi0FlowEMC { // Pi0 from EMCal void processPCM(CollsWithQvecs const& collisions, PCMPhotons const& photons, aod::V0Legs const&) { + if (photons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } EMBitFlags v0flags(photons.size()); fV0PhotonCut.AreSelectedRunning(v0flags, photons, ®istry); for (const auto& collision : collisions) { @@ -1546,6 +1579,11 @@ struct TaskPi0FlowEMC { void processPCMMixed(FilteredCollsWithQvecs const& collisions, PCMPhotons const& pcmPhotons, aod::V0Legs const&) { + if (pcmPhotons.size() <= 0) { + LOG(info) << "Skipping DF because there are not photons!"; + return; + } + using BinningType = ColumnBinningPolicy>; BinningType binningMixedEvent{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true};