|
26 | 26 | #include "PWGHF/DataModel/CandidateReconstructionTables.h" |
27 | 27 | #include "PWGHF/DataModel/CandidateSelectionTables.h" |
28 | 28 | #include "PWGHF/Utils/utilsEvSelHf.h" |
| 29 | +#include "PWGHF/Utils/utilsMcMatching.h" |
29 | 30 | #include "PWGHF/Utils/utilsTrkCandHf.h" |
30 | 31 |
|
31 | 32 | #include "Common/Core/RecoDecay.h" |
@@ -83,6 +84,7 @@ using namespace o2::aod; |
83 | 84 | using namespace o2::constants::physics; |
84 | 85 | using namespace o2::framework; |
85 | 86 | using namespace o2::framework::expressions; |
| 87 | +using namespace o2::hf_decay; |
86 | 88 | using namespace o2::hf_trkcandsel; |
87 | 89 |
|
88 | 90 | enum Event : uint8_t { |
@@ -127,7 +129,9 @@ struct HfDataCreatorCharmHadPiReduced { |
127 | 129 | Produces<aod::HfRed3Prongs> hfCand3Prong; |
128 | 130 | Produces<aod::HfRed3ProngsCov> hfCand3ProngCov; |
129 | 131 | Produces<aod::HfRed3ProngsMl> hfCand3ProngMl; |
130 | | - Produces<aod::HfRedB0SoftPi> hfCandDstarSoftPi; |
| 132 | + // D* soft pion related tables |
| 133 | + Produces<aod::HfRedSoftPiBases> hfTrackSoftPion; |
| 134 | + Produces<aod::HfRedSoftPiCov> hfTrackCovSoftPion; |
131 | 135 | // PID tables for charm-hadron candidate daughter tracks |
132 | 136 | Produces<aod::HfRedPidDau0s> hfCandPidProng0; |
133 | 137 | Produces<aod::HfRedPidDau1s> hfCandPidProng1; |
@@ -267,7 +271,6 @@ struct HfDataCreatorCharmHadPiReduced { |
267 | 271 |
|
268 | 272 | std::array<int, 2> arrPDGResonantDsPhiPi = {kPhi, kPiPlus}; // Ds± → Phi π± |
269 | 273 | std::array<int, 2> arrPDGResonantDKstarK = {kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K± |
270 | | - std::array<int, 2> arrPDGResonantDstarD0Pi = {kD0, kPiPlus}; // D*± → D0 π± |
271 | 274 |
|
272 | 275 | void init(InitContext& initContext) |
273 | 276 | { |
@@ -485,6 +488,7 @@ struct HfDataCreatorCharmHadPiReduced { |
485 | 488 |
|
486 | 489 | // we check the MC matching to be stored |
487 | 490 | int8_t sign{0}; |
| 491 | + int8_t signD{0}; |
488 | 492 | int8_t flag{0}; |
489 | 493 | int8_t flagWrongCollision{WrongCollisionType::None}; |
490 | 494 | int8_t debug{0}; |
@@ -968,20 +972,22 @@ struct HfDataCreatorCharmHadPiReduced { |
968 | 972 | tables.rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); |
969 | 973 | } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { |
970 | 974 | // B0 → D*+ π- → (D0 π+) π- → (K- π+ π+) π- |
971 | | - auto indexRec = RecoDecay::getMatchedMCRec<true, false, false, true, true>(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 4); |
| 975 | + auto indexRec = RecoDecay::getMatchedMCRec<true, false, false, true, true>(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{+kKPlus, -kPiPlus, -kPiPlus, +kPiPlus}, true, &sign, 4); |
972 | 976 | if (indexRec > -1) { |
973 | 977 | // D*+ → (D0 π+) → K- π+ π+ |
974 | | - indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3); |
| 978 | + indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signD, 3); |
975 | 979 | if (indexRec > -1) { |
976 | 980 | std::vector<int> arrDaughDstarIndex; |
977 | | - std::array<int, 2> arrPDGDaughDstar; |
978 | 981 | RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDstarIndex, std::array{0}, 1); |
979 | 982 | if (arrDaughDstarIndex.size() == NDaughtersDstar) { |
| 983 | + bool matchD0{0}; |
980 | 984 | for (auto iProng = 0u; iProng < arrDaughDstarIndex.size(); ++iProng) { |
981 | 985 | auto daughI = particlesMc.rawIteratorAt(arrDaughDstarIndex[iProng]); |
982 | | - arrPDGDaughDstar[iProng] = std::abs(daughI.pdgCode()); |
| 986 | + if (std::abs(daughI.pdgCode()) == Pdg::kD0) { |
| 987 | + matchD0 = RecoDecay::isMatchedMCGen(particlesMc, daughI, +Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD, 2); |
| 988 | + } |
983 | 989 | } |
984 | | - if ((arrPDGDaughDstar[0] == arrPDGResonantDstarD0Pi[0] && arrPDGDaughDstar[1] == arrPDGResonantDstarD0Pi[1]) || (arrPDGDaughDstar[0] == arrPDGResonantDstarD0Pi[1] && arrPDGDaughDstar[1] == arrPDGResonantDstarD0Pi[0])) { |
| 990 | + if (matchD0) { |
985 | 991 | flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDstarPiToD0PiPiToKPiPiPi); |
986 | 992 | } else { |
987 | 993 | debug = 1; |
@@ -1013,7 +1019,6 @@ struct HfDataCreatorCharmHadPiReduced { |
1013 | 1019 | uint64_t const& indexCollisionMaxNumContrib, |
1014 | 1020 | BBCs const&) |
1015 | 1021 | { |
1016 | | - LOG(debug) << "Running data creation for decay channel " << decChannel << " with doMc=" << doMc << ", withMl=" << withMl << ", withQvec=" << withQvec; |
1017 | 1022 | registry.fill(HIST("hEvents"), 1 + Event::Processed); |
1018 | 1023 | float centrality = -1.f; |
1019 | 1024 | auto hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry); |
@@ -1213,35 +1218,27 @@ struct HfDataCreatorCharmHadPiReduced { |
1213 | 1218 | trackParCovCharmHad = df2.createParentTrackParCov(); |
1214 | 1219 | trackParCovCharmHad.setAbsCharge(0); // to be sure |
1215 | 1220 | } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { |
1216 | | - hCandidatesDstar->Fill(SVFitting::BeforeFit); |
1217 | 1221 |
|
1218 | | - df2.process(trackParCov0, trackParCov1); // D0 vertex |
1219 | | - df2.propagateTracksToVertex(); |
1220 | | - std::array<float, 3> pVecPosVtx{}, pVecNegVtx{}; |
1221 | | - df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); |
1222 | | - df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); |
1223 | | - auto trackParD = df2.createParentTrackParCov(); |
1224 | | - trackParD.setAbsCharge(0); // to be sure |
1225 | | - auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); |
| 1222 | + hCandidatesDstar->Fill(SVFitting::BeforeFit); |
1226 | 1223 | try { |
1227 | | - if (df2.process(trackParD, trackParCov2) == 0) { |
1228 | | - continue; // D* vertex |
| 1224 | + // D0 vertex |
| 1225 | + if (df2.process(trackParCov0, trackParCov1) == 0) { |
| 1226 | + continue; |
1229 | 1227 | } |
1230 | 1228 | } catch (const std::runtime_error& error) { |
1231 | 1229 | LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; |
1232 | 1230 | hCandidatesDstar->Fill(SVFitting::Fail); |
1233 | 1231 | continue; |
1234 | 1232 | } |
1235 | 1233 | hCandidatesDstar->Fill(SVFitting::FitOk); |
1236 | | - |
1237 | 1234 | auto secondaryVertexCharm = df2.getPCACandidate(); |
1238 | 1235 | trackParCov0.propagateTo(secondaryVertexCharm[0], bz); |
1239 | 1236 | trackParCov1.propagateTo(secondaryVertexCharm[0], bz); |
1240 | | - std::array<float, 3> pVecD0{}; |
1241 | | - df2.getTrack(0).getPxPyPzGlo(pVecD0); // D0 |
1242 | | - pVecCharm = RecoDecay::pVec(pVecD0, pVec2); |
| 1237 | + df2.getTrack(0).getPxPyPzGlo(pVec0); |
| 1238 | + df2.getTrack(1).getPxPyPzGlo(pVec1); |
| 1239 | + pVecCharm = RecoDecay::pVec(pVec0, pVec1); |
1243 | 1240 | trackParCovCharmHad = df2.createParentTrackParCov(); |
1244 | | - trackParCovCharmHad.setAbsCharge(charmHadDauTracks[2].sign()); // sign of soft pion |
| 1241 | + trackParCovCharmHad.setAbsCharge(0); // to be sure |
1245 | 1242 | } |
1246 | 1243 |
|
1247 | 1244 | float ptDauMin = 1.e6, etaDauMin = 999.f, chi2TpcDauMax = -1.f; |
@@ -1428,12 +1425,32 @@ struct HfDataCreatorCharmHadPiReduced { |
1428 | 1425 | trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), |
1429 | 1426 | trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), |
1430 | 1427 | trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); |
1431 | | - tables.hfCandDstarSoftPi(candC.impParamSoftPi(), candC.impParamZSoftPi(), candC.errorImpParamSoftPi(), candC.errorImpParamZSoftPi(), candC.ptSoftPi()); |
1432 | 1428 | float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; |
1433 | 1429 | float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; |
1434 | 1430 | tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); |
1435 | 1431 | tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); |
1436 | 1432 | tables.hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); |
| 1433 | + |
| 1434 | + // Soft pion tables |
| 1435 | + auto trackSoftPion = charmHadDauTracks.back(); |
| 1436 | + auto trackParCovSoftPion = getTrackParCov(trackSoftPion); |
| 1437 | + std::array<float, 2> dcaSoftPion{trackSoftPion.dcaXY(), trackSoftPion.dcaZ()}; |
| 1438 | + std::array<float, 3> pVecSoftPion = trackSoftPion.pVector(); |
| 1439 | + if (trackSoftPion.collisionId() != thisCollId) { |
| 1440 | + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovSoftPion, 2.f, noMatCorr, &dcaSoftPion); |
| 1441 | + getPxPyPz(trackParCovSoftPion, pVecSoftPion); |
| 1442 | + } |
| 1443 | + tables.hfTrackSoftPion(trackSoftPion.globalIndex(), indexHfReducedCollision, |
| 1444 | + trackParCovSoftPion.getX(), trackParCovSoftPion.getAlpha(), |
| 1445 | + trackParCovSoftPion.getY(), trackParCovSoftPion.getZ(), trackParCovSoftPion.getSnp(), |
| 1446 | + trackParCovSoftPion.getTgl(), trackParCovSoftPion.getQ2Pt(), |
| 1447 | + trackSoftPion.itsNCls(), trackSoftPion.tpcNClsCrossedRows(), trackSoftPion.tpcChi2NCl()); |
| 1448 | + tables.hfTrackCovSoftPion(trackParCovSoftPion.getSigmaY2(), trackParCovSoftPion.getSigmaZY(), trackParCovSoftPion.getSigmaZ2(), |
| 1449 | + trackParCovSoftPion.getSigmaSnpY(), trackParCovSoftPion.getSigmaSnpZ(), |
| 1450 | + trackParCovSoftPion.getSigmaSnp2(), trackParCovSoftPion.getSigmaTglY(), trackParCovSoftPion.getSigmaTglZ(), |
| 1451 | + trackParCovSoftPion.getSigmaTglSnp(), trackParCovSoftPion.getSigmaTgl2(), |
| 1452 | + trackParCovSoftPion.getSigma1PtY(), trackParCovSoftPion.getSigma1PtZ(), trackParCovSoftPion.getSigma1PtSnp(), |
| 1453 | + trackParCovSoftPion.getSigma1PtTgl(), trackParCovSoftPion.getSigma1Pt2()); |
1437 | 1454 | } |
1438 | 1455 | fillHfReducedCollision = true; |
1439 | 1456 | } |
@@ -1667,7 +1684,7 @@ struct HfDataCreatorCharmHadPiReduced { |
1667 | 1684 | ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); |
1668 | 1685 | } else if constexpr (decayChannel == DecayChannel::B0ToDstarPi) { |
1669 | 1686 | // B0 → D* π+ |
1670 | | - if (RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kB0, std::array{+static_cast<int>(Pdg::kDStar), -kPiPlus}, true)) { |
| 1687 | + if (RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kB0, std::array{-static_cast<int>(Pdg::kDStar), +kPiPlus}, true)) { |
1671 | 1688 | // Match D- -> π- K+ π- |
1672 | 1689 | auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); |
1673 | 1690 | // Printf("Checking D- -> π- K+ π-"); |
|
0 commit comments