Skip to content

Commit 73dcb0b

Browse files
committed
New header for matching functions
1 parent 1010e47 commit 73dcb0b

File tree

5 files changed

+254
-222
lines changed

5 files changed

+254
-222
lines changed

PWGHF/Core/DecayChannels.h

Lines changed: 0 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/// \file DecayChannels.h
1313
/// \brief Definitions of constants for MC flagging of HF decay channels.
1414
/// \author Vít Kučera <vit.kucera@cern.ch>, Inha University
15-
/// \author Marcello Di Costanzo <marcello.di.costanzo@cern.ch>, Polytechnic University of Turin and INFN
1615
/// \note DecayChannelMain enums define unique combinations of the mother and the daughters for main channels.
1716
/// \note DecayChannelResonant enums define unique combinations of the mother and the daughters for resonant channels.
1817
/// \note Value 0 is reserved to indicate no match.
@@ -21,12 +20,7 @@
2120
#ifndef PWGHF_CORE_DECAYCHANNELS_H_
2221
#define PWGHF_CORE_DECAYCHANNELS_H_
2322

24-
#include <array>
2523
#include <cstdint>
26-
#include <unordered_map>
27-
#include <vector>
28-
29-
using namespace o2::constants::physics;
3024

3125
namespace o2::hf_decay
3226
{
@@ -59,24 +53,6 @@ enum DecayChannelResonant : int8_t {
5953
//
6054
LastChannelResonant
6155
};
62-
63-
std::unordered_map<DecayChannelMain, std::vector<int>> finalStates2Prongs =
64-
{
65-
{DecayChannelMain::D0ToPiK, std::vector<int>{+kKMinus, +kPiPlus}},
66-
{DecayChannelMain::D0ToPiKPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPi0}},
67-
{DecayChannelMain::D0ToPiPi, std::vector<int>{+kPiMinus, +kPiPlus}},
68-
{DecayChannelMain::D0ToPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPi0}},
69-
{DecayChannelMain::D0ToKK, std::vector<int>{+kKMinus, +kKPlus}},
70-
};
71-
72-
std::unordered_map<DecayChannelResonant, std::array<int, 2>> resoStatesD0 =
73-
{
74-
{DecayChannelResonant::D0ToRhoplusPi, std::array<int, 2>{213, +kPiMinus}},
75-
{DecayChannelResonant::D0ToRhoplusK, std::array<int, 2>{213, +kKMinus}},
76-
{DecayChannelResonant::D0ToKstar0Pi0, std::array<int, 2>{-kK0Star892, +kPi0}},
77-
{DecayChannelResonant::D0ToKstarPi, std::array<int, 2>{-kKPlusStar892, +kPiPlus}},
78-
};
79-
8056
} // namespace hf_cand_2prong
8157

