Skip to content

Commit 937072c

Browse files
authored
[PWGEM,PWGEM-36] PhotonMeson: Add additional checks in case of DF wit… (#14989)
1 parent 563799a commit 937072c

File tree

5 files changed

+95
-12
lines changed

5 files changed

+95
-12
lines changed

PWGEM/PhotonMeson/Core/EMCPhotonCut.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ class EMCPhotonCut : public TNamed
269269
/// \param fRegistry HistogramRegistry pointer of the main task
270270
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
271271
{
272+
if (clusters.size() <= 0) {
273+
return;
274+
}
272275
auto emcmatchedtrackIter = emcmatchedtracks.begin();
273276
auto emcmatchedtrackEnd = emcmatchedtracks.end();
274277
auto secondaryIter = secondaries.begin();

PWGEM/PhotonMeson/Core/V0PhotonCut.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ class V0PhotonCut : public TNamed
345345
template <o2::soa::is_table TV0, typename TLeg>
346346
void AreSelectedRunning(EMBitFlags& flags, TV0 const& v0s, o2::framework::HistogramRegistry* fRegistry = nullptr) const
347347
{
348+
if (v0s.size() <= 0) {
349+
return;
350+
}
348351
// auto legIter = legs.begin();
349352
// auto legEnd = legs.end();
350353
size_t iV0 = 0;

PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,11 @@ struct CalibTaskEmc {
813813
// Pi0 from EMCal
814814
void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
815815
{
816+
if (clusters.size() <= 0) {
817+
LOG(info) << "Skipping DF because there are not photons!";
818+
return;
819+
}
820+
816821
EMBitFlags flags(clusters.size());
817822
fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds, &registry);
818823

@@ -836,6 +841,10 @@ struct CalibTaskEmc {
836841
// Pi0 from EMCal
837842
void processEMCalMixed(FilteredCollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
838843
{
844+
if (clusters.size() <= 0) {
845+
LOG(info) << "Skipping DF because there are not photons!";
846+
return;
847+
}
839848
EMBitFlags flags(clusters.size());
840849
fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds);
841850

@@ -921,11 +930,19 @@ struct CalibTaskEmc {
921930
// PCM-EMCal same event
922931
void processEMCalPCMC(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
923932
{
933+
if (clusters.size() <= 0 && photons.size() <= 0) {
934+
LOG(info) << "Skipping DF because there are not photons!";
935+
return;
936+
}
924937
EMBitFlags emcFlags(clusters.size());
925-
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
938+
if (clusters.size() > 0) {
939+
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
940+
}
926941

927942
EMBitFlags v0flags(photons.size());
928-
fV0PhotonCut.AreSelectedRunning<decltype(photons), aod::V0Legs>(v0flags, photons, &registry);
943+
if (photons.size() > 0) {
944+
fV0PhotonCut.AreSelectedRunning<decltype(photons), aod::V0Legs>(v0flags, photons, &registry);
945+
}
929946

930947
for (const auto& collision : collisions) {
931948

@@ -989,6 +1006,10 @@ struct CalibTaskEmc {
9891006
// PCM-EMCal mixed event
9901007
void processEMCalPCMMixed(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
9911008
{
1009+
if (clusters.size() <= 0 && pcmPhotons.size() <= 0) {
1010+
LOG(info) << "Skipping DF because there are not photons!";
1011+
return;
1012+
}
9921013
using BinningTypeMixed = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C, emevent::EP2FT0C<emevent::Q2xFT0C, emevent::Q2yFT0C>>;
9931014
BinningTypeMixed binningOnPositions{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true};
9941015

@@ -997,10 +1018,14 @@ struct CalibTaskEmc {
9971018
Pair<CollsWithQvecs, EMCalPhotons, PCMPhotons, BinningTypeMixed> pairPCMEMC{binningOnPositions, mixingConfig.cfgMixingDepth, -1, collisions, associatedTables, &cache}; // indicates that mixingConfig.cfgMixingDepth events should be mixed and under/overflow (-1) to be ignored
9981019

9991020
EMBitFlags emcFlags(clusters.size());
1000-
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds);
1021+
if (clusters.size() > 0) {
1022+
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds);
1023+
}
10011024

10021025
EMBitFlags v0flags(pcmPhotons.size());
1003-
fV0PhotonCut.AreSelectedRunning<decltype(pcmPhotons), aod::V0Legs>(v0flags, pcmPhotons);
1026+
if (pcmPhotons.size() > 0) {
1027+
fV0PhotonCut.AreSelectedRunning<decltype(pcmPhotons), aod::V0Legs>(v0flags, pcmPhotons);
1028+
}
10041029

10051030
for (const auto& [c1, photonEMC, c2, photonPCM] : pairPCMEMC) {
10061031
if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) {
@@ -1067,6 +1092,10 @@ struct CalibTaskEmc {
10671092
// Pi0 from EMCal
10681093
void processPCM(CollsWithQvecs const& collisions, PCMPhotons const& photons, aod::V0Legs const&)
10691094
{
1095+
if (photons.size() <= 0) {
1096+
LOG(info) << "Skipping DF because there are not photons!";
1097+
return;
1098+
}
10701099
EMBitFlags v0flags(photons.size());
10711100
fV0PhotonCut.AreSelectedRunning<decltype(photons), aod::V0Legs>(v0flags, photons, &registry);
10721101
for (const auto& collision : collisions) {
@@ -1120,7 +1149,10 @@ struct CalibTaskEmc {
11201149
// PCM-EMCal mixed event
11211150
void processPCMMixed(FilteredCollsWithQvecs const& collisions, PCMPhotons const& pcmPhotons, aod::V0Legs const&)
11221151
{
1123-
1152+
if (pcmPhotons.size() <= 0) {
1153+
LOG(info) << "Skipping DF because there are not photons!";
1154+
return;
1155+
}
11241156
using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C, emevent::EP2FT0C<emevent::Q2xFT0C, emevent::Q2yFT0C>>;
11251157
BinningType binningMixedEvent{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true};
11261158

PWGEM/PhotonMeson/Tasks/photonResoTask.cxx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,18 @@ struct PhotonResoTask {
423423
// PCM-EMCal same event
424424
void processPcmEmcal(Colls const& collisions, EMCalPhotons const& clusters, PcmPhotons const& photons, PcmMcLegs const& legs, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds, EMMCParticles const& mcParticles)
425425
{
426+
if (clusters.size() <= 0 && photons.size() < 0) {
427+
LOG(info) << "Skipping DF because there are not photons!";
428+
return;
429+
}
426430
EMBitFlags emcFlags(clusters.size());
427-
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
428-
431+
if (clusters.size() > 0) {
432+
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
433+
}
429434
EMBitFlags v0flags(photons.size());
430-
fV0PhotonCut.AreSelectedRunning<decltype(photons), PcmMcLegs>(v0flags, photons, &registry);
435+
if (photons.size() > 0) {
436+
fV0PhotonCut.AreSelectedRunning<decltype(photons), PcmMcLegs>(v0flags, photons, &registry);
437+
}
431438

432439
// create iterators for photon mc particles
433440
auto mcPhoton1 = mcParticles.begin();

PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,10 @@ struct TaskPi0FlowEMC {
11001100
// Pi0 from EMCal
11011101
void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
11021102
{
1103+
if (clusters.size() <= 0) {
1104+
LOG(info) << "Skipping DF because there are not photons!";
1105+
return;
1106+
}
11031107
EMBitFlags flags(clusters.size());
11041108
fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds, &registry);
11051109

@@ -1149,6 +1153,10 @@ struct TaskPi0FlowEMC {
11491153
// Pi0 from EMCal
11501154
void processEMCalMixed(FilteredCollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
11511155
{
1156+
if (clusters.size() <= 0) {
1157+
LOG(info) << "Skipping DF because there are not photons!";
1158+
return;
1159+
}
11521160
EMBitFlags flags(clusters.size());
11531161
fEMCCut.AreSelectedRunning(flags, clusters, matchedPrims, matchedSeconds);
11541162
energyCorrectionFactor = 1.f;
@@ -1244,11 +1252,19 @@ struct TaskPi0FlowEMC {
12441252
// PCM-EMCal same event
12451253
void processEMCalPCMC(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
12461254
{
1255+
if (clusters.size() <= 0 && photons.size() <= 0) {
1256+
LOG(info) << "Skipping DF because there are not photons!";
1257+
return;
1258+
}
12471259
EMBitFlags emcFlags(clusters.size());
1248-
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
1260+
if (clusters.size() > 0) {
1261+
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
1262+
}
12491263

12501264
EMBitFlags v0flags(photons.size());
1251-
fV0PhotonCut.AreSelectedRunning<decltype(photons), aod::V0Legs>(v0flags, photons, &registry);
1265+
if (photons.size() > 0) {
1266+
fV0PhotonCut.AreSelectedRunning<decltype(photons), aod::V0Legs>(v0flags, photons, &registry);
1267+
}
12521268

12531269
energyCorrectionFactor = 1.f;
12541270
if (cfgDoReverseScaling.value) {
@@ -1333,6 +1349,11 @@ struct TaskPi0FlowEMC {
13331349
// PCM-EMCal mixed event
13341350
void processEMCalPCMMixed(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
13351351
{
1352+
if (clusters.size() <= 0 && pcmPhotons.size() <= 0) {
1353+
LOG(info) << "Skipping DF because there are not photons!";
1354+
return;
1355+
}
1356+
13361357
using BinningTypeMixed = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C, emevent::EP2FT0C<emevent::Q2xFT0C, emevent::Q2yFT0C>>;
13371358
BinningTypeMixed binningOnPositions{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true};
13381359

@@ -1342,10 +1363,14 @@ struct TaskPi0FlowEMC {
13421363

13431364
energyCorrectionFactor = 1.f;
13441365
EMBitFlags emcFlags(clusters.size());
1345-
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds);
1366+
if (clusters.size() > 0) {
1367+
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds, &registry);
1368+
}
13461369

13471370
EMBitFlags v0flags(pcmPhotons.size());
1348-
fV0PhotonCut.AreSelectedRunning<decltype(pcmPhotons), aod::V0Legs>(v0flags, pcmPhotons);
1371+
if (pcmPhotons.size() > 0) {
1372+
fV0PhotonCut.AreSelectedRunning<decltype(pcmPhotons), aod::V0Legs>(v0flags, pcmPhotons, &registry);
1373+
}
13491374

13501375
for (const auto& [c1, photonEMC, c2, photonPCM] : pairPCMEMC) {
13511376
if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) {
@@ -1417,6 +1442,10 @@ struct TaskPi0FlowEMC {
14171442
// Pi0 from EMCal
14181443
void processM02(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
14191444
{
1445+
if (clusters.size() <= 0) {
1446+
LOG(info) << "Skipping DF because there are not photons!";
1447+
return;
1448+
}
14201449
EMBitFlags emcFlags(clusters.size());
14211450
fEMCCut.AreSelectedRunning(emcFlags, clusters, matchedPrims, matchedSeconds);
14221451

@@ -1493,6 +1522,10 @@ struct TaskPi0FlowEMC {
14931522
// Pi0 from EMCal
14941523
void processPCM(CollsWithQvecs const& collisions, PCMPhotons const& photons, aod::V0Legs const&)
14951524
{
1525+
if (photons.size() <= 0) {
1526+
LOG(info) << "Skipping DF because there are not photons!";
1527+
return;
1528+
}
14961529
EMBitFlags v0flags(photons.size());
14971530
fV0PhotonCut.AreSelectedRunning<decltype(photons), aod::V0Legs>(v0flags, photons, &registry);
14981531
for (const auto& collision : collisions) {
@@ -1546,6 +1579,11 @@ struct TaskPi0FlowEMC {
15461579
void processPCMMixed(FilteredCollsWithQvecs const& collisions, PCMPhotons const& pcmPhotons, aod::V0Legs const&)
15471580
{
15481581

1582+
if (pcmPhotons.size() <= 0) {
1583+
LOG(info) << "Skipping DF because there are not photons!";
1584+
return;
1585+
}
1586+
15491587
using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C, emevent::EP2FT0C<emevent::Q2xFT0C, emevent::Q2yFT0C>>;
15501588
BinningType binningMixedEvent{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true};
15511589

0 commit comments

Comments
 (0)