Skip to content

Commit 1000d18

Browse files
authored
PWGLF: Minor additions and fixes to KFParticle reconstruction in decay3bodybuilder task and threebodyKFTask (#8079)
1 parent 3c0448d commit 1000d18

3 files changed

Lines changed: 67 additions & 23 deletions

File tree

PWGLF/DataModel/Vtx3BodyTables.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ DECLARE_SOA_COLUMN(DecayLXYKF, decaylxykf, float); //! 3 body vtx de
357357
DECLARE_SOA_COLUMN(DecayLDeltaL, decayldeltal, float); //! 3 body vtx l/dl from KFParticle (using kfpPV after topological constraint)
358358
DECLARE_SOA_COLUMN(Chi2geoNDF, chi2geondf, float); //! 3 body vtx chi2geo from geometrical KFParticle fit
359359
DECLARE_SOA_COLUMN(Chi2topoNDF, chi2topondf, float); //! 3 body vtx chi2topo from KFParticle topological constraint to the PV (using kfpPV)
360-
DECLARE_SOA_COLUMN(CTauKF, ctaukf, float); //! 3 body vtx ctau from KFParticle
361360
DECLARE_SOA_COLUMN(CTauKFtopo, ctaukftopo, float); //! 3 body vtx ctau from KFParticle after topological constraint
362361

363362
// daughters
@@ -383,6 +382,10 @@ DECLARE_SOA_COLUMN(DCAVtxDaughtersKF, dcavtxdaughterskf, float); //! sum
383382
DECLARE_SOA_COLUMN(Track0Sign, track0sign, float); //! sign of proton daughter track
384383
DECLARE_SOA_COLUMN(Track1Sign, track1sign, float); //! sign of pion daughter track
385384
DECLARE_SOA_COLUMN(Track2Sign, track2sign, float); //! sign of deuteron daughter track
385+
// PID
386+
DECLARE_SOA_COLUMN(TPCNSigmaProton, tpcnsigmaproton, float); //! nsigma of TPC PID of the proton daughter
387+
DECLARE_SOA_COLUMN(TPCNSigmaPion, tpcnsigmapion, float); //! nsigma of TPC PID of the pion daughter
388+
DECLARE_SOA_COLUMN(TPCNSigmaDeuteron, tpcnsigmadeuteron, float); //! nsigma of TPC PID of the bachelor daughter
386389

387390
// Monte Carlo
388391
DECLARE_SOA_COLUMN(GenP, genp, float); //! generated momentum
@@ -421,7 +424,7 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA",
421424
kfvtx3body::VtxCosPAKFtopo, kfvtx3body::VtxCosXYPAKFtopo,
422425
kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL,
423426
kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF,
424-
kfvtx3body::CTauKF, kfvtx3body::CTauKFtopo,
427+
kfvtx3body::CTauKFtopo,
425428

426429
// V0
427430
kfvtx3body::MassV0, kfvtx3body::Chi2MassV0,
@@ -437,6 +440,7 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA",
437440
kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV,
438441
kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV,
439442
kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron
443+
kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron,
440444

441445
// dynamic columns
442446
vtx3body::VtxRadius<vtx3body::X, vtx3body::Y>,
@@ -484,7 +488,7 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatasLite, "AOD", "KF3BODYLITE",
484488
kfvtx3body::VtxCosPAKFtopo, kfvtx3body::VtxCosXYPAKFtopo,
485489
kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL,
486490
kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF,
487-
kfvtx3body::CTauKF, kfvtx3body::CTauKFtopo,
491+
kfvtx3body::CTauKFtopo,
488492

489493
// V0
490494
kfvtx3body::MassV0, kfvtx3body::Chi2MassV0,
@@ -500,6 +504,7 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatasLite, "AOD", "KF3BODYLITE",
500504
kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV,
501505
kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV,
502506
kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron
507+
kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron,
503508

504509
// dynamic columns
505510
vtx3body::VtxRadius<vtx3body::X, vtx3body::Y>,
@@ -538,7 +543,7 @@ DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS",
538543
kfvtx3body::VtxCosPAKFtopo, kfvtx3body::VtxCosXYPAKFtopo,
539544
kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL,
540545
kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF,
541-
kfvtx3body::CTauKF, kfvtx3body::CTauKFtopo,
546+
kfvtx3body::CTauKFtopo,
542547

543548
// V0
544549
kfvtx3body::MassV0, kfvtx3body::Chi2MassV0,
@@ -554,6 +559,7 @@ DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS",
554559
kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV,
555560
kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV,
556561
kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron
562+
kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron,
557563

558564
// MC information
559565
kfvtx3body::GenP,

PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ struct decay3bodyBuilder {
114114
kKfVtxCosPA,
115115
kKfVtxCosPAXY,
116116
kKfVtxChi2geo,
117+
kKfVtxTopoConstr,
117118
kKfVtxChi2topo,
118119
kKfNVtxSteps };
119120

@@ -122,7 +123,7 @@ struct decay3bodyBuilder {
122123
{{"hEventCounter", "hEventCounter", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}},
123124
{"hEventCounterKFParticle", "hEventCounterKFParticle", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}},
124125
{"hVtx3BodyCounter", "hVtx3BodyCounter", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}},
125-
{"hVtx3BodyCounterKFParticle", "hVtx3BodyCounterKFParticle", {HistType::kTH1F, {{21, 0.0f, 21.0f}}}},
126+
{"hVtx3BodyCounterKFParticle", "hVtx3BodyCounterKFParticle", {HistType::kTH1F, {{22, 0.0f, 22.0f}}}},
126127
{"hBachelorTOFNSigmaDe", "", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}},
127128
{"QA/Tracks/hTrackPosTPCNcls", "hTrackPosTPCNcls", {HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}}},
128129
{"QA/Tracks/hTrackNegTPCNcls", "hTrackNegTPCNcls", {HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}}},
@@ -332,7 +333,8 @@ struct decay3bodyBuilder {
332333
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(18, "CosPA");
333334
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(19, "CosPAxy");
334335
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(20, "Chi2geo");
335-
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(21, "Chi2topo");
336+
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(21, "TopoConstr");
337+
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(22, "Chi2topo");
336338
registry.get<TH1>(HIST("hVtx3BodyCounterKFParticle"))->LabelsOption("v");
337339

338340
// Material correction in the DCA fitter
@@ -710,7 +712,7 @@ struct decay3bodyBuilder {
710712
registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCharge);
711713

712714
// track eta
713-
if (trackPos.eta() > kfparticleConfigurations.maxEta || trackNeg.eta() > kfparticleConfigurations.maxEta || trackBach.eta() > kfparticleConfigurations.maxEta) {
715+
if (abs(trackPos.eta()) > kfparticleConfigurations.maxEta || abs(trackNeg.eta()) > kfparticleConfigurations.maxEta || abs(trackBach.eta()) > kfparticleConfigurations.maxEta) {
714716
continue;
715717
}
716718
registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxEta);
@@ -738,10 +740,21 @@ struct decay3bodyBuilder {
738740
registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCRows);
739741

740742
// TPC PID
741-
if (isMatter && !selectTPCPID(trackPos, trackNeg, trackBach)) { // hypertriton (proton, pi-, deuteron)
742-
continue;
743-
} else if (!isMatter && !selectTPCPID(trackNeg, trackPos, trackBach)) { // anti-hypertriton (anti-proton, pi+, deuteron)
744-
continue;
743+
float tpcNsigmaProton;
744+
float tpcNsigmaPion;
745+
float tpcNsigmaDeuteron = trackBach.tpcNSigmaDe();
746+
if (isMatter) { // hypertriton (proton, pi-, deuteron)
747+
tpcNsigmaProton = trackPos.tpcNSigmaPr();
748+
tpcNsigmaPion = trackNeg.tpcNSigmaPi();
749+
if (!selectTPCPID(trackPos, trackNeg, trackBach)) {
750+
continue;
751+
}
752+
} else if (!isMatter) { // anti-hypertriton (anti-proton, pi+, deuteron)
753+
tpcNsigmaProton = trackNeg.tpcNSigmaPr();
754+
tpcNsigmaPion = trackPos.tpcNSigmaPi();
755+
if (!selectTPCPID(trackNeg, trackPos, trackBach)) {
756+
continue;
757+
}
745758
}
746759
registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCPID);
747760
LOG(debug) << "Basic track selections done.";
@@ -932,9 +945,16 @@ struct decay3bodyBuilder {
932945
// -------- STEP 6: topological constraint --------
933946
/// Set vertex constraint and topological selection
934947
KFParticle KFHtPV = KFHt;
935-
KFHtPV.SetProductionVertex(kfpv);
936-
KFHtPV.TransportToDecayVertex();
948+
try {
949+
KFHtPV.SetProductionVertex(kfpv);
950+
} catch (std::runtime_error& e) {
951+
LOG(error) << "Exception caught KFParticle process call: Topological constraint failed";
952+
continue;
953+
}
954+
registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTopoConstr); // to check if topo constraint fails
955+
// get topological chi2
937956
float chi2topoNDF = KFHtPV.GetChi2() / KFHtPV.GetNDF();
957+
KFHtPV.TransportToDecayVertex();
938958
if (kfparticleConfigurations.applyTopoSel && chi2topoNDF >= kfparticleConfigurations.maxChi2topo) {
939959
continue;
940960
}
@@ -959,7 +979,7 @@ struct decay3bodyBuilder {
959979
KFHtPV.GetDecayLength(), KFHtPV.GetDecayLengthXY(), // decay length defined after topological constraint
960980
KFHtPV.GetDecayLength() / KFHtPV.GetErrDecayLength(), // ldl
961981
chi2geoNDF, chi2topoNDF,
962-
KFHt.GetLifeTime(), KFHtPV.GetLifeTime(),
982+
KFHtPV.GetLifeTime(),
963983
// V0
964984
massV0, chi2massV0,
965985
// daughter momenta
@@ -987,7 +1007,11 @@ struct decay3bodyBuilder {
9871007
// daughter signs
9881008
kfpProton.GetQ(),
9891009
kfpPion.GetQ(),
990-
trackBach.sign());
1010+
trackBach.sign(),
1011+
// daughter PID
1012+
tpcNsigmaProton,
1013+
tpcNsigmaPion,
1014+
tpcNsigmaDeuteron);
9911015

9921016
if (kfparticleConfigurations.fillCandidateLiteTable) {
9931017
kfvtx3bodydatalite(
@@ -1005,7 +1029,7 @@ struct decay3bodyBuilder {
10051029
KFHtPV.GetDecayLength(), KFHtPV.GetDecayLengthXY(), // decay length defined after topological constraint
10061030
KFHtPV.GetDecayLength() / KFHtPV.GetErrDecayLength(), // ldl
10071031
chi2geoNDF, chi2topoNDF,
1008-
KFHt.GetLifeTime(), KFHtPV.GetLifeTime(),
1032+
KFHtPV.GetLifeTime(),
10091033
// V0
10101034
massV0, chi2massV0,
10111035
// daughter momenta
@@ -1033,7 +1057,11 @@ struct decay3bodyBuilder {
10331057
// daughter signs
10341058
kfpProton.GetQ(),
10351059
kfpPion.GetQ(),
1036-
trackBach.sign());
1060+
trackBach.sign(),
1061+
// daughter PID
1062+
tpcNsigmaProton,
1063+
tpcNsigmaPion,
1064+
tpcNsigmaDeuteron);
10371065
}
10381066
LOG(debug) << "Table filled.";
10391067

PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ struct threebodyKFTask {
9292
// for gen information of non reco candidates
9393
registry.add<TH1>("hTrueHypertritonMCMassPrPi_nonReco", "inv. mass gen. of non-reco. V0 pair (H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(p,#pi^{-}) (GeV/#it{c}^{2})"}});
9494
registry.add<TH1>("hTrueAntiHypertritonMCMassPrPi_nonReco", "inv. mass gen. of non-reco. V0 pair (Anti-H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(#bar{p},#pi^{+}) (GeV/#it{c}^{2})"}});
95+
registry.add<TH1>("hTrueHypertritonMCPtProton_nonReco", "Proton #it{p}_{T} gen. of non-reco. H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(p) (GeV/#it{c})"}});
96+
registry.add<TH1>("hTrueHypertritonMCPtPion_nonReco", "Pion #it{p}_{T} gen. of non-reco. H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(#pi) (GeV/#it{c})"}});
97+
registry.add<TH1>("hTrueAntiHypertritonMCPtProton_nonReco", "Proton #it{p}_{T} gen. of non-reco. Anti-H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(p) (GeV/#it{c})"}});
98+
registry.add<TH1>("hTrueAntiHypertritonMCPtPion_nonReco", "Pion #it{p}_{T} gen. of non-reco. Anti- H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(#pi) (GeV/#it{c})"}});
9599
}
96100