8258
namespace hf_cand_3prong
@@ -152,100 +128,6 @@ enum DecayChannelResonant : int8_t {
152128
//
153129
LastChannelResonant
154130
};
155-
156-
std::unordered_map<DecayChannelResonant, std::array<int, 2>> resoStatesDPlus =
157-
{
158-
{DecayChannelResonant::DplusToPhiPi, std::array<int, 2>{+kPhi, +kPiPlus}},
159-
{DecayChannelResonant::DplusToKstar0K, std::array<int, 2>{-kK0Star892, +kKPlus}},
160-
{DecayChannelResonant::DplusToKstar1430_0K, std::array<int, 2>{+10311, +kKPlus}},
161-
{DecayChannelResonant::DplusToRho0Pi, std::array<int, 2>{+113, +kPiPlus}},
162-
{DecayChannelResonant::DplusToF2_1270Pi, std::array<int, 2>{+225, +kPiPlus}},
163-
};
164-
165-
std::unordered_map<DecayChannelMain, std::vector<int>> finalStatesDPlus =
166-
{
167-
{DecayChannelMain::DplusToPiKPi, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus}},
168-
{DecayChannelMain::DplusToPiKK, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus}},
169-
{DecayChannelMain::DplusToPiKPiPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
170-
{DecayChannelMain::DplusToPiPiPi, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus}},
171-
};
172-
173-
// Ds± → K± K∓ π±
174-
std::unordered_map<DecayChannelResonant, std::array<int, 2>> resoStatesDs =
175-
{
176-
{DecayChannelResonant::DsToPhiPi, std::array<int, 2>{+kPhi, +kPiPlus}},
177-
{DecayChannelResonant::DsToPhiRhoplus, std::array<int, 2>{+kPhi, +213}},
178-
{DecayChannelResonant::DsToKstar0K, std::array<int, 2>{-kK0Star892, +kKPlus}},
179-
{DecayChannelResonant::DsToKstar0Pi, std::array<int, 2>{+kK0Star892, +kPiPlus}},
180-
{DecayChannelResonant::DsToRho0Pi, std::array<int, 2>{113, +kPiPlus}},
181-
{DecayChannelResonant::DsToRho0K, std::array<int, 2>{113, +kKPlus}},
182-
{DecayChannelResonant::DsToF2_1270Pi, std::array<int, 2>{225, +kPiPlus}},
183-
{DecayChannelResonant::DsToF0_1370K, std::array<int, 2>{10221, +kKPlus}},
184-
{DecayChannelResonant::DsToEtaPi, std::array<int, 2>{221, +kPiPlus}},
185-
};
186-
187-
std::unordered_map<DecayChannelMain, std::vector<int>> finalStatesDs =
188-
{
189-
{DecayChannelMain::DsToPiKK, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus}},
190-
{DecayChannelMain::DsToPiKKPi0, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus, +kPi0}},
191-
{DecayChannelMain::DsToPiPiK, std::vector<int>{+kKPlus, +kPiPlus, +kPiMinus}},
192-
{DecayChannelMain::DsToPiPiPi, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus}},
193-
{DecayChannelMain::DsToPiPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus, +kPi0}},
194-
};
195-
196-
// Dstar → K± K∓ π±
197-
std::unordered_map<DecayChannelResonant, std::array<int, 2>> resoStatesDstar =
198-
{
199-
{DecayChannelResonant::DstarToD0ToRhoplusPi, std::array<int, 2>{213, +kPiMinus}},
200-
{DecayChannelResonant::DstarToD0ToRhoplusK, std::array<int, 2>{213, +kKMinus}},
201-
{DecayChannelResonant::DstarToD0ToKstar0Pi0, std::array<int, 2>{-kK0Star892, +kPi0}},
202-
{DecayChannelResonant::DstarToD0ToKstarPi, std::array<int, 2>{-kKPlusStar892, +kPiPlus}},
203-
{DecayChannelResonant::DstarToDplusToPhiPi, std::array<int, 2>{+kPhi, +kPiPlus}},
204-
{DecayChannelResonant::DstarToDplusToKstar0K, std::array<int, 2>{-kK0Star892, +kKPlus}},
205-
{DecayChannelResonant::DstarToDplusToKstar1430_0K, std::array<int, 2>{+10311, +kKPlus}},
206-
{DecayChannelResonant::DstarToDplusToRho0Pi, std::array<int, 2>{+113, +kPiPlus}},
207-
{DecayChannelResonant::DstarToDplusToF2_1270Pi, std::array<int, 2>{+225, +kPiPlus}},
208-
};
209-
210-
std::unordered_map<DecayChannelMain, std::vector<int>> finalStatesDstar =
211-
{
212-
{DecayChannelMain::DstarToPiKPi, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus}},
213-
{DecayChannelMain::DstarToPiKPiPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
214-
{DecayChannelMain::DstarToPiKPiPi0Pi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0, +kPi0}},
215-
{DecayChannelMain::DstarToPiKK, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus}},
216-
{DecayChannelMain::DstarToPiKKPi0, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus, +kPi0}},
217-
{DecayChannelMain::DstarToPiPiPi, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus}},
218-
{DecayChannelMain::DstarToPiPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus, +kPi0}},
219-
};
220-
221-
// Lc → p K∓ π±
222-
std::unordered_map<DecayChannelResonant, std::array<int, 2>> resoStatesLambdaC =
223-
{
224-
{DecayChannelResonant::LcToPKstar0, std::array<int, 2>{+kK0Star892, +kProton}},
225-
{DecayChannelResonant::LcToDeltaplusplusK, std::array<int, 2>{+2224, +kKMinus}},
226-
{DecayChannelResonant::LcToL1520Pi, std::array<int, 2>{+102134, +kPiPlus}},
227-
};
228-
229-
std::unordered_map<DecayChannelMain, std::vector<int>> finalStatesLc =
230-
{
231-
{DecayChannelMain::LcToPKPi, std::vector<int>{+kProton, +kKMinus, +kPiPlus}},
232-
{DecayChannelMain::LcToPKPiPi0, std::vector<int>{+kProton, +kKMinus, +kPiPlus, +kPi0}},
233-
{DecayChannelMain::LcToPPiPi, std::vector<int>{+kProton, +kPiMinus, +kPiPlus}},
234-
{DecayChannelMain::LcToPKK, std::vector<int>{+kProton, +kKMinus, +kKPlus}}};
235-
236-
// Xic → p K∓ π±
237-
std::unordered_map<DecayChannelResonant, std::array<int, 2>> resoStatesXiC =
238-
{
239-
{DecayChannelResonant::XicToPKstar0, std::array<int, 2>{-kK0Star892, +kProton}},
240-
{DecayChannelResonant::XicToPPhi, std::array<int, 2>{+kProton, +kPhi}},
241-
};
242-
243-
std::unordered_map<DecayChannelMain, std::vector<int>> finalStatesXic =
244-
{
245-
{DecayChannelMain::XicToPKPi, std::vector<int>{+kProton, +kKMinus, +kPiPlus}},
246-
{DecayChannelMain::XicToPKK, std::vector<int>{+kProton, +kKMinus, +kKPlus}},
247-
{DecayChannelMain::XicToSPiPi, std::vector<int>{+kSigmaPlus, +kPiMinus, +kPiPlus}},
248-
};
249131
} // namespace hf_cand_3prong
250132

