|
48 | 48 | #include "PWGHF/Utils/utilsBfieldCCDB.h" |
49 | 49 | #include "PWGHF/Utils/utilsEvSelHf.h" |
50 | 50 | #include "PWGHF/Utils/utilsTrkCandHf.h" |
| 51 | +#include "PWGHF/Utils/utilsMcGen.h" |
51 | 52 |
|
52 | 53 | using namespace o2; |
53 | 54 | using namespace o2::analysis; |
@@ -1048,96 +1049,7 @@ struct HfCandidateCreator3ProngExpressions { |
1048 | 1049 | } |
1049 | 1050 | continue; |
1050 | 1051 | } |
1051 | | - |
1052 | | - // Match generated particles. |
1053 | | - for (const auto& particle : mcParticlesPerMcColl) { |
1054 | | - flag = 0; |
1055 | | - origin = 0; |
1056 | | - channel = 0; |
1057 | | - arrDaughIndex.clear(); |
1058 | | - std::vector<int> idxBhadMothers{}; |
1059 | | - // Reject particles from background events |
1060 | | - if (particle.fromBackgroundEvent() && rejectBackground) { |
1061 | | - rowMcMatchGen(flag, origin, channel, -1); |
1062 | | - continue; |
1063 | | - } |
1064 | | - |
1065 | | - // D± → π± K∓ π± |
1066 | | - if (createDplus) { |
1067 | | - if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) { |
1068 | | - flag = sign * (1 << DecayType::DplusToPiKPi); |
1069 | | - } |
1070 | | - } |
1071 | | - |
1072 | | - // Ds± → K± K∓ π± and D± → K± K∓ π± |
1073 | | - if (flag == 0 && createDs) { |
1074 | | - bool isDplus = false; |
1075 | | - if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) { |
1076 | | - // DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π± |
1077 | | - // TODO: move to different and explicit flags |
1078 | | - flag = sign * (1 << DecayType::DsToKKPi); |
1079 | | - } else if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) { |
1080 | | - // DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π± |
1081 | | - // TODO: move to different and explicit flags |
1082 | | - flag = sign * (1 << DecayType::DsToKKPi); |
1083 | | - isDplus = true; |
1084 | | - } |
1085 | | - if (flag != 0) { |
1086 | | - RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{0}, 1); |
1087 | | - if (arrDaughIndex.size() == 2) { |
1088 | | - for (auto jProng = 0u; jProng < arrDaughIndex.size(); ++jProng) { |
1089 | | - auto daughJ = mcParticles.rawIteratorAt(arrDaughIndex[jProng]); |
1090 | | - arrPDGDaugh[jProng] = std::abs(daughJ.pdgCode()); |
1091 | | - } |
1092 | | - if ((arrPDGDaugh[0] == arrPDGResonantDPhiPi[0] && arrPDGDaugh[1] == arrPDGResonantDPhiPi[1]) || (arrPDGDaugh[0] == arrPDGResonantDPhiPi[1] && arrPDGDaugh[1] == arrPDGResonantDPhiPi[0])) { |
1093 | | - channel = isDplus ? DecayChannelDToKKPi::DplusToPhiPi : DecayChannelDToKKPi::DsToPhiPi; |
1094 | | - } else if ((arrPDGDaugh[0] == arrPDGResonantDKstarK[0] && arrPDGDaugh[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaugh[0] == arrPDGResonantDKstarK[1] && arrPDGDaugh[1] == arrPDGResonantDKstarK[0])) { |
1095 | | - channel = isDplus ? DecayChannelDToKKPi::DplusToK0starK : DecayChannelDToKKPi::DsToK0starK; |
1096 | | - } |
1097 | | - } |
1098 | | - } |
1099 | | - } |
1100 | | - |
1101 | | - // Λc± → p± K∓ π± |
1102 | | - if (flag == 0 && createLc) { |
1103 | | - if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2)) { |
1104 | | - flag = sign * (1 << DecayType::LcToPKPi); |
1105 | | - |
1106 | | - // Flagging the different Λc± → p± K∓ π± decay channels |
1107 | | - RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{0}, 1); |
1108 | | - if (arrDaughIndex.size() == 2) { |
1109 | | - for (auto jProng = 0u; jProng < arrDaughIndex.size(); ++jProng) { |
1110 | | - auto daughJ = mcParticles.rawIteratorAt(arrDaughIndex[jProng]); |
1111 | | - arrPDGDaugh[jProng] = std::abs(daughJ.pdgCode()); |
1112 | | - } |
1113 | | - if ((arrPDGDaugh[0] == arrPDGResonant1[0] && arrPDGDaugh[1] == arrPDGResonant1[1]) || (arrPDGDaugh[0] == arrPDGResonant1[1] && arrPDGDaugh[1] == arrPDGResonant1[0])) { |
1114 | | - channel = 1; |
1115 | | - } else if ((arrPDGDaugh[0] == arrPDGResonant2[0] && arrPDGDaugh[1] == arrPDGResonant2[1]) || (arrPDGDaugh[0] == arrPDGResonant2[1] && arrPDGDaugh[1] == arrPDGResonant2[0])) { |
1116 | | - channel = 2; |
1117 | | - } else if ((arrPDGDaugh[0] == arrPDGResonant3[0] && arrPDGDaugh[1] == arrPDGResonant3[1]) || (arrPDGDaugh[0] == arrPDGResonant3[1] && arrPDGDaugh[1] == arrPDGResonant3[0])) { |
1118 | | - channel = 3; |
1119 | | - } |
1120 | | - } |
1121 | | - } |
1122 | | - } |
1123 | | - |
1124 | | - // Ξc± → p± K∓ π± |
1125 | | - if (flag == 0 && createXic) { |
1126 | | - if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2)) { |
1127 | | - flag = sign * (1 << DecayType::XicToPKPi); |
1128 | | - } |
1129 | | - } |
1130 | | - |
1131 | | - // Check whether the particle is non-prompt (from a b quark). |
1132 | | - if (flag != 0) { |
1133 | | - origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers); |
1134 | | - } |
1135 | | - if (origin == RecoDecay::OriginType::NonPrompt) { |
1136 | | - rowMcMatchGen(flag, origin, channel, idxBhadMothers[0]); |
1137 | | - } else { |
1138 | | - rowMcMatchGen(flag, origin, channel, -1); |
1139 | | - } |
1140 | | - } |
| 1052 | + hf_mc_gen::fillMcMatchGen3Prong(mcParticlesPerMcColl, rowMcMatchGen, rejectBackground, createDplus, createDs, createLc, createXic); |
1141 | 1053 | } |
1142 | 1054 | } |
1143 | 1055 |
|
|
0 commit comments