97101
template <typename TCand>
@@ -240,7 +244,7 @@ struct threebodyKFTask {
240244
vtx3bodydata.vtxcospakftopo(), vtx3bodydata.vtxcosxypakftopo(),
241245
vtx3bodydata.decaylkf(), vtx3bodydata.decaylxykf(), vtx3bodydata.decayldeltal(),
242246
vtx3bodydata.chi2geondf(), vtx3bodydata.chi2topondf(),
243-
vtx3bodydata.ctaukf(), vtx3bodydata.ctaukftopo(),
247+
vtx3bodydata.ctaukftopo(),
244248
vtx3bodydata.massv0(), vtx3bodydata.chi2massv0(),
245249
vtx3bodydata.pxtrack0(), vtx3bodydata.pytrack0(), vtx3bodydata.pztrack0(), // proton
246250
vtx3bodydata.pxtrack1(), vtx3bodydata.pytrack1(), vtx3bodydata.pztrack1(), // pion
@@ -253,6 +257,7 @@ struct threebodyKFTask {
253257
vtx3bodydata.dcaxytrackpostopv(), vtx3bodydata.dcaxytracknegtopv(), vtx3bodydata.dcaxytrackbachtopv(),
254258
vtx3bodydata.dcatrackpostopv(), vtx3bodydata.dcatracknegtopv(), vtx3bodydata.dcatrackbachtopv(),
255259
vtx3bodydata.track0sign(), vtx3bodydata.track1sign(), vtx3bodydata.track2sign(), // proton, pion, deuteron
260+
vtx3bodydata.tpcnsigmaproton(), vtx3bodydata.tpcnsigmapion(), vtx3bodydata.tpcnsigmadeuteron(),
256261
// MC info (-1 if not matched to MC particle)
257262
genP,
258263
genPt,
@@ -321,9 +326,11 @@ struct threebodyKFTask {
321326
piMinusMom[1] = mcparticleDaughter.py();
322327
piMinusMom[2] = mcparticleDaughter.pz();
323328
}
324-
genMCmassPrPi = RecoDecay::m(array{array{protonMom[0], protonMom[1], protonMom[2]}, array{piMinusMom[0], piMinusMom[1], piMinusMom[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
325-
registry.fill(HIST("hTrueHypertritonMCMassPrPi_nonReco"), genMCmassPrPi);
326329
}
330+
genMCmassPrPi = RecoDecay::m(array{array{protonMom[0], protonMom[1], protonMom[2]}, array{piMinusMom[0], piMinusMom[1], piMinusMom[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
331+
registry.fill(HIST("hTrueHypertritonMCMassPrPi_nonReco"), genMCmassPrPi);
332+
registry.fill(HIST("hTrueHypertritonMCPtProton_nonReco"), RecoDecay::sqrtSumOfSquares(protonMom[0], protonMom[1]));
333+
registry.fill(HIST("hTrueHypertritonMCPtPion_nonReco"), RecoDecay::sqrtSumOfSquares(piMinusMom[0], piMinusMom[1]));
327334
} else if (haveAntiProton && havePion && haveAntiBachelor && mcparticle.pdgCode() < 0) {
328335
isTrueGenAntiH3L = true;
329336
// get anti-proton and pion daughter
@@ -339,9 +346,11 @@ struct threebodyKFTask {
339346
piPlusMom[1] = mcparticleDaughter.py();
340347
piPlusMom[2] = mcparticleDaughter.pz();
341348
}
342-
genMCmassPrPi = RecoDecay::m(array{array{antiProtonMom[0], antiProtonMom[1], antiProtonMom[2]}, array{piPlusMom[0], piPlusMom[1], piPlusMom[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
343-
registry.fill(HIST("hTrueAntiHypertritonMCMassPrPi_nonReco"), genMCmassPrPi);
344349
}
350+
genMCmassPrPi = RecoDecay::m(array{array{antiProtonMom[0], antiProtonMom[1], antiProtonMom[2]}, array{piPlusMom[0], piPlusMom[1], piPlusMom[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
351+
registry.fill(HIST("hTrueAntiHypertritonMCMassPrPi_nonReco"), genMCmassPrPi);
352+
registry.fill(HIST("hTrueAntiHypertritonMCPtProton_nonReco"), RecoDecay::sqrtSumOfSquares(antiProtonMom[0], antiProtonMom[1]));
353+
registry.fill(HIST("hTrueAntiHypertritonMCPtPion_nonReco"), RecoDecay::sqrtSumOfSquares(piPlusMom[0], piPlusMom[1]));
345354
} else {
346355
continue; // stop if particle is no true H3L or Anti-H3L
347356
}
@@ -366,7 +375,7 @@ struct threebodyKFTask {
366375
-1, -1,
367376
-1, -1, -1,
368377
-1, -1,
369-
-1, -1,
378+
-1,
370379
-1, -1,
371380
-1, -1, -1,
372381
-1, -1, -1,
@@ -379,6 +388,7 @@ struct threebodyKFTask {
379388
-1, -1, -1,
380389
-1, -1, -1,
381390
-1, -1, -1,
391+
-1, -1, -1,
382392
// gen information
383393
mcparticle.p(),
384394
mcparticle.pt(),

0 commit comments

Comments
 (0)