251133
namespace hf_cand_dstar
@@ -335,108 +217,4 @@ enum DecayChannelToJpsiResonant : int8_t {
335217
} // namespace hf_cand_beauty
336218
} // namespace o2::hf_decay
337219

338-
namespace o2::hf_corrbkg
339-
{
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)
346-
{
347-
switch (pdgMother) {
348-
case Pdg::kDPlus:
349-
return hf_cand_3prong::finalStatesDPlus;
350-
case Pdg::kDS:
351-
return hf_cand_3prong::finalStatesDs;
352-
case Pdg::kDStar:
353-
return hf_cand_3prong::finalStatesDstar;
354-
case Pdg::kLambdaCPlus:
355-
return hf_cand_3prong::finalStatesLc;
356-
case Pdg::kXiCPlus:
357-
return hf_cand_3prong::finalStatesXic;
358-
default:
359-
LOG(error) << "Unknown PDG code for 3-prong final states: " << pdgMother;
360-
return {};
361-
}
362-
}
363-
364-
/// Returns a map of the resonant decay channels for a specific 3-prong particle specie
365-
/// \param pdgMother PDG code of the mother particle
366-
/// \return a map of resonant decay channels with their corresponding PDG codes
367-
std::unordered_map<hf_cand_3prong::DecayChannelResonant, std::array<int, 2>> getResoChannels3Prong(int pdgMother)
368-
{
369-
switch (pdgMother) {
370-
case Pdg::kDPlus:
371-
return hf_cand_3prong::resoStatesDPlus;
372-
case Pdg::kDS:
373-
return hf_cand_3prong::resoStatesDs;
374-
case Pdg::kDStar:
375-
return hf_cand_3prong::resoStatesDstar;
376-
case Pdg::kLambdaCPlus:
377-
return hf_cand_3prong::resoStatesLambdaC;
378-
case Pdg::kXiCPlus:
379-
return hf_cand_3prong::resoStatesXiC;
380-
default:
381-
LOG(error) << "Unknown PDG code for 3-prong final states: " << pdgMother;
382-
return {};
383-
}
384-
}
385-
386-
/// Perform the matching for a single resonant channel
387-
/// \tparam N size of the array of daughter PDG codes
388-
/// \param arrPdgResoChn array of daughter indices
389-
/// \param arrPdgDaugs array of PDG codes for the resonant decay
390-
/// \return true if the resonant channel is matched, false otherwise
391-
template <std::size_t N>
392-
bool checkResonantDecay(std::array<int, N> arrPdgResoChn, std::array<int, N> arrPdgDaugs)
393-
{
394-
for (size_t i = 0; i < N; i++) {
395-
bool findDaug = false;
396-
for (size_t j = 0; j < N; j++) {
397-
if (std::abs(arrPdgResoChn[i]) == std::abs(arrPdgDaugs[j])) {
398-
arrPdgDaugs[j] = -1; // Mark as found
399-
findDaug = true;
400-
break;
401-
}
402-
}
403-
if (!findDaug) {
404-
return false;
405-
}
406-
}
407-
return true;
408-
}
409-
410-
/// Flag the resonant decays
411-
/// Function documentation:
412-
/// \tparam is3Prong bool to specify if the mother decays with a 3-prong decay
413-
/// \tparam N size of the array of daughter PDG codes
414-
/// \param motherPdg PDG code of the mother particle
415-
/// \param channel decay channel flag to be set
416-
/// \param arrDaughPdgs array of daughter PDG codes
417-
template <bool is3Prong = false, std::size_t N>
418-
void flagResonantDecay(int motherPdg, int8_t* channel, std::array<int, N> arrDaughPdgs)
419-
{
420-
if constexpr (is3Prong) {
421-
std::unordered_map<hf_cand_3prong::DecayChannelResonant, std::array<int, 2>> resoStates = getResoChannels3Prong(motherPdg);
422-
for (const auto& [flag, pdgCodes] : resoStates) {
423-
if (checkResonantDecay(arrDaughPdgs, pdgCodes)) {
424-
*channel = flag;
425-
break;
426-
}
427-
}
428-
} else {
429-
if (motherPdg != Pdg::kD0) {
430-
return;
431-
}
432-
for (const auto& [flag, pdgCodes] : hf_cand_2prong::resoStatesD0) {
433-
if (checkResonantDecay(arrDaughPdgs, pdgCodes)) {
434-
*channel = flag;
435-
break;
436-
}
437-
}
438-
}
439-
}
440-
} // namespace o2::hf_corrbkg
441-
442220
#endif // PWGHF_CORE_DECAYCHANNELS_H_

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "PWGHF/Utils/utilsMcGen.h"
5555
#include "PWGHF/Utils/utilsPid.h"
5656
#include "PWGHF/Utils/utilsTrkCandHf.h"
57+
#include "PWGHF/Utils/utilsMcMatching.h"
5758

5859
using namespace o2;
5960
using namespace o2::analysis;

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "PWGHF/Utils/utilsMcGen.h"
5454
#include "PWGHF/Utils/utilsPid.h"
5555
#include "PWGHF/Utils/utilsTrkCandHf.h"
56+
#include "PWGHF/Utils/utilsMcMatching.h"
5657

5758
using namespace o2;
5859
using namespace o2::hf_evsel;

PWGHF/Utils/utilsMcGen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "PWGHF/Core/DecayChannels.h"
3232
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
33+
#include "PWGHF/Utils/utilsMcMatching.h"
3334

3435
using namespace o2::hf_decay::hf_cand_2prong;
3536
using namespace o2::hf_decay::hf_cand_3prong;

0 commit comments

Comments
 (0)