@@ -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 }},
@@ -312,108 +311,134 @@ enum DecayChannelResonant : int8_t {
312311} // namespace hf_cand_beauty
313312} // namespace o2::hf_decay
314313
315- // using namespace o2::hf_decay;
316-
317314namespace o2 ::hf_corrbkg
318315{
319- std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelMain, std::vector<int > > getDecayChannel3Prong (int pdgMother) {
316+ using namespace o2 ::hf_decay;
317+
318+ // / Returns a map of the possible final states for a specific 3-prong particle specie
319+ // / \param pdgMother PDG code of the mother particle
320+ // / \return a map of final states with their corresponding PDG codes
321+ std::unordered_map<hf_cand_3prong::DecayChannelMain, std::vector<int > > getDecayChannel3Prong (int pdgMother) {
320322 switch (pdgMother) {
321323 case Pdg::kDPlus :
322- return o2::hf_decay:: hf_cand_3prong::finalStatesDPlus;
324+ return hf_cand_3prong::finalStatesDPlus;
323325 case Pdg::kDS :
324- return o2::hf_decay:: hf_cand_3prong::finalStatesDs;
326+ return hf_cand_3prong::finalStatesDs;
325327 case Pdg::kDStar :
326- return o2::hf_decay:: hf_cand_3prong::finalStatesDstar;
328+ return hf_cand_3prong::finalStatesDstar;
327329 case Pdg::kLambdaCPlus :
328- return o2::hf_decay:: hf_cand_3prong::finalStatesLc;
330+ return hf_cand_3prong::finalStatesLc;
329331 case Pdg::kXiCPlus :
330- return o2::hf_decay:: hf_cand_3prong::finalStatesXic;
332+ return hf_cand_3prong::finalStatesXic;
331333 default :
332334 LOG (error) << " Unknown PDG code for 3-prong final states: " << pdgMother;
333335 return {};
334336 }
335337 }
336338
337- std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > getResoChannels3Prong (int pdgMother) {
339+ // / Returns a map of the resonant decay channels for a specific 3-prong particle specie
340+ // / \param pdgMother PDG code of the mother particle
341+ // / \return a map of resonant decay channels with their corresponding PDG codes
342+ std::unordered_map<hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > getResoChannels3Prong (int pdgMother) {
338343 switch (pdgMother) {
339344 case Pdg::kDPlus :
340- return o2::hf_decay:: hf_cand_3prong::resoStatesDPlus;
345+ return hf_cand_3prong::resoStatesDPlus;
341346 case Pdg::kDS :
342- return o2::hf_decay:: hf_cand_3prong::resoStatesDs;
347+ return hf_cand_3prong::resoStatesDs;
343348 case Pdg::kDStar :
344- return o2::hf_decay:: hf_cand_3prong::resoStatesDstar;
349+ return hf_cand_3prong::resoStatesDstar;
345350 case Pdg::kLambdaCPlus :
346- return o2::hf_decay:: hf_cand_3prong::resoStatesLambdaC;
351+ return hf_cand_3prong::resoStatesLambdaC;
347352 case Pdg::kXiCPlus :
348- return o2::hf_decay:: hf_cand_3prong::resoStatesXiC;
353+ return hf_cand_3prong::resoStatesXiC;
349354 default :
350355 LOG (error) << " Unknown PDG code for 3-prong final states: " << pdgMother;
351356 return {};
352357 }
353358 }
354359
360+ // / Perform the matching for a single resonant channel
361+ // / \tparam N size of the array of daughter PDG codes
362+ // / \param arrPdgResoChn array of daughter indices
363+ // / \param arrPdgDaugs array of PDG codes for the resonant decay
364+ // / \return true if the resonant channel is matched, false otherwise
355365 template <std::size_t N>
356- bool checkResonantDecay (std::array<int , N> arrDaughIndex, std::array<int , N> arrPDGResonant) {
357- LOG (info) << " Testing: " << arrDaughIndex[0 ] << " , " << arrDaughIndex[1 ] << " matching PDG codes: " << arrPDGResonant[0 ] << " , " << arrPDGResonant[1 ];
358- for (int i = 0 ; i < N; i++) {
359- LOG (info) << " Checking daughter index: " << arrDaughIndex[i];
360- bool findDaug = false ;
361- for (int j = 0 ; j < N; j++) {
362- LOG (info) << " Checking daughter PDG: " << arrDaughIndex[i] << " against resonant PDG: " << arrPDGResonant[j];
363- if (std::abs (arrDaughIndex[i]) == std::abs (arrPDGResonant[j])) {
364- arrPDGResonant[j] = -1 ; // Mark as found
365- LOG (info) << " Matched!" ;
366- findDaug = true ;
367- break ;
368- }
369- }
370- if (!findDaug) {
371- LOG (info) << " Returning false" ;
372- return false ;
366+ bool checkResonantDecay (std::array<int , N> arrPdgResoChn, std::array<int , N> arrPdgDaugs) {
367+ // LOG(info) << "Testing: " << arrPdgResoChn[0] << ", " << arrPdgResoChn[1] << " matching PDG codes: " << arrPdgDaugs[0] << ", " << arrPdgDaugs[1];
368+ for (size_t i = 0 ; i < N; i++) {
369+ // LOG(info) << "Checking daughter index: " << arrPdgResoChn[i];
370+ bool findDaug = false ;
371+ for (size_t j = 0 ; j < N; j++) {
372+ // LOG(info) << "Checking daughter PDG: " << arrPdgResoChn[i] << " against resonant PDG: " << arrPdgDaugs[j];
373+ if (std::abs (arrPdgResoChn[i]) == std::abs (arrPdgDaugs[j])) {
374+ arrPdgDaugs[j] = -1 ; // Mark as found
375+ // LOG(info) << "Matched!";
376+ findDaug = true ;
377+ break ;
373378 }
374379 }
375- LOG (info) << " Resonant decay found with daughters: " << arrDaughIndex[0 ] << " , " << arrDaughIndex[1 ] << " matching PDG codes: " << arrPDGResonant[0 ] << " , " << arrPDGResonant[1 ];
376- return true ;
380+ if (!findDaug) {
381+ // LOG(info) << "Returning false";
382+ return false ;
383+ }
377384 }
385+ // LOG(info) << "Resonant decay found with daughters: " << arrPdgResoChn[0] << ", " << arrPdgResoChn[1] << " matching PDG codes: " << arrPdgDaugs[0] << ", " << arrPdgDaugs[1];
386+ return true ;
387+ }
378388
379- // / Check if the decay is resonant
380- // / \tparam arrDaughIndex index of the particle daughters at resonance level
381- // / \tparam arrPDGResonant PDG code of the resonant decay
382- // / \return true if the decay is resonant
383- template <bool is3Prong = false , std::size_t N>
384- void flagResonantDecay (int motherPdg, int8_t * channel, std::array<int , N> arrDaughIndex) {
385- if constexpr (is3Prong) {
386- std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > resoStates = getResoChannels3Prong (motherPdg);
387- for (const auto & [flag, pdgCodes] : resoStates) {
388- if (abs (motherPdg) == Pdg::kDStar ) {
389- std::cout << " Checking Dstar resonant decay with flag: " << flag << " , pdgCodes: " << pdgCodes[0 ] << " , " << pdgCodes[1 ] << " vs " << arrDaughIndex[0 ] << " " << arrDaughIndex[1 ] << std::endl;
390- }
391- if (checkResonantDecay (arrDaughIndex, pdgCodes)) {
392- *channel = flag;
393- if (abs (motherPdg) == Pdg::kDStar ) {
394- LOG (info) << " Dstar resonant decay found with channel: " << static_cast <int >(*channel);
395- }
396- break ;
397- }
398- }
399- if (abs (motherPdg) == Pdg::kDStar ) {
400- LOG (info) << " Leaving function with channel: " << static_cast <int >(*channel);
401- }
402- } else {
403- if (motherPdg != Pdg::kD0 ) {
404- LOG (error) << " Resonant decay flagging is only implemented for D0 resonances in 2-prong decays." ;
405- return ;
389+ // / Flag the resonant decays
390+ // / Function documentation:
391+ // / \tparam is3Prong bool to specify if the mother decays with a 3-prong decay
392+ // / \tparam N size of the array of daughter PDG codes
393+ // / \param motherPdg PDG code of the mother particle
394+ // / \param channel decay channel flag to be set
395+ // / \param arrDaughPdgs array of daughter PDG codes
396+ template <bool is3Prong = false , std::size_t N>
397+ void flagResonantDecay (int motherPdg, int8_t * channel, std::array<int , N> arrDaughPdgs) {
398+ if constexpr (is3Prong) {
399+ std::unordered_map<hf_cand_3prong::DecayChannelResonant, std::array<int , 2 > > resoStates = getResoChannels3Prong (motherPdg);
400+ if (abs (motherPdg) == Pdg::kDPlus ) {
401+ std::cout << " Flagging resonant channel for D+ with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
402+ }
403+ if (abs (motherPdg) == Pdg::kDS ) {
404+ std::cout << " Flagging resonant channel for Ds with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
405+ }
406+ if (abs (motherPdg) == Pdg::kDStar ) {
407+ std::cout << " Flagging resonant channel for Dstar with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
408+ }
409+ if (abs (motherPdg) == Pdg::kLambdaCPlus ) {
410+ std::cout << " Flagging resonant channel for LambdaC with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
411+ }
412+ if (abs (motherPdg) == Pdg::kXiCPlus ) {
413+ std::cout << " Flagging resonant channel for XiC with daughters: " << arrDaughPdgs[0 ] << " " << arrDaughPdgs[1 ] << std::endl;
414+ }
415+ for (const auto & [flag, pdgCodes] : resoStates) {
416+ if (checkResonantDecay (arrDaughPdgs, pdgCodes)) {
417+ *channel = flag;
418+ // if (abs(motherPdg) == Pdg::kDStar) {
419+ // LOG(info) << "Dstar resonant decay found with channel: " << static_cast<int>(*channel);
420+ // }
421+ break ;
406422 }
407- for (const auto & [flag, pdgCodes] : o2::hf_decay::hf_cand_2prong::resoStatesD0) {
408- std::cout << " Checking D0 resonant decay with flag: " << flag << " , pdgCodes: " << pdgCodes[0 ] << " , " << pdgCodes[1 ] << " vs " << arrDaughIndex[0 ] << " " << arrDaughIndex[1 ] << std::endl;
409- if (checkResonantDecay (arrDaughIndex, pdgCodes)) {
410- *channel = flag;
411- LOG (info) << " D0 resonant decay found with channel: " << static_cast <int >(*channel);
412- break ;
413- }
423+ }
424+ // if (abs(motherPdg) == Pdg::kDStar) {
425+ // LOG(info) << "Leaving function with channel: " << static_cast<int>(*channel);
426+ // }
427+ } else {
428+ if (motherPdg != Pdg::kD0 ) {
429+ // LOG(error) << "Resonant decay flagging is only implemented for D0 resonances in 2-prong decays.";
430+ return ;
431+ }
432+ for (const auto & [flag, pdgCodes] : hf_cand_2prong::resoStatesD0) {
433+ // std::cout << "Checking D0 resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughPdgs[0] << " " << arrDaughPdgs[1] << std::endl;
434+ if (checkResonantDecay (arrDaughPdgs, pdgCodes)) {
435+ *channel = flag;
436+ // LOG(info) << "D0 resonant decay found with channel: " << static_cast<int>(*channel);
437+ break ;
414438 }
415439 }
416440 }
441+ }
417442} // namespace o2::hf_corrbkg
418443
419444#endif // PWGHF_CORE_DECAYCHANNELS_H_
0 commit comments