Skip to content

Commit 5c281f6

Browse files
[PWGLF] safeguard when getting MC info of V0s (#15104)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 7b7d61f commit 5c281f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

PWGLF/TableProducer/Strangeness/sigma0builder.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,11 +1244,18 @@ struct sigma0builder {
12441244
template <typename TCollision, typename TV0Object>
12451245
void analyzeV0CollAssoc(TCollision const& collision, TV0Object const& fullv0s, std::vector<int> selV0Indices, bool isPhotonAnalysis)
12461246
{
1247+
if (!collision.has_straMCCollision())
1248+
return;
1249+
12471250
auto v0MCCollision = collision.template straMCCollision_as<soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>>();
12481251
float IR = (fGetIR) ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource, fIRCrashOnNull) * 1.e-3 : -1;
12491252

12501253
for (size_t i = 0; i < selV0Indices.size(); ++i) {
12511254
auto v0 = fullv0s.rawIteratorAt(selV0Indices[i]);
1255+
1256+
if (!v0.has_v0MCCore())
1257+
continue;
1258+
12521259
auto v0MC = v0.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();
12531260

12541261
float V0MCpT = RecoDecay::pt(array<float, 2>{v0MC.pxMC(), v0MC.pyMC()});

0 commit comments

Comments
 (0)