Skip to content

Commit c0ad787

Browse files
committed
Change name of method and move enum from HFSecondaryVertex to RecoDecay
1 parent 710fe61 commit c0ad787

8 files changed

Lines changed: 41 additions & 30 deletions

File tree

Common/Core/RecoDecay.h

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ using namespace o2::constants::math;
4040
/// - calculation of topological properties of secondary vertices
4141
/// - Monte Carlo matching of decays at track and particle level
4242

43+
// mapping of charm-hadron origin type
44+
namespace o2
45+
{
46+
namespace aod
47+
{
48+
namespace hf_cand
49+
{
50+
enum OriginType { None = 0,
51+
Prompt,
52+
NonPrompt };
53+
} // namespace hf_cand
54+
} // namespace aod
55+
} // namespace o2
56+
57+
using namespace o2::aod::hf_cand;
58+
4359
class RecoDecay
4460
{
4561
public:
@@ -917,11 +933,11 @@ class RecoDecay
917933
/// \param particlesMC table with MC particles
918934
/// \param particle MC particle
919935
/// \param searchUpToQuark if true tag origin based on charm/beauty quark otherwise on b-hadron
920-
/// \return an integer corresponding to the origin (0: none, 1: prompt, 2: nonprompt) as in hf_cand::OriginType (see PWGHF/DataModel/HFSecondaryVertex.h)
936+
/// \return an integer corresponding to the origin (0: none, 1: prompt, 2: nonprompt) as in OriginType
921937
template <typename T>
922-
static int checkCharmHadronOrigin(const T& particlesMC,
923-
const typename T::iterator& particle,
924-
const bool& searchUpToQuark = false)
938+
static int getCharmHadronOrigin(const T& particlesMC,
939+
const typename T::iterator& particle,
940+
const bool& searchUpToQuark = false)
925941
{
926942
int stage = 0; // mother tree level (just for debugging)
927943

@@ -948,19 +964,19 @@ class RecoDecay
948964
// printf(" ");
949965
// printf("Stage %d: Mother PDG: %d, Index: %d\n", stage, PDGParticleIMother, iMother);
950966

951-
if (!searchUpToQuark) {
967+
if (searchUpToQuark) {
968+
if (PDGParticleIMother == 5) { // b quark
969+
return OriginType::NonPrompt;
970+
}
971+
if (PDGParticleIMother == 4) { // c quark
972+
return OriginType::Prompt;
973+
}
974+
} else {
952975
if (
953976
(PDGParticleIMother / 100 == 5 || // b mesons
954977
PDGParticleIMother / 1000 == 5) // b baryons
955978
) {
956-
return 2;
957-
}
958-
} else {
959-
if (PDGParticleIMother == 5) { // b quark
960-
return 2;
961-
}
962-
if (PDGParticleIMother == 4) { // c quark
963-
return 1;
979+
return OriginType::NonPrompt;
964980
}
965981
}
966982
// add mother index in the vector for the current stage
@@ -973,9 +989,9 @@ class RecoDecay
973989
stage--;
974990
}
975991
if (!searchUpToQuark) {
976-
return 1;
992+
return OriginType::Prompt;
977993
}
978-
return 0;
994+
return OriginType::None;
979995
}
980996

981997
private:

EventFiltering/PWGHF/HFFilter.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ struct HfFilter { // Main struct for HF triggers
982982
auto indexRec = RecoDecay::getMatchedMCRec(particlesMC, std::array{trackPos, trackNeg}, pdg::Code::kD0, array{+kPiPlus, -kKPlus}, true, &sign);
983983
if (indexRec > -1) {
984984
auto particle = particlesMC.rawIteratorAt(indexRec);
985-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
985+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle, false);
986986
if (origin == OriginType::NonPrompt) {
987987
flag = kNonPrompt;
988988
} else if (origin == OriginType::Prompt) {
@@ -1041,7 +1041,7 @@ struct HfFilter { // Main struct for HF triggers
10411041

10421042
if (indexRec > -1) {
10431043
auto particle = particlesMC.rawIteratorAt(indexRec);
1044-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
1044+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle, false);
10451045
if (origin == OriginType::NonPrompt) {
10461046
flag = kNonPrompt;
10471047
} else {

PWGHF/DataModel/HFSecondaryVertex.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(Ct, ct, //!
290290
[](float xVtxP, float yVtxP, float zVtxP, float xVtxS, float yVtxS, float zVtxS, float px, float py, float pz, double m) -> float { return RecoDecay::ct(array{px, py, pz}, RecoDecay::distance(array{xVtxP, yVtxP, zVtxP}, array{xVtxS, yVtxS, zVtxS}), m); });
291291
DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterXY, impactParameterXY, //!
292292
[](float xVtxP, float yVtxP, float zVtxP, float xVtxS, float yVtxS, float zVtxS, float px, float py, float pz) -> float { return RecoDecay::impParXY(array{xVtxP, yVtxP, zVtxP}, array{xVtxS, yVtxS, zVtxS}, array{px, py, pz}); });
293-
294-
// mapping of origin type
295-
enum OriginType { None = 0,
296-
Prompt,
297-
NonPrompt };
298293
} // namespace hf_cand
299294

300295
// specific 2-prong decay properties

PWGHF/TableProducer/HFCandidateCreator2Prong.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ struct HFCandidateCreator2ProngExpressions {
210210
// Check whether the particle is non-prompt (from a b quark).
211211
if (flag != 0) {
212212
auto particle = particlesMC.rawIteratorAt(indexRec);
213-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
213+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
214214
}
215215

216216
rowMCMatchRec(flag, origin);
@@ -246,7 +246,7 @@ struct HFCandidateCreator2ProngExpressions {
246246

247247
// Check whether the particle is non-prompt (from a b quark).
248248
if (flag != 0) {
249-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
249+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
250250
}
251251

252252
rowMCMatchGen(flag, origin);

PWGHF/TableProducer/HFCandidateCreator3Prong.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ struct HFCandidateCreator3ProngExpressions {
251251
// Check whether the particle is non-prompt (from a b quark).
252252
if (flag != 0) {
253253
auto particle = particlesMC.rawIteratorAt(indexRec);
254-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
254+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
255255
}
256256

257257
rowMCMatchRec(flag, origin, swapping, channel);
@@ -305,7 +305,7 @@ struct HFCandidateCreator3ProngExpressions {
305305

306306
// Check whether the particle is non-prompt (from a b quark).
307307
if (flag != 0) {
308-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
308+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
309309
}
310310

311311
rowMCMatchGen(flag, origin, channel);

PWGHF/TableProducer/HFCandidateCreatorChic.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ struct HFCandidateCreatorChicMC {
249249
}
250250
if (flag != 0) {
251251
auto particle = particlesMC.rawIteratorAt(indexRec);
252-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
252+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
253253
}
254254
rowMCMatchRec(flag, origin, channel);
255255
}

PWGHF/TableProducer/HFCandidateCreatorX.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ struct HFCandidateCreatorXMC {
305305
// Check whether the particle is non-prompt (from a b quark).
306306
if (flag != 0) {
307307
auto particle = particlesMC.rawIteratorAt(indexRec);
308-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
308+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
309309
}
310310

311311
rowMCMatchRec(flag, origin, channel);
@@ -338,7 +338,7 @@ struct HFCandidateCreatorXMC {
338338

339339
// Check whether the particle is non-prompt (from a b quark).
340340
if (flag != 0) {
341-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
341+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
342342
}
343343

344344
rowMCMatchGen(flag, origin, channel);

PWGHF/Tasks/HFMCValidation.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ struct ValidationGenLevel {
157157
std::size_t arrayPDGsize = arrPDGFinal[iD].size() - std::count(arrPDGFinal[iD].begin(), arrPDGFinal[iD].end(), 0);
158158
int origin = -1;
159159
if (listDaughters.size() == arrayPDGsize) {
160-
origin = RecoDecay::checkCharmHadronOrigin(particlesMC, particle, false);
160+
origin = RecoDecay::getCharmHadronOrigin(particlesMC, particle);
161161
if (origin == OriginType::Prompt) {
162162
counterPrompt[iD]++;
163163
} else if (origin == OriginType::NonPrompt) {

0 commit comments

Comments
 (0)