Skip to content

Commit bd6c1b4

Browse files
authored
[PWGHF] Add bitmap of primary-vertex-contributor prongs (#9051)
1 parent 647a953 commit bd6c1b4

File tree

5 files changed

+58
-35
lines changed

5 files changed

+58
-35
lines changed

PWGHF/DataModel/CandidateReconstructionTables.h

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -484,26 +484,27 @@ DECLARE_SOA_COLUMN(ErrorImpactParameterZ2, errorImpactParameterZ2, float);
484484
DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterZNormalised2, impactParameterZNormalised2, //!
485485
[](float dca, float err) -> float { return dca / err; });
486486
/// prong PID nsigma
487-
DECLARE_SOA_COLUMN(NProngsContributorsPV, nProngsContributorsPV, uint8_t); //! number of prongs contributing to the primary-vertex reconstruction
488-
DECLARE_SOA_COLUMN(NSigTpcPi0, nSigTpcPi0, float); //! TPC nSigma for pion hypothesis - prong 0
489-
DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC nSigma for pion hypothesis - prong 1
490-
DECLARE_SOA_COLUMN(NSigTpcPi2, nSigTpcPi2, float); //! TPC nSigma for pion hypothesis - prong 2
491-
DECLARE_SOA_COLUMN(NSigTpcKa0, nSigTpcKa0, float); //! TPC nSigma for kaon hypothesis - prong 0
492-
DECLARE_SOA_COLUMN(NSigTpcKa1, nSigTpcKa1, float); //! TPC nSigma for kaon hypothesis - prong 1
493-
DECLARE_SOA_COLUMN(NSigTpcKa2, nSigTpcKa2, float); //! TPC nSigma for kaon hypothesis - prong 2
494-
DECLARE_SOA_COLUMN(NSigTpcPr0, nSigTpcPr0, float); //! TPC nSigma for proton hypothesis - prong 0
495-
DECLARE_SOA_COLUMN(NSigTpcPr1, nSigTpcPr1, float); //! TPC nSigma for proton hypothesis - prong 1
496-
DECLARE_SOA_COLUMN(NSigTpcPr2, nSigTpcPr2, float); //! TPC nSigma for proton hypothesis - prong 2
497-
DECLARE_SOA_COLUMN(NSigTofPi0, nSigTofPi0, float); //! TOF nSigma for pion hypothesis - prong 0
498-
DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF nSigma for pion hypothesis - prong 1
499-
DECLARE_SOA_COLUMN(NSigTofPi2, nSigTofPi2, float); //! TOF nSigma for pion hypothesis - prong 2
500-
DECLARE_SOA_COLUMN(NSigTofKa0, nSigTofKa0, float); //! TOF nSigma for kaon hypothesis - prong 0
501-
DECLARE_SOA_COLUMN(NSigTofKa1, nSigTofKa1, float); //! TOF nSigma for kaon hypothesis - prong 1
502-
DECLARE_SOA_COLUMN(NSigTofKa2, nSigTofKa2, float); //! TOF nSigma for kaon hypothesis - prong 2
503-
DECLARE_SOA_COLUMN(NSigTofPr0, nSigTofPr0, float); //! TOF nSigma for proton hypothesis - prong 0
504-
DECLARE_SOA_COLUMN(NSigTofPr1, nSigTofPr1, float); //! TOF nSigma for proton hypothesis - prong 1
505-
DECLARE_SOA_COLUMN(NSigTofPr2, nSigTofPr2, float); //! TOF nSigma for proton hypothesis - prong 2
506-
DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi0, tpcTofNSigmaPi0, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 0
487+
DECLARE_SOA_COLUMN(NProngsContributorsPV, nProngsContributorsPV, uint8_t); //! number of prongs contributing to the primary-vertex reconstruction
488+
DECLARE_SOA_COLUMN(BitmapProngsContributorsPV, bitmapProngsContributorsPV, uint8_t); //! bitmap with booleans indicating prongs contributing to the primary-vertex reconstruction
489+
DECLARE_SOA_COLUMN(NSigTpcPi0, nSigTpcPi0, float); //! TPC nSigma for pion hypothesis - prong 0
490+
DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC nSigma for pion hypothesis - prong 1
491+
DECLARE_SOA_COLUMN(NSigTpcPi2, nSigTpcPi2, float); //! TPC nSigma for pion hypothesis - prong 2
492+
DECLARE_SOA_COLUMN(NSigTpcKa0, nSigTpcKa0, float); //! TPC nSigma for kaon hypothesis - prong 0
493+
DECLARE_SOA_COLUMN(NSigTpcKa1, nSigTpcKa1, float); //! TPC nSigma for kaon hypothesis - prong 1
494+
DECLARE_SOA_COLUMN(NSigTpcKa2, nSigTpcKa2, float); //! TPC nSigma for kaon hypothesis - prong 2
495+
DECLARE_SOA_COLUMN(NSigTpcPr0, nSigTpcPr0, float); //! TPC nSigma for proton hypothesis - prong 0
496+
DECLARE_SOA_COLUMN(NSigTpcPr1, nSigTpcPr1, float); //! TPC nSigma for proton hypothesis - prong 1
497+
DECLARE_SOA_COLUMN(NSigTpcPr2, nSigTpcPr2, float); //! TPC nSigma for proton hypothesis - prong 2
498+
DECLARE_SOA_COLUMN(NSigTofPi0, nSigTofPi0, float); //! TOF nSigma for pion hypothesis - prong 0
499+
DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF nSigma for pion hypothesis - prong 1
500+
DECLARE_SOA_COLUMN(NSigTofPi2, nSigTofPi2, float); //! TOF nSigma for pion hypothesis - prong 2
501+
DECLARE_SOA_COLUMN(NSigTofKa0, nSigTofKa0, float); //! TOF nSigma for kaon hypothesis - prong 0
502+
DECLARE_SOA_COLUMN(NSigTofKa1, nSigTofKa1, float); //! TOF nSigma for kaon hypothesis - prong 1
503+
DECLARE_SOA_COLUMN(NSigTofKa2, nSigTofKa2, float); //! TOF nSigma for kaon hypothesis - prong 2
504+
DECLARE_SOA_COLUMN(NSigTofPr0, nSigTofPr0, float); //! TOF nSigma for proton hypothesis - prong 0
505+
DECLARE_SOA_COLUMN(NSigTofPr1, nSigTofPr1, float); //! TOF nSigma for proton hypothesis - prong 1
506+
DECLARE_SOA_COLUMN(NSigTofPr2, nSigTofPr2, float); //! TOF nSigma for proton hypothesis - prong 2
507+
DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi0, tpcTofNSigmaPi0, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 0
507508
[](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma<false /*tiny*/>(tpcNSigmaPi0, tofNSigmaPi0); });
508509
DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi1, tpcTofNSigmaPi1, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 1
509510
[](float tpcNSigmaPi1, float tofNSigmaPi1) -> float { return pid_tpc_tof_utils::combineNSigma<false /*tiny*/>(tpcNSigmaPi1, tofNSigmaPi1); });
@@ -664,7 +665,7 @@ DECLARE_SOA_TABLE(HfCand2ProngBase, "AOD", "HFCAND2PBASE", //!
664665
hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1,
665666
hf_cand::ImpactParameterZ0, hf_cand::ImpactParameterZ1,
666667
hf_cand::ErrorImpactParameterZ0, hf_cand::ErrorImpactParameterZ1,
667-
hf_track_index::Prong0Id, hf_track_index::Prong1Id, hf_cand::NProngsContributorsPV,
668+
hf_track_index::Prong0Id, hf_track_index::Prong1Id, hf_cand::NProngsContributorsPV, hf_cand::BitmapProngsContributorsPV,
668669
hf_track_index::HFflag,
669670
/* dynamic columns */
670671
hf_cand_2prong::M<hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1>,
@@ -970,7 +971,7 @@ DECLARE_SOA_TABLE(HfCand3ProngBase, "AOD", "HFCAND3PBASE", //!
970971
hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2,
971972
hf_cand::ImpactParameterZ0, hf_cand::ImpactParameterZ1, hf_cand::ImpactParameterZ2,
972973
hf_cand::ErrorImpactParameterZ0, hf_cand::ErrorImpactParameterZ1, hf_cand::ErrorImpactParameterZ2,
973-
hf_track_index::Prong0Id, hf_track_index::Prong1Id, hf_track_index::Prong2Id, hf_cand::NProngsContributorsPV,
974+
hf_track_index::Prong0Id, hf_track_index::Prong1Id, hf_track_index::Prong2Id, hf_cand::NProngsContributorsPV, hf_cand::BitmapProngsContributorsPV,
974975
hf_track_index::HFflag,
975976
/* dynamic columns */
976977
hf_cand_3prong::M<hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2>,

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,14 @@ struct HfCandidateCreator2Prong {
281281
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.));
282282

283283
auto indexCollision = collision.globalIndex();
284-
uint8_t nProngsContributorsPV = 0;
284+
uint8_t bitmapProngsContributorsPV = 0;
285285
if (indexCollision == track0.collisionId() && track0.isPVContributor()) {
286-
nProngsContributorsPV += 1;
286+
SETBIT(bitmapProngsContributorsPV, 0);
287287
}
288288
if (indexCollision == track1.collisionId() && track1.isPVContributor()) {
289-
nProngsContributorsPV += 1;
289+
SETBIT(bitmapProngsContributorsPV, 1);
290290
}
291+
uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV);
291292

