Skip to content

Commit 62ebed3

Browse files
fgrosaalibuild
andauthored
[PWGHF] Add process function for MC D+V0 femtoscopy (#16924)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 2fd899b commit 62ebed3

1 file changed

Lines changed: 98 additions & 23 deletions

File tree

PWGHF/HFC/Tasks/taskCharmHadronsV0FemtoDream.cxx

Lines changed: 98 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ struct HfTaskCharmHadronsV0FemtoDream {
174174
using FilteredCollisions = soa::Filtered<soa::Join<FDCollisions, FDColMasks>>;
175175
using FilteredCollision = FilteredCollisions::iterator;
176176

177-
using FilteredMcColisions = soa::Filtered<soa::Join<aod::FDCollisions, FDColMasks, aod::FDMCCollLabels>>;
178-
using FilteredMcColision = FilteredMcColisions::iterator;
177+
using FilteredMcCollisions = soa::Filtered<soa::Join<aod::FDCollisions, FDColMasks, aod::FDMCCollLabels>>;
178+
using FilteredMcColision = FilteredMcCollisions::iterator;
179179

180-
using FilteredFDMcParts = soa::Filtered<soa::Join<aod::FDParticles, aod::FDParticlesIndex, aod::FDExtParticles, aod::FDMCLabels, aod::FDExtMCLabels>>;
180+
using FilteredFDMcParts = soa::Filtered<soa::Join<aod::FDParticles, aod::FDParticlesIndex, aod::FDExtParticles, aod::FDMCLabels, aod::FDExtMCLabels, aod::FDTrkTimeStamp>>;
181181
using FilteredFDMcPart = FilteredFDMcParts::iterator;
182182

183183
using FDV0Particles = soa::Join<aod::FDParticles, aod::FDExtParticles, aod::FDParticlesIndex, aod::FDTrkTimeStamp>;
@@ -189,11 +189,12 @@ struct HfTaskCharmHadronsV0FemtoDream {
189189
Filter hfMcSelFilter = (nabs(aod::fdhf::flagMc) == charmSel.charmHadMcSel);
190190

191191
Preslice<FDV0Particles> perCol = aod::femtodreamparticle::fdCollisionId;
192+
Preslice<FilteredFDMcParts> perColMc = aod::femtodreamparticle::fdCollisionId;
192193
Preslice<FilteredCharmCand3Prongs> perHf3ProngByCol = aod::femtodreamparticle::fdCollisionId;
193194
Preslice<FilteredCharmCand2Prongs> perHf2ProngByCol = aod::femtodreamparticle::fdCollisionId;
194195
Preslice<FilteredCharmCandDstars> perHfDstarByCol = aod::femtodreamparticle::fdCollisionId;
195196

196-
/// Partition for particle Lambda
197+
/// Partitions for particle Lambda
197198
Partition<FDV0Particles> partitionLambda = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) &&
198199
((aod::femtodreamparticle::cut & v0Sel.cutBit) == v0Sel.cutBit) &&
199200
(aod::femtodreamparticle::pt > v0Sel.ptV0Min) &&
@@ -205,7 +206,18 @@ struct HfTaskCharmHadronsV0FemtoDream {
205206
(aod::femtodreamparticle::mAntiLambda > v0Sel.invMassAntiV0Min) &&
206207
(aod::femtodreamparticle::mAntiLambda < v0Sel.invMassAntiV0Max);
207208

208-
/// Partition for particle K0Short
209+
Partition<FilteredFDMcParts> partitionMcLambda = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) &&
210+
((aod::femtodreamparticle::cut & v0Sel.cutBit) == v0Sel.cutBit) &&
211+
(aod::femtodreamparticle::pt > v0Sel.ptV0Min) &&
212+
(aod::femtodreamparticle::pt < v0Sel.ptV0Max) &&
213+
(aod::femtodreamparticle::eta > v0Sel.etaV0Min) &&
214+
(aod::femtodreamparticle::eta < v0Sel.etaV0Max) &&
215+
(aod::femtodreamparticle::mLambda > v0Sel.invMassV0Min) &&
216+
(aod::femtodreamparticle::mLambda < v0Sel.invMassV0Max) &&
217+
(aod::femtodreamparticle::mAntiLambda > v0Sel.invMassAntiV0Min) &&
218+
(aod::femtodreamparticle::mAntiLambda < v0Sel.invMassAntiV0Max);
219+
220+
/// Partitions for particle K0Short
209221
Partition<FDV0Particles> partitionK0Short = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0K0Short)) &&
210222
((aod::femtodreamparticle::cut & v0Sel.cutBit) == v0Sel.cutBit) &&
211223
(aod::femtodreamparticle::pt > v0Sel.ptV0Min) &&
@@ -217,6 +229,17 @@ struct HfTaskCharmHadronsV0FemtoDream {
217229
(aod::femtodreamparticle::mAntiLambda > v0Sel.invMassAntiV0Min) &&
218230
(aod::femtodreamparticle::mAntiLambda < v0Sel.invMassAntiV0Max);
219231

232+
Partition<FilteredFDMcParts> partitionMcK0Short = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0K0Short)) &&
233+
((aod::femtodreamparticle::cut & v0Sel.cutBit) == v0Sel.cutBit) &&
234+
(aod::femtodreamparticle::pt > v0Sel.ptV0Min) &&
235+
(aod::femtodreamparticle::pt < v0Sel.ptV0Max) &&
236+
(aod::femtodreamparticle::eta > v0Sel.etaV0Min) &&
237+
(aod::femtodreamparticle::eta < v0Sel.etaV0Max) &&
238+
(aod::femtodreamparticle::mLambda > v0Sel.invMassV0Min) &&
239+
(aod::femtodreamparticle::mLambda < v0Sel.invMassV0Max) &&
240+
(aod::femtodreamparticle::mAntiLambda > v0Sel.invMassAntiV0Min) &&
241+
(aod::femtodreamparticle::mAntiLambda < v0Sel.invMassAntiV0Max);
242+
220243
/// Partition for particle 2
221244
Partition<FilteredCharmCand3Prongs> partitionCharmHadron3Prong = aod::fdhf::bdtBkg < charmSel.charmHadBkgBDTmax && aod::fdhf::bdtFD < charmSel.charmHadFdBDTmax && aod::fdhf::bdtFD > charmSel.charmHadFdBDTmin&& aod::fdhf::bdtPrompt<charmSel.charmHadPromptBDTmax && aod::fdhf::bdtPrompt> charmSel.charmHadPromptBDTmin;
222245
Partition<FilteredCharmCand2Prongs> partitionCharmHadron2Prong = aod::fdhf::bdtBkg < charmSel.charmHadBkgBDTmax && aod::fdhf::bdtFD < charmSel.charmHadFdBDTmax && aod::fdhf::bdtFD > charmSel.charmHadFdBDTmin&& aod::fdhf::bdtPrompt<charmSel.charmHadPromptBDTmax && aod::fdhf::bdtPrompt> charmSel.charmHadPromptBDTmin;
@@ -381,10 +404,9 @@ struct HfTaskCharmHadronsV0FemtoDream {
381404
if (cand.candidateSelFlag() == 1) {
382405
invMass = cand.m(std::array{MassPiPlus, MassKPlus});
383406
return invMass;
384-
} else {
385-
invMass = cand.m(std::array{MassKPlus, MassPiPlus});
386-
return invMass;
387407
}
408+
invMass = cand.m(std::array{MassKPlus, MassPiPlus});
409+
return invMass;
388410
} else if constexpr (Channel == DecayChannel::DstarToD0Pi) { // D* → D0π (PDG: 413)
389411
float mDstar = 0.f;
390412
float mD0 = 0.f;
@@ -397,9 +419,8 @@ struct HfTaskCharmHadronsV0FemtoDream {
397419
}
398420
if (ReturnDaughMass) {
399421
return mD0;
400-
} else {
401-
return mDstar - mD0;
402422
}
423+
return mDstar - mD0;
403424
}
404425
// Add more channels as needed
405426
return 0.f;
@@ -502,7 +523,7 @@ struct HfTaskCharmHadronsV0FemtoDream {
502523
}
503524

