Skip to content

Commit 9014de9

Browse files
committed
McReco for Phi efficiency
1 parent aa1f057 commit 9014de9

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ struct PhiMesonCandProducer {
196196
}
197197
}
198198

199-
PROCESS_SWITCH(PhiMesonCandProducer, processData, "Process function to select Phi meson candidates in Data", true);
199+
PROCESS_SWITCH(PhiMesonCandProducer, processData, "Process function to select Phi meson candidates in Data or in ", true);
200200

201201
void processMCRecoDataLike(SimCollisions::iterator const& collision, FullMCTracks const&)
202202
{
@@ -227,18 +227,24 @@ struct PhiMesonCandProducer {
227227

228228
PROCESS_SWITCH(PhiMesonCandProducer, processMCRecoDataLike, "Process function to select Phi meson candidates in MCReco w/o MC truth", false);
229229

230-
/*void processMCReco(SimCollisions::iterator const& collision, FullMCTracks const&)
230+
void processMCReco(SimCollisions::iterator const& collision, FullMCTracks const&, aod::McParticles const& mcParticles)
231231
{
232232
auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
233233
auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
234234

235235
for (const auto& track1 : posThisColl) {
236236
if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1))
237237
continue;
238+
if (!track1.has_mcParticle())
239+
continue;
240+
const auto track1McParticle = mcParticles.rawIteratorAt(track1.mcParticleId());
238241

239242
for (const auto& track2 : negThisColl) {
240243
if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2))
241244
continue;
245+
if (!track2.has_mcParticle())
246+
continue;
247+
const auto track2McParticle = mcParticles.rawIteratorAt(track2.mcParticleId());
242248

243249
ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa);
244250

@@ -249,12 +255,34 @@ struct PhiMesonCandProducer {
249255
if (std::abs(recPhi.Rapidity()) > phiConfigs.cfgYAcceptance)
250256
continue;
251257

252-
phimesonCandidatesMcReco(collision.globalIndex(), recPhi.M(), recPhi.Pt(), recPhi.Rapidity(), recPhi.Phi());
258+
const auto track1mcPartMotherIndexes = track1McParticle.motherIds();
259+
const auto track2mcPartMotherIndexes = track2McParticle.motherIds();
260+
261+
auto genPhiMaybe = [&]() -> std::optional<aod::McParticles::iterator> {
262+
for (const auto& mother1Index : track1mcPartMotherIndexes) {
263+
for (const auto& mother2Index : track2mcPartMotherIndexes) {
264+
if (mother1Index != mother2Index)
265+
continue;
266+
267+
const auto motherMcParticle = mcParticles.rawIteratorAt(mother1Index);
268+
if (std::abs(motherMcParticle.pdgCode()) == o2::constants::physics::Pdg::kPhi)
269+
return motherMcParticle;
270+
}
271+
}
272+
273+
return std::nullopt;
274+
}();
275+
276+
if (!genPhiMaybe)
277+
continue;
278+
const auto genPhi = *genPhiMaybe;
279+
280+
phimesonCandidatesMcReco(collision.globalIndex(), recPhi.M(), genPhi.pt(), genPhi.y(), genPhi.phi());
253281
}
254282
}
255283
}
256284

257-
PROCESS_SWITCH(PhiMesonCandProducer, processMCReco, "Process function to select Phi meson candidates in MCReco w MC truth", false);*/
285+
PROCESS_SWITCH(PhiMesonCandProducer, processMCReco, "Process function to select Phi meson candidates in MCReco w MC truth", false);
258286

259287
void processMCGen(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles)
260288
{

0 commit comments

Comments
 (0)