292293
// fill candidate table rows
293294
rowCandidateBase(indexCollision,
@@ -301,7 +302,7 @@ struct HfCandidateCreator2Prong {
301302
std::sqrt(impactParameter0.getSigmaY2()), std::sqrt(impactParameter1.getSigmaY2()),
302303
impactParameter0.getZ(), impactParameter1.getZ(),
303304
std::sqrt(impactParameter0.getSigmaZ2()), std::sqrt(impactParameter1.getSigmaZ2()),
304-
rowTrackIndexProng2.prong0Id(), rowTrackIndexProng2.prong1Id(), nProngsContributorsPV,
305+
rowTrackIndexProng2.prong0Id(), rowTrackIndexProng2.prong1Id(), nProngsContributorsPV, bitmapProngsContributorsPV,
305306
rowTrackIndexProng2.hfflag());
306307

307308
// fill candidate prong PID rows
@@ -432,13 +433,14 @@ struct HfCandidateCreator2Prong {
432433
}
433434

434435
auto indexCollision = collision.globalIndex();
435-
uint8_t nProngsContributorsPV = 0;
436+
uint8_t bitmapProngsContributorsPV = 0;
436437
if (indexCollision == track0.collisionId() && track0.isPVContributor()) {
437-
nProngsContributorsPV += 1;
438+
SETBIT(bitmapProngsContributorsPV, 0);
438439
}
439440
if (indexCollision == track1.collisionId() && track1.isPVContributor()) {
440-
nProngsContributorsPV += 1;
441+
SETBIT(bitmapProngsContributorsPV, 1);
441442
}
443+
uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV);
442444