504525
template <bool IsMc, DecayChannel Channel, typename CollisionType, typename PartitionType1, typename PartitionType2, typename FDParticles, typename BinningType>
505-
void doMixedEvent(CollisionType const& cols, PartitionType1& charms, PartitionType2& v0s, FDParticles const& /*femtoParts*/, BinningType policy)
526+
void doMixedEvent(CollisionType const& cols, PartitionType1& charms, PartitionType2& v0s, FDParticles const& /*femtoParts*/, BinningType const& policy)
506527
{
507528
processType = 2; // for mixed event
508529
// Mixed events that contain the pair of interest
@@ -717,9 +738,9 @@ struct HfTaskCharmHadronsV0FemtoDream {
717738
}
718739
}
719740

720-
template <DecayChannel Channel, typename CharmPart>
721-
void runMixing(FilteredCollisions const& cols,
722-
FDV0Particles const& parts,
741+
template <bool IsMc, DecayChannel Channel, typename Cols, typename V0Part, typename CharmPart>
742+
void runMixing(Cols const& cols,
743+
V0Part const& parts,
723744
CharmPart& charmPart)
724745
{
725746
if (!mixSetting.doMixEvent) {
@@ -728,23 +749,43 @@ struct HfTaskCharmHadronsV0FemtoDream {
728749
auto run = [&](auto& v0Part) {
729750
switch (mixSetting.mixingBinPolicy) {
730751
case femtodreamcollision::kMult:
731-
doMixedEvent<false, Channel, FilteredCollisions>(cols, charmPart, v0Part, parts, colBinningMult);
752+
if constexpr (IsMc) {
753+
doMixedEvent<IsMc, Channel, FilteredMcCollisions>(cols, charmPart, v0Part, parts, colBinningMult);
754+
} else {
755+
doMixedEvent<IsMc, Channel, FilteredCollisions>(cols, charmPart, v0Part, parts, colBinningMult);
756+
}
732757
break;
733758
case femtodreamcollision::kMultPercentile:
734-
doMixedEvent<false, Channel, FilteredCollisions>(cols, charmPart, v0Part, parts, colBinningMultPercentile);
759+
if constexpr (IsMc) {
760+
doMixedEvent<IsMc, Channel, FilteredMcCollisions>(cols, charmPart, v0Part, parts, colBinningMultPercentile);
761+
} else {
762+
doMixedEvent<IsMc, Channel, FilteredCollisions>(cols, charmPart, v0Part, parts, colBinningMultPercentile);
763+
}
735764
break;
736765
case femtodreamcollision::kMultMultPercentile:
737-
doMixedEvent<false, Channel, FilteredCollisions>(cols, charmPart, v0Part, parts, colBinningMultMultPercentile);
766+
if constexpr (IsMc) {
767+
doMixedEvent<IsMc, Channel, FilteredMcCollisions>(cols, charmPart, v0Part, parts, colBinningMultMultPercentile);
768+
} else {
769+
doMixedEvent<IsMc, Channel, FilteredCollisions>(cols, charmPart, v0Part, parts, colBinningMultMultPercentile);
770+
}
738771
break;
739772
default:
740773
LOG(fatal) << "Invalid binning policiy specifed. Breaking...";
741774
}
742775
};
743776

744777
if (v0Sel.pdgCodeV0 == kLambda0) {
745-
run(partitionLambda);
778+
if constexpr (IsMc) {
779+
run(partitionMcLambda);
780+
} else {
781+
run(partitionLambda);
782+
}
746783
} else if (v0Sel.pdgCodeV0 == kK0Short) {
747-
run(partitionK0Short);
784+
if constexpr (IsMc) {
785+
run(partitionMcK0Short);
786+
} else {
787+
run(partitionK0Short);
788+
}
748789
} else {
749790
LOG(fatal) << "Unsupported V0 PDG: " << v0Sel.pdgCodeV0 << " (allowed: 3122, 310) for mixed-events";
750791
}
@@ -781,7 +822,7 @@ struct HfTaskCharmHadronsV0FemtoDream {
781822
LOG(fatal) << "Unsupported V0 PDG: " << v0Sel.pdgCodeV0 << " (allowed: 3122, 310) for same events";
782823
}
783824
}
784-
runMixing<DecayChannel::LcToPKPi>(cols, parts, partitionCharmHadron3Prong);
825+
runMixing<false, DecayChannel::LcToPKPi>(cols, parts, partitionCharmHadron3Prong);
785826
}
786827
PROCESS_SWITCH(HfTaskCharmHadronsV0FemtoDream, processDataLcV0, "Enable processing LcToPKPi and V0 correlation", false);
787828

@@ -815,7 +856,7 @@ struct HfTaskCharmHadronsV0FemtoDream {
815856
LOG(fatal) << "Unsupported V0 PDG: " << v0Sel.pdgCodeV0 << " (allowed: 3122, 310)";
816857
}
817858
}
818-
runMixing<DecayChannel::DplusToPiKPi>(cols, parts, partitionCharmHadron3Prong);
859+
runMixing<false, DecayChannel::DplusToPiKPi>(cols, parts, partitionCharmHadron3Prong);
819860
}
820861
PROCESS_SWITCH(HfTaskCharmHadronsV0FemtoDream, processDataDplusV0, "Enable processing DplusToPiKPi and V0 correlation", false);
821862

