@@ -152,7 +152,6 @@ enum DecayChannelResonant : int8_t {
152152 LastChannelResonant
153153};
154154
155-
156155std::unordered_map<DecayChannelResonant, std::array<int , 2 > > resoStatesDPlus =
157156{
158157 {DecayChannelResonant::DplusToPhiPi, std::array<int , 2 >{+kPhi , +kPiPlus }},
@@ -336,108 +335,134 @@ enum DecayChannelToJpsiResonant : int8_t {
336335} // namespace hf_cand_beauty
337336} // namespace o2::hf_decay
338337
339- // using namespace o2::hf_decay;
340-
341338namespace o2 ::hf_corrbkg
342339{
343- std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelMain, std::vector<int > > getDecayChannel3Prong (int pdgMother) {
340+ using namespace o2 ::hf_decay;
341+
342+ // / Returns a map of the possible final states for a specific 3-prong particle specie
343+ // / \param pdgMother PDG code of the mother particle
344+ // / \return a map of final states with their corresponding PDG codes
345+ std::unordered_map<hf_cand_3prong::DecayChannelMain, std::vector<int > > getDecayChannel3Prong (int pdgMother) {
344346 switch (pdgMother) {
345347 case Pdg::kDPlus :
346- return o2::hf_decay:: hf_cand_3prong::finalStatesDPlus;
348+ return hf_cand_3prong::finalStatesDPlus;
347349 case Pdg::kDS :
348- return o2::hf_decay:: hf_cand_3prong::finalStatesDs;
350+ return hf_cand_3prong::finalStatesDs;
349351 case Pdg::kDStar :
350- return o2::hf_decay:: hf_cand_3prong::finalStatesDstar;
352+ return hf_cand_3prong::finalStatesDstar;
351353 case Pdg::kLambdaCPlus :
352- return o2::hf_decay:: hf_cand_3prong::finalStatesLc;
354+ return hf_cand_3prong::finalStatesLc;
353355 case Pdg::kXiCPlus :
354- return o2::hf_decay:: hf_cand_3prong::finalStatesXic;
356+ return hf_cand_3prong::finalStatesXic;
355357 default :
356358 LOG (error) << " Unknown PDG code for 3-prong final states: " << pdgMother;
357359 return {};
358360 }
359361 }
360362
361- std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > getResoChannels3Prong (int pdgMother) {
363+ // / Returns a map of the resonant decay channels for a specific 3-prong particle specie
364+ // / \param pdgMother PDG code of the mother particle
365+ // / \return a map of resonant decay channels with their corresponding PDG codes
366+ std::unordered_map<hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > getResoChannels3Prong (int pdgMother) {
362367 switch (pdgMother) {
363368 case Pdg::kDPlus :
364- return o2::hf_decay:: hf_cand_3prong::resoStatesDPlus;
369+ return hf_cand_3prong::resoStatesDPlus;
365370 case Pdg::kDS :
366- return o2::hf_decay:: hf_cand_3prong::resoStatesDs;
371+ return hf_cand_3prong::resoStatesDs;
367372 case Pdg::kDStar :
368- return o2::hf_decay:: hf_cand_3prong::resoStatesDstar;
373+ return hf_cand_3prong::resoStatesDstar;
369374 case Pdg::kLambdaCPlus :
370- return o2::hf_decay:: hf_cand_3prong::resoStatesLambdaC;
375+ return hf_cand_3prong::resoStatesLambdaC;
371376 case Pdg::kXiCPlus :
372- return o2::hf_decay:: hf_cand_3prong::resoStatesXiC;
377+ return hf_cand_3prong::resoStatesXiC;
373378 default :
374379 LOG (error) << " Unknown PDG code for 3-prong final states: " << pdgMother;
375380 return {};
376381 }
377382 }
378383
384+ // / Perform the matching for a single resonant channel
385+ // / \tparam N size of the array of daughter PDG codes
386+ // / \param arrPdgResoChn array of daughter indices
387+ // / \param arrPdgDaugs array of PDG codes for the resonant decay
388+ // / \return true if the resonant channel is matched, false otherwise
379389 template <std::size_t N>
380- bool checkResonantDecay (std::array<int , N> arrDaughIndex, std::array<int , N> arrPDGResonant) {
381- LOG (info) << " Testing: " << arrDaughIndex[0 ] << " , " << arrDaughIndex[1 ] << " matching PDG codes: " << arrPDGResonant[0 ] << " , " << arrPDGResonant[1 ];
382- for (int i = 0 ; i < N; i++) {
383- LOG (info) << " Checking daughter index: " << arrDaughIndex[i];
384- bool findDaug = false ;
385- for (int j = 0 ; j < N; j++) {
386- LOG (info) << " Checking daughter PDG: " << arrDaughIndex[i] << " against resonant PDG: " << arrPDGResonant[j];
387- if (std::abs (arrDaughIndex[i]) == std::abs (arrPDGResonant[j])) {
388- arrPDGResonant[j] = -1 ; // Mark as found
389- LOG (info) << " Matched!" ;
390- findDaug = true ;
391- break ;
392- }
393- }
394- if (!findDaug) {
395- LOG (info) << " Returning false" ;
396- return false ;
390+ bool checkResonantDecay (std::array<int , N> arrPdgResoChn, std::array<int , N> arrPdgDaugs) {
391+ // LOG(info) << "Testing: " << arrPdgResoChn[0] << ", " << arrPdgResoChn[1] << " matching PDG codes: " << arrPdgDaugs[0] << ", " << arrPdgDaugs[1];
392+ for (size_t i = 0 ; i < N; i++) {
393+ // LOG(info) << "Checking daughter index: " << arrPdgResoChn[i];
394+ bool findDaug = false ;
395+ for (size_t j = 0 ; j < N; j++) {
396+ // LOG(info) << "Checking daughter PDG: " << arrPdgResoChn[i] << " against resonant PDG: " << arrPdgDaugs[j];
397+ if (std::abs (arrPdgResoChn[i]) == std::abs (arrPdgDaugs[j])) {
398+ arrPdgDaugs[j] = -1 ; // Mark as found
399+ // LOG(info) << "Matched!";
400+ findDaug = true ;
401+ break ;
397402 }
398403 }
399- LOG (info) << " Resonant decay found with daughters: " << arrDaughIndex[0 ] << " , " << arrDaughIndex[1 ] << " matching PDG codes: " << arrPDGResonant[0 ] << " , " << arrPDGResonant[1 ];
400- return true ;
404+ if (!findDaug) {
405+ // LOG(info) << "Returning false";
406+ return false ;
407+ }
401408 }
409+ // LOG(info) << "Resonant decay found with daughters: " << arrPdgResoChn[0] << ", " << arrPdgResoChn[1] << " matching PDG codes: " << arrPdgDaugs[0] << ", " << arrPdgDaugs[1];
410+ return true ;
411+ }
402412
403- // / Check if the decay is resonant
404- // / \tparam arrDaughIndex index of the particle daughters at resonance level
405- // / \tparam arrPDGResonant PDG code of the resonant decay
406- // / \return true if the decay is resonant
407- template <bool is3Prong = false , std::size_t N>
408- void flagResonantDecay (int motherPdg, int8_t * channel, std::array<int , N> arrDaughIndex) {
409- if constexpr (is3Prong) {
410- std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > resoStates = getResoChannels3Prong (motherPdg);
411- for (const auto & [flag, pdgCodes] : resoStates) {
412- if (abs (motherPdg) == Pdg::kDStar ) {
413- std::cout << " Checking Dstar resonant decay with flag: " << flag << " , pdgCodes: " << pdgCodes[0 ] << " , " << pdgCodes[1 ] << " vs " << arrDaughIndex[0 ] << " " << arrDaughIndex[1 ] << std::endl;
414- }
415- if (checkResonantDecay (arrDaughIndex, pdgCodes)) {
416- *channel = flag;
417- if (abs (motherPdg) == Pdg::kDStar ) {
418- LOG (info) << " Dstar resonant decay found with channel: " << static_cast <int >(*channel);
419- }
420- break ;
421- }
422- }
423- if (abs (motherPdg) == Pdg::kDStar ) {
424- LOG (info) << " Leaving function with channel: " << static_cast <int >(*channel);
425- }
426- } else {
427- if (motherPdg != Pdg::kD0 ) {
428- LOG (error) << " Resonant decay flagging is only implemented for D0 resonances in 2-prong decays." ;
429- return ;
413+ // / Flag the resonant decays
414+ // / Function documentation:
415+ // / \tparam is3Prong bool to specify if the mother decays with a 3-prong decay
416+ // / \tparam N size of the array of daughter PDG codes
417+ // / \param motherPdg PDG code of the mother particle
418+ // / \param channel decay channel flag to be set
419+ // / \param arrDaughPdgs array of daughter PDG codes
420+ template <bool is3Prong = false , std::size_t N>
421+ void flagResonantDecay (int motherPdg, int8_t * channel, std::array<int , N> arrDaughPdgs) {
422+ if constexpr (is3Prong) {
423+ std::unordered_map<hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > resoStates = getResoChannels3Prong (motherPdg);
424+ if (abs (motherPdg) == Pdg::kDPlus ) {
425+ std::cout << " Flagging resonant channel for D+ with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
426+ }
427+ if (abs (motherPdg) == Pdg::kDS ) {
428+ std::cout << " Flagging resonant channel for Ds with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
429+ }
430+ if (abs (motherPdg) == Pdg::kDStar ) {
431+ std::cout << " Flagging resonant channel for Dstar with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
432+ }
433+ if (abs (motherPdg) == Pdg::kLambdaCPlus ) {
434+ std::cout << " Flagging resonant channel for LambdaC with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
435+ }
436+ if (abs (motherPdg) == Pdg::kXiCPlus ) {
437+ std::cout << " Flagging resonant channel for XiC with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
438+ }
439+ for (const auto & [flag, pdgCodes] : resoStates) {
440+ if (checkResonantDecay (arrDaughPdgs, pdgCodes)) {
441+ *channel = flag;
442+ // if (abs(motherPdg) == Pdg::kDStar) {
443+ // LOG(info) << "Dstar resonant decay found with channel: " << static_cast<int>(*channel);
444+ // }
445+ break ;
430446 }
431- for (const auto & [flag, pdgCodes] : o2::hf_decay::hf_cand_2prong::resoStatesD0) {
432- std::cout << " Checking D0 resonant decay with flag: " << flag << " , pdgCodes: " << pdgCodes[0 ] << " , " << pdgCodes[1 ] << " vs " << arrDaughIndex[0 ] << " " << arrDaughIndex[1 ] << std::endl;
433- if (checkResonantDecay (arrDaughIndex, pdgCodes)) {
434- *channel = flag;
435- LOG (info) << " D0 resonant decay found with channel: " << static_cast <int >(*channel);
436- break ;
437- }
447+ }
448+ // if (abs(motherPdg) == Pdg::kDStar) {
449+ // LOG(info) << "Leaving function with channel: " << static_cast<int>(*channel);
450+ // }
451+ } else {
452+ if (motherPdg != Pdg::kD0 ) {
453+ // LOG(error) << "Resonant decay flagging is only implemented for D0 resonances in 2-prong decays.";
454+ return ;
455+ }
456+ for (const auto & [flag, pdgCodes] : hf_cand_2prong::resoStatesD0) {
457+ // std::cout << "Checking D0 resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughPdgs[0] << " " << arrDaughPdgs[1] << std::endl;
458+ if (checkResonantDecay (arrDaughPdgs, pdgCodes)) {
459+ *channel = flag;
460+ // LOG(info) << "D0 resonant decay found with channel: " << static_cast<int>(*channel);
461+ break ;
438462 }
439463 }
440464 }
465+ }
441466} // namespace o2::hf_corrbkg
442467
443468#endif // PWGHF_CORE_DECAYCHANNELS_H_
0 commit comments