443445
// fill candidate table rows
444446
rowCandidateBase(indexCollision,
@@ -452,7 +454,7 @@ struct HfCandidateCreator2Prong {
452454
errImpactParameter0XY, errImpactParameter1XY,
453455
0.f, 0.f,
454456
0.f, 0.f,
455-
rowTrackIndexProng2.prong0Id(), rowTrackIndexProng2.prong1Id(), nProngsContributorsPV,
457+
rowTrackIndexProng2.prong0Id(), rowTrackIndexProng2.prong1Id(), nProngsContributorsPV, bitmapProngsContributorsPV,
456458
rowTrackIndexProng2.hfflag());
457459

458460
// fill candidate prong PID rows

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,17 @@ struct HfCandidateCreator3Prong {
275275
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.));
276276

277277
auto indexCollision = collision.globalIndex();
278-
uint8_t nProngsContributorsPV = 0;
278+
uint8_t bitmapProngsContributorsPV = 0;
279279
if (indexCollision == track0.collisionId() && track0.isPVContributor()) {
280-
nProngsContributorsPV += 1;
280+
SETBIT(bitmapProngsContributorsPV, 0);
281281
}
282282
if (indexCollision == track1.collisionId() && track1.isPVContributor()) {
283-
nProngsContributorsPV += 1;
283+
SETBIT(bitmapProngsContributorsPV, 1);
284284
}
285285
if (indexCollision == track2.collisionId() && track2.isPVContributor()) {
286-
nProngsContributorsPV += 1;
286+
SETBIT(bitmapProngsContributorsPV, 2);
287287
}
288+
uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV);
288289

