Skip to content

Commit a9fa0e9

Browse files
committed
Use invariant mass for rapidity calculations
1 parent 46680c3 commit a9fa0e9

File tree

2 files changed

+42
-36
lines changed

2 files changed

+42
-36
lines changed

PWGHF/D2H/Tasks/taskDs.cxx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -596,27 +596,25 @@ struct HfTaskDs {
596596
{
597597

598598
int id = o2::constants::physics::Pdg::kDS;
599-
auto yCand = hfHelper.yDs(candidate);
600599
if (dataType == DataType::McDplusPrompt || dataType == DataType::McDplusNonPrompt || dataType == DataType::McDplusBkg) {
601600
id = o2::constants::physics::Pdg::kDPlus;
602-
yCand = hfHelper.yDplus(candidate);
603601
} else if (dataType == DataType::McLcBkg) {
604602
id = o2::constants::physics::Pdg::kLambdaCPlus;
605-
yCand = hfHelper.yLc(candidate);
606603
}
607604

608605
auto indexMother = RecoDecay::getMother(mcParticles,
609606
candidate.template prong0_as<aod::TracksWMc>().template mcParticle_as<CandDsMcGen>(),
610607
id, true);
611608

612609
if (indexMother != -1) {
613-
if (yCandRecoMax >= 0. && std::abs(yCand) > yCandRecoMax) {
614-
return;
615-
}
616610

617611
auto pt = candidate.pt(); // rec. level pT
618612

619613
if (candidate.isSelDsToKKPi() >= selectionFlagDs) { // KKPi
614+
auto yCand = candidate.y(hfHelper.invMassDsToKKPi(candidate));
615+
if (yCandRecoMax >= 0. && std::abs(yCand) > yCandRecoMax) {
616+
return;
617+
}
620618
fillHisto(candidate, dataType);
621619
fillHistoKKPi<true, Coll>(candidate, dataType);
622620

@@ -631,6 +629,10 @@ struct HfTaskDs {
631629
}
632630
}
633631
if (candidate.isSelDsToPiKK() >= selectionFlagDs) { // PiKK
632+
auto yCand = candidate.y(hfHelper.invMassDsToPiKK(candidate));
633+
if (yCandRecoMax >= 0. && std::abs(yCand) > yCandRecoMax) {
634+
return;
635+
}
634636
fillHisto(candidate, dataType);
635637
fillHistoPiKK<true, Coll>(candidate, dataType);
636638

@@ -651,15 +653,17 @@ struct HfTaskDs {
651653
template <typename Coll, typename CandDs>
652654
void runDataAnalysisPerCandidate(CandDs const& candidate)
653655
{
654-
if (yCandRecoMax >= 0. && std::abs(hfHelper.yDs(candidate)) > yCandRecoMax) {
655-
return;
656-
}
657-
658656
if (candidate.isSelDsToKKPi() >= selectionFlagDs) { // KKPi
657+
if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToKKPi(candidate))) > yCandRecoMax) {
658+
return;
659+
}
659660
fillHisto(candidate, DataType::Data);
660661
fillHistoKKPi<false, Coll>(candidate, DataType::Data);
661662
}
662663
if (candidate.isSelDsToPiKK() >= selectionFlagDs) { // PiKK
664+
if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToPiKK(candidate))) > yCandRecoMax) {
665+
return;
666+
}
663667
fillHisto(candidate, DataType::Data);
664668
fillHistoPiKK<false, Coll>(candidate, DataType::Data);
665669
}
@@ -687,16 +691,19 @@ struct HfTaskDs {
687691
}
688692
}
689693
if (isBkg && fillMcBkgHistos) {
690-
if (yCandRecoMax >= 0. && std::abs(hfHelper.yDs(candidate)) > yCandRecoMax) {
691-
return;
692-
}
693694

694695
if (candidate.isSelDsToKKPi() >= selectionFlagDs || candidate.isSelDsToPiKK() >= selectionFlagDs) {
695696
if (candidate.isSelDsToKKPi() >= selectionFlagDs) { // KKPi
697+
if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToKKPi(candidate))) > yCandRecoMax) {
698+
return;
699+
}
696700
fillHisto(candidate, DataType::McBkg);
697701
fillHistoKKPi<true, Coll>(candidate, DataType::McBkg);
698702
}
699703
if (candidate.isSelDsToPiKK() >= selectionFlagDs) { // PiKK
704+
if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToPiKK(candidate))) > yCandRecoMax) {
705+
return;
706+
}
700707
fillHisto(candidate, DataType::McBkg);
701708
fillHistoPiKK<true, Coll>(candidate, DataType::McBkg);
702709
}

