Skip to content

Commit 36a6b35

Browse files
authored
[PWGLF] Changed delta phi computation + phi in McReco for efficiency (#14565)
1 parent eab46c3 commit 36a6b35

File tree

3 files changed

+108
-17
lines changed

3 files changed

+108
-17
lines changed

PWGLF/DataModel/LFPhiStrangeCorrelationTables.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@ DECLARE_SOA_DYNAMIC_COLUMN(InMassRegion, inMassRegion,
3737
});
3838
} // namespace lf_selection_phi_candidate
3939

40-
DECLARE_SOA_TABLE(PhimesonCandidatesData, "AOD", "PHICANDIDATESDATA",
40+
DECLARE_SOA_TABLE(PhimesonCandidatesData, "AOD", "PHICANDDATA",
4141
lf_selection_phi_candidate::CollisionId,
4242
lf_selection_phi_candidate::M,
4343
lf_selection_phi_candidate::Pt,
4444
lf_selection_phi_candidate::Y,
4545
lf_selection_phi_candidate::Phi,
4646
lf_selection_phi_candidate::InMassRegion<lf_selection_phi_candidate::M>);
4747

48-
DECLARE_SOA_TABLE(PhimesonCandidatesMcReco, "AOD", "PHICANDIDATESMCRECO",
48+
DECLARE_SOA_TABLE(PhimesonCandidatesMcReco, "AOD", "PHICANDMCRECO",
4949
lf_selection_phi_candidate::CollisionId,
5050
lf_selection_phi_candidate::M,
5151
lf_selection_phi_candidate::Pt,
5252
lf_selection_phi_candidate::Y,
5353
lf_selection_phi_candidate::Phi,
5454
lf_selection_phi_candidate::InMassRegion<lf_selection_phi_candidate::M>);
5555

56-
DECLARE_SOA_TABLE(PhimesonCandidatesMcGen, "AOD", "PHICANDIDATESMCGEN",
56+
DECLARE_SOA_TABLE(PhimesonCandidatesMcGen, "AOD", "PHICANDMCGEN",
5757
lf_selection_phi_candidate::CollisionId,
5858
lf_selection_phi_candidate::M,
5959
lf_selection_phi_candidate::Pt,

PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ using namespace o2::framework::expressions;
6262
struct PhiMesonCandProducer {
6363
// Produce the table with the phi candidates information
6464
Produces<aod::PhimesonCandidatesData> phimesonCandidatesData;
65-
// Produces<aod::PhimesonCandidatesMcReco> phimesonCandidatesMcReco;
65+
Produces<aod::PhimesonCandidatesMcReco> phimesonCandidatesMcReco;
6666
Produces<aod::PhimesonCandidatesMcGen> phimesonCandidatesMcGen;
6767

6868
HistogramRegistry histos{"phiCandidates", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
@@ -196,8 +196,9 @@ 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 McReco (w/o McTruth) analysis", true);
200200

201+
/*
201202
void processMCRecoDataLike(SimCollisions::iterator const& collision, FullMCTracks const&)
202203
{
203204
auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
@@ -226,19 +227,30 @@ struct PhiMesonCandProducer {
226227
}
227228
228229
PROCESS_SWITCH(PhiMesonCandProducer, processMCRecoDataLike, "Process function to select Phi meson candidates in MCReco w/o MC truth", false);
230+
*/
229231

230-
/*void processMCReco(SimCollisions::iterator const& collision, FullMCTracks const&)
232+
void processMCReco(SimCollisions::iterator const& collision, FullMCTracks const&, aod::McParticles const& mcParticles)
231233
{
232234
auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
233235
auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
234236

235237
for (const auto& track1 : posThisColl) {
236238
if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1))
237239
continue;
240+
if (!track1.has_mcParticle())
241+
continue;
242+
const auto track1McParticle = mcParticles.rawIteratorAt(track1.mcParticleId());
243+
if (track1McParticle.pdgCode() != PDG_t::kKPlus || !track1McParticle.isPhysicalPrimary())
244+
continue;
238245

239246
for (const auto& track2 : negThisColl) {
240247
if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2))
241248
continue;
249+
if (!track2.has_mcParticle())
250+
continue;
251+
const auto track2McParticle = mcParticles.rawIteratorAt(track2.mcParticleId());
252+
if (track2McParticle.pdgCode() != PDG_t::kKMinus || !track2McParticle.isPhysicalPrimary())
253+
continue;
242254

243255
ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa);
244256

@@ -249,12 +261,34 @@ struct PhiMesonCandProducer {
249261
if (std::abs(recPhi.Rapidity()) > phiConfigs.cfgYAcceptance)
250262
continue;
251263

252-
phimesonCandidatesMcReco(collision.globalIndex(), recPhi.M(), recPhi.Pt(), recPhi.Rapidity(), recPhi.Phi());
264+
const auto track1mcPartMotherIndexes = track1McParticle.mothersIds();
265+
const auto track2mcPartMotherIndexes = track2McParticle.mothersIds();
266+
267+
auto genPhiMaybe = [&]() -> std::optional<aod::McParticles::iterator> {
268+
for (const auto& mother1Index : track1mcPartMotherIndexes) {
269+
for (const auto& mother2Index : track2mcPartMotherIndexes) {
270+
if (mother1Index != mother2Index)
271+
continue;
272+
273+
const auto motherMcParticle = mcParticles.rawIteratorAt(mother1Index);
274+
if (std::abs(motherMcParticle.pdgCode()) == o2::constants::physics::Pdg::kPhi)
275+
return motherMcParticle;
276+
}
277+
}
278+
279+
return std::nullopt;
280+
}();
281+
282+
if (!genPhiMaybe)
283+
continue;
284+
const auto genPhi = *genPhiMaybe;
285+
286+
phimesonCandidatesMcReco(collision.globalIndex(), recPhi.M(), genPhi.pt(), genPhi.y(), genPhi.phi());
253287
}
254288
}
255289
}
256290

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

259293
void processMCGen(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles)
260294
{

PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "PWGLF/DataModel/mcCentrality.h"
1919
#include "PWGLF/Utils/inelGt.h"
2020

21+
#include "Common/Core/RecoDecay.h"
2122
#include "Common/Core/TableHelper.h"
2223
#include "Common/Core/TrackSelection.h"
2324
#include "Common/Core/TrackSelectionDefaults.h"
@@ -282,7 +283,8 @@ struct PhiStrangenessCorrelation {
282283
Preslice<SimCollisions> collPerMCCollision = aod::mccollisionlabel::mcCollisionId;
283284
Preslice<FullMCV0s> v0PerCollision = aod::v0::collisionId;
284285
Preslice<FullMCTracks> trackPerCollision = aod::track::collisionId;
285-
PresliceUnsorted<aod::PhimesonCandidatesData> phiCandPerCollision = aod::lf_selection_phi_candidate::collisionId;
286+
// Preslice<aod::PhimesonCandidatesData> phiCandDataPerCollision = aod::lf_selection_phi_candidate::collisionId;
287+
PresliceUnsorted<aod::PhimesonCandidatesMcReco> phiCandPerCollision = aod::lf_selection_phi_candidate::collisionId;
286288

287289
// Preslice<aod::McParticles> mcPartPerMCCollision = aod::mcparticle::mcCollisionId;
288290
} preslices;
@@ -316,8 +318,11 @@ struct PhiStrangenessCorrelation {
316318

317319
histos.add("phi/h3PhiData", "Invariant mass of Phi in Data", kTH3F, {binnedmultAxis, binnedpTPhiAxis, massPhiAxis});
318320
for (const auto& label : phiMassRegionLabels) {
319-
histos.add(fmt::format("phiK0S/h5PhiK0SData2PartCorr{}", label).c_str(), "Deltay vs deltaphi for Phi and K0Short in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
320-
histos.add(fmt::format("phiPi/h5PhiPiData2PartCorr{}", label).c_str(), "Deltay vs deltaphi for Phi and Pion in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
321+
histos.add(fmt::format("phiK0S/h5PhiK0SData{}", label).c_str(), "Deltay vs deltaphi for Phi and K0Short in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
322+
histos.add(fmt::format("phiPi/h5PhiPiData{}", label).c_str(), "Deltay vs deltaphi for Phi and Pion in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
323+
324+
histos.add(fmt::format("phiK0S/h5PhiK0SDataME{}", label).c_str(), "Deltay vs deltaphi for Phi and K0Short in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
325+
histos.add(fmt::format("phiPi/h5PhiPiDataME{}", label).c_str(), "Deltay vs deltaphi for Phi and Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
321326
}
322327

323328
// histos.add("phiK0S/h5PhiK0SDataNewProc", "2D Invariant mass of Phi and K0Short in Data", kTHnSparseF, {deltayAxis, binnedmultAxis, binnedpTK0SAxis, massK0SAxis, massPhiAxis});
@@ -380,6 +385,11 @@ struct PhiStrangenessCorrelation {
380385
return totalEfficiency <= 0.0f ? 1.0f : 1.0f / totalEfficiency;
381386
}
382387

388+
float getDeltaPhi(float phiTrigger, float phiAssociated)
389+
{
390+
return RecoDecay::constrainAngle(phiTrigger - phiAssociated, -o2::constants::math::PIHalf);
391+
}
392+
383393
// Single track selection for strangeness sector
384394
template <typename T>
385395
bool selectionTrackStrangeness(const T& track)
@@ -522,7 +532,7 @@ struct PhiStrangenessCorrelation {
522532
return true;
523533
}
524534

525-
void processPhiK0SPionDeltayDeltaphiData2D(SelCollisions::iterator const& collision, aod::PhimesonCandidatesData const& phiCandidates, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&)
535+
void processPhiK0SPionData(SelCollisions::iterator const& collision, aod::PhimesonCandidatesData const& phiCandidates, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&)
526536
{
527537
float multiplicity = collision.centFT0M();
528538

@@ -555,7 +565,7 @@ struct PhiStrangenessCorrelation {
555565
/*float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()),
556566
BoundEfficiencyMap(effMapK0S, multiplicity, v0.pt(), v0.yK0Short()));*/
557567

558-
histos.fill(HIST("phiK0S/h5PhiK0SData2PartCorr") + HIST(phiMassRegionLabels[i]), multiplicity, phiCand.pt(), v0.pt(), phiCand.y() - v0.yK0Short(), phiCand.phi() - v0.phi(), weightPhiK0S);
568+
histos.fill(HIST("phiK0S/h5PhiK0SData") + HIST(phiMassRegionLabels[i]), multiplicity, phiCand.pt(), v0.pt(), phiCand.y() - v0.yK0Short(), getDeltaPhi(phiCand.phi(), v0.phi()), weightPhiK0S);
559569
}
560570

561571
// Loop over all primary pion candidates
@@ -573,15 +583,62 @@ struct PhiStrangenessCorrelation {
573583
float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()),
574584
BoundEfficiencyMap(effMapPion, multiplicity, track.pt(), track.rapidity(massPi)));*/
575585

576-
histos.fill(HIST("phiPi/h5PhiPiData2PartCorr") + HIST(phiMassRegionLabels[i]), multiplicity, phiCand.pt(), track.pt(), phiCand.y() - track.rapidity(massPi), phiCand.phi() - track.phi(), weightPhiPion);
586+
histos.fill(HIST("phiPi/h5PhiPiData") + HIST(phiMassRegionLabels[i]), multiplicity, phiCand.pt(), track.pt(), phiCand.y() - track.rapidity(massPi), getDeltaPhi(phiCand.phi(), track.phi()), weightPhiPion);
587+
}
588+
});
589+
}
590+
}
591+
592+
PROCESS_SWITCH(PhiStrangenessCorrelation, processPhiK0SPionData, "Process function for Phi-K0S and Phi-Pion Deltay and Deltaphi 2D Correlations in Data", true);
593+
594+
/*
595+
void processPhiK0SPionDataME(SelCollisions::iterator const& collision, aod::PhimesonCandidatesData const& phiCandidates, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&)
596+
{
597+
Pair<SelCollisions, FullTracks, FullV0s, BinningTypeVertexCent> pairPhiK0S{binningOnVertexAndCent, cfgNoMixedEvents, -1, collisions, tracksV0sTuple, &cache};
598+
Triple<aod::Collisions, aod::Tracks, aod::V0s, aod::Tracks, BinningType> triple{binningOnPositions, 5, -1, &cache};
599+
float multiplicity = collision.centFT0M();
600+
601+
const std::array<std::pair<float, float>, 2> phiMassRegions = {phiConfigs.rangeMPhiSignal, phiConfigs.rangeMPhiSideband};
602+
603+
// Loop over all positive tracks
604+
for (const auto& phiCand : phiCandidates) {
605+
static_for<0, phiMassRegionLabels.size() - 1>([&](auto i_idx) {
606+
constexpr unsigned int i = i_idx.value;
607+
608+
const auto& [minMass, maxMass] = phiMassRegions[i];
609+
if (!phiCand.inMassRegion(minMass, maxMass))
610+
return;
611+
612+
// V0 already reconstructed by the builder
613+
for (const auto& v0 : V0s) {
614+
// Cut on V0 dynamic columns
615+
if (!selectionV0<false>(v0, collision))
616+
continue;
617+
618+
float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()),
619+
BoundEfficiencyMap(effMaps[K0S], multiplicity, v0.pt(), v0.yK0Short()));
620+
621+
histos.fill(HIST("phiK0S/h5PhiK0SDataME") + HIST(phiMassRegionLabels[i]), multiplicity, phiCand.pt(), v0.pt(), phiCand.y() - v0.yK0Short(), getDeltaPhi(phiCand.phi(), v0.phi()), weightPhiK0S);
622+
}
623+
624+
// Loop over all primary pion candidates
625+
for (const auto& track : fullTracks) {
626+
if (!selectionPion(track))
627+
continue;
628+
629+
float weightPhiPion = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()),
630+
BoundEfficiencyMap(effMaps[Pion], multiplicity, track.pt(), track.rapidity(massPi)));
631+
632+
histos.fill(HIST("phiPi/h5PhiPiDataME") + HIST(phiMassRegionLabels[i]), multiplicity, phiCand.pt(), track.pt(), phiCand.y() - track.rapidity(massPi), getDeltaPhi(phiCand.phi(), track.phi()), weightPhiPion);
577633
}
578634
});
579635
}
580636
}
581637
582-
PROCESS_SWITCH(PhiStrangenessCorrelation, processPhiK0SPionDeltayDeltaphiData2D, "Process function for Phi-K0S and Phi-Pion Deltay and Deltaphi 2D Correlations in Data", true);
638+
PROCESS_SWITCH(PhiStrangenessCorrelation, processPhiK0SPionDataME, "Process function for Phi-K0S and Phi-Pion Deltay and Deltaphi 2D Correlations in Data ME", true);
639+
*/
583640