289290
// fill candidate table rows
290291
rowCandidateBase(indexCollision,
@@ -299,7 +300,7 @@ struct HfCandidateCreator3Prong {
299300
std::sqrt(impactParameter0.getSigmaY2()), std::sqrt(impactParameter1.getSigmaY2()), std::sqrt(impactParameter2.getSigmaY2()),
300301
impactParameter0.getZ(), impactParameter1.getZ(), impactParameter2.getZ(),
301302
std::sqrt(impactParameter0.getSigmaZ2()), std::sqrt(impactParameter1.getSigmaZ2()), std::sqrt(impactParameter2.getSigmaZ2()),
302-
rowTrackIndexProng3.prong0Id(), rowTrackIndexProng3.prong1Id(), rowTrackIndexProng3.prong2Id(), nProngsContributorsPV,
303+
rowTrackIndexProng3.prong0Id(), rowTrackIndexProng3.prong1Id(), rowTrackIndexProng3.prong2Id(), nProngsContributorsPV, bitmapProngsContributorsPV,
303304
rowTrackIndexProng3.hfflag());
304305

305306
// fill histograms

PWGHF/TableProducer/treeCreatorLcToPKPi.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ DECLARE_SOA_TABLE(HfCandLcLites, "AOD", "HFCANDLCLITE",
101101
collision::PosY,
102102
collision::PosZ,
103103
hf_cand::NProngsContributorsPV,
104+
hf_cand::BitmapProngsContributorsPV,
104105
// hf_cand::ErrorDecayLength,
105106
// hf_cand::ErrorDecayLengthXY,
106107
hf_cand::Chi2PCA,
@@ -159,6 +160,7 @@ DECLARE_SOA_TABLE(HfCandLcFulls, "AOD", "HFCANDLCFULL",
159160
collision::PosY,
160161
collision::PosZ,
161162
hf_cand::NProngsContributorsPV,
163+
hf_cand::BitmapProngsContributorsPV,
162164
hf_cand::XSecondaryVertex,
163165
hf_cand::YSecondaryVertex,
164166
hf_cand::ZSecondaryVertex,
@@ -357,6 +359,7 @@ struct HfTreeCreatorLcToPKPi {
357359
candidate.posY(),
358360
candidate.posZ(),
359361
candidate.nProngsContributorsPV(),
362+
candidate.bitmapProngsContributorsPV(),
360363
// candidate.errorDecayLength(),
361364
// candidate.errorDecayLengthXY(),
362365
candidate.chi2PCA(),
@@ -419,6 +422,7 @@ struct HfTreeCreatorLcToPKPi {
419422
candidate.posY(),
420423
candidate.posZ(),
421424
candidate.nProngsContributorsPV(),
425+
candidate.bitmapProngsContributorsPV(),
422426
candidate.xSecondaryVertex(),
423427
candidate.ySecondaryVertex(),
424428
candidate.zSecondaryVertex(),
@@ -614,6 +618,7 @@ struct HfTreeCreatorLcToPKPi {
614618
candidate.posY(),
615619
candidate.posZ(),
616620
candidate.nProngsContributorsPV(),
621+
candidate.bitmapProngsContributorsPV(),
617622
// candidate.errorDecayLength(),
618623
// candidate.errorDecayLengthXY(),
619624
candidate.chi2PCA(),
@@ -676,6 +681,7 @@ struct HfTreeCreatorLcToPKPi {
676681
candidate.posY(),
677682
candidate.posZ(),
678683
candidate.nProngsContributorsPV(),
684+
candidate.bitmapProngsContributorsPV(),
679685
candidate.xSecondaryVertex(),
680686
candidate.ySecondaryVertex(),
681687
candidate.zSecondaryVertex(),

PWGHF/Utils/utilsTrkCandHf.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ void setLabelHistoCands(Histo& hCandidates)
4141
hCandidates->GetXaxis()->SetBinLabel(SVFitting::Fail + 1, "Run-time error in secondary vertexing");
4242
}
4343

44+
/// @brief Function to evaluate number of ones in a binary representation of the argument
45+
/// \param num is the input argument
46+
int countOnesInBinary(uint8_t num)
47+
{
48+
int count = 0;
49+
50+
for (int iBit = 0; iBit < 8; iBit++) {
51+
count += TESTBIT(num, iBit);
52+
}
53+
54+
return count;
55+
}
56+
4457
} // namespace o2::hf_trkcandsel
4558

4659
#endif // PWGHF_UTILS_UTILSTRKCANDHF_H_

0 commit comments

Comments
 (0)