@@ -849,7 +890,7 @@ struct HfTaskCharmHadronsV0FemtoDream {
849890
LOG(fatal) << "Unsupported V0 PDG: " << v0Sel.pdgCodeV0 << " (allowed: 3122, 310)";
850891
}
851892
}
852-
runMixing<DecayChannel::D0ToPiK>(cols, parts, partitionCharmHadron2Prong);
893+
runMixing<false, DecayChannel::D0ToPiK>(cols, parts, partitionCharmHadron2Prong);
853894
}
854895
PROCESS_SWITCH(HfTaskCharmHadronsV0FemtoDream, processDataD0V0, "Enable processing D0ToPiK and V0 correlation", false);
855896

@@ -884,9 +925,43 @@ struct HfTaskCharmHadronsV0FemtoDream {
884925
LOG(fatal) << "Unsupported V0 PDG: " << v0Sel.pdgCodeV0 << " (allowed: 3122, 310)";
885926
}
886927
}
887-
runMixing<DecayChannel::DstarToD0Pi>(cols, parts, partitionCharmHadronDstar);
928+
runMixing<false, DecayChannel::DstarToD0Pi>(cols, parts, partitionCharmHadronDstar);
888929
}
889930
PROCESS_SWITCH(HfTaskCharmHadronsV0FemtoDream, processDataDstarV0, "Enable processing DstarToD0Pi and V0 correlation", false);
931+
932+
void processMcDplusV0(FilteredMcCollisions const& cols,
933+
FilteredFDMcParts const& parts,
934+
o2::aod::FDMCParticles const&,
935+
o2::aod::FDExtMCParticles const&,
936+
FilteredCharmMcCand3Prongs const&)
937+
{
938+
for (const auto& col : cols) {
939+
eventHisto.fillQA(col);
940+
auto sliceMcCharmHad = partitionMcCharmHadron3Prong->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
941+
if (fillTableWithCharm.value && sliceMcCharmHad.size() == 0) {
942+
continue;
943+
}
944+
if (v0Sel.pdgCodeV0 == kLambda0) {
945+
auto sliceMcV0 = partitionMcLambda->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
946+
fillTables<true, DecayChannel::DplusToPiKPi>(col, sliceMcV0, sliceMcCharmHad, parts);
947+
if (sliceMcCharmHad.size() > 0 && sliceMcV0.size() > 0) {
948+
doSameEvent<true, DecayChannel::DplusToPiKPi, FilteredCharmMcCand3Prongs>(sliceMcCharmHad, sliceMcV0, parts, col);
949+
}
950+
951+
} else if (v0Sel.pdgCodeV0 == kK0Short) {
952+
auto sliceMcV0 = partitionMcK0Short->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
953+
fillTables<true, DecayChannel::DplusToPiKPi>(col, sliceMcV0, sliceMcCharmHad, parts);
954+
955+
if (sliceMcCharmHad.size() > 0 && sliceMcV0.size() > 0) {
956+
doSameEvent<true, DecayChannel::DplusToPiKPi, FilteredCharmMcCand3Prongs>(sliceMcCharmHad, sliceMcV0, parts, col);
957+
}
958+
} else {
959+
LOG(fatal) << "Unsupported V0 PDG: " << v0Sel.pdgCodeV0 << " (allowed: 3122, 310)";
960+
}
961+
}
962+
runMixing<true, DecayChannel::DplusToPiKPi>(cols, parts, partitionMcCharmHadron3Prong);
963+
}
964+
PROCESS_SWITCH(HfTaskCharmHadronsV0FemtoDream, processMcDplusV0, "Enable processing DplusToPiKPi and V0 correlation for Monte Carlo", false);
890965
};
891966

892967
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)