PWGHF/TableProducer/treeCreatorDsToKKPi.cxx

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -324,42 +324,41 @@ struct HfTreeCreatorDsToKKPi {
324324
template <bool doMc = false, int massHypo = 0, typename Coll, typename T>
325325
void fillCandidateTable(const T& candidate)
326326
{
327-
int8_t flagMc = 0;
328-
int8_t originMc = 0;
329-
int8_t channelMc = 0;
330-
int8_t isSwapped = massHypo; // 0 if KKPi, 1 if PiKK
331-
float yCand = 0;
332-
float eCand = 0;
333-
float ctCand = 0;
327+
float invMassDs = 0;
328+
float deltaMassPhiKK = 0;
329+
float absCos3PiKDs = 0;
330+
if constexpr (massHypo == 0) {
331+
invMassDs = hfHelper.invMassDsToKKPi(candidate);
332+
deltaMassPhiKK = hfHelper.deltaMassPhiDsToKKPi(candidate);
333+
absCos3PiKDs = hfHelper.absCos3PiKDsToKKPi(candidate);
334+
} else if constexpr (massHypo == 1) {
335+
invMassDs = hfHelper.invMassDsToPiKK(candidate);
336+
deltaMassPhiKK = hfHelper.deltaMassPhiDsToPiKK(candidate);
337+
absCos3PiKDs = hfHelper.absCos3PiKDsToPiKK(candidate);
338+
}
339+
340+
int8_t flagMc{0};
341+
int8_t originMc{0};
342+
int8_t channelMc{0};
343+
int8_t isSwapped{massHypo}; // 0 if KKPi, 1 if PiKK
344+
float yCand = isSwapped ? candidate.y(invMassDs) : candidate.y(invMassDs);
345+
float eCand{0.f};
346+
float ctCand{0.f};
334347
if constexpr (doMc) {
335348
flagMc = candidate.flagMcMatchRec();
336349
originMc = candidate.originMcRec();
337350
channelMc = candidate.flagMcDecayChanRec();
338351
isSwapped = candidate.isCandidateSwapped();
352+
yCand = isSwapped ? candidate.y(invMassDs) : candidate.y(invMassDs);
339353
if (fillDplusMc && candidate.flagMcDecayChanRec() == channelsResonant[Mother::Dplus][decayChannel]) {
340-
yCand = hfHelper.yDplus(candidate);
341354
eCand = hfHelper.eDplus(candidate);
342355
ctCand = hfHelper.ctDplus(candidate);
343356
} else {
344-
yCand = hfHelper.yDs(candidate);
345357
eCand = hfHelper.eDs(candidate);
346358
ctCand = hfHelper.ctDs(candidate);
347359
}
348360
}
349361

350-
float invMassDs = 0;
351-
float deltaMassPhiKK = 0;
352-
float absCos3PiKDs = 0;
353-
if constexpr (massHypo == 0) {
354-
invMassDs = hfHelper.invMassDsToKKPi(candidate);
355-
deltaMassPhiKK = hfHelper.deltaMassPhiDsToKKPi(candidate);
356-
absCos3PiKDs = hfHelper.absCos3PiKDsToKKPi(candidate);
357-
} else if constexpr (massHypo == 1) {
358-
invMassDs = hfHelper.invMassDsToPiKK(candidate);
359-
deltaMassPhiKK = hfHelper.deltaMassPhiDsToPiKK(candidate);
360-
absCos3PiKDs = hfHelper.absCos3PiKDsToPiKK(candidate);
361-
}
362-
363362
auto const& collision = candidate.template collision_as<Coll>();
364363
float centrality = o2::hf_centrality::getCentralityColl(collision);
365364

@@ -617,7 +616,7 @@ struct HfTreeCreatorDsToKKPi {
617616
particle.pt(),
618617
particle.eta(),
619618
particle.phi(),
620-
RecoDecay::y(particle.pVector(), o2::constants::physics::MassDS),
619+
std::abs(particle.pdgCode()) == o2::constants::physics::Pdg::kDS ? RecoDecay::y(particle.pVector(), o2::constants::physics::MassDS) : RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus),
621620
particle.flagMcMatchGen(),
622621
particle.originMcGen());
623622
}

0 commit comments

Comments
 (0)