584-
void processParticleEfficiency(MCCollisions::iterator const& mcCollision, SimCollisions const& collisions, FullMCTracks const& fullMCTracks, FullMCV0s const& V0s, V0DauMCTracks const&, aod::McParticles const& mcParticles, aod::PhimesonCandidatesData const& phiCandidates)
641+
void processParticleEfficiency(MCCollisions::iterator const& mcCollision, SimCollisions const& collisions, FullMCTracks const& fullMCTracks, FullMCV0s const& V0s, V0DauMCTracks const&, aod::McParticles const& mcParticles, aod::PhimesonCandidatesMcReco const& phiCandidatesMcReco)
585642
{
586643
uint16_t numberAssocColls{0};
587644
std::vector<float> zVtxs;
@@ -595,7 +652,7 @@ struct PhiStrangenessCorrelation {
595652
zVtxs.push_back(collision.posZ());
596653

597654
if (selectionType == 0) {
598-
const auto phiCandidatesThisColl = phiCandidates.sliceBy(preslices.phiCandPerCollision, collision.globalIndex());
655+
const auto phiCandidatesThisColl = phiCandidatesMcReco.sliceBy(preslices.phiCandPerCollision, collision.globalIndex());
599656
for (const auto& phiCand : phiCandidatesThisColl) {
600657
histos.fill(HIST("phi/h4PhiMCReco"), collision.posZ(), mcCollision.centFT0M(), phiCand.pt(), phiCand.y());
601658
}

0 commit comments

Comments
 (0)