Skip to content

Commit 66e9f8a

Browse files
Add QA, datalink and Mc labels for 3body decay (#3235)
* Add QA, Decay3Body datalink and Mc labels * Please consider the following formatting changes * Add MC Dalitz plot * Change getMassPDG to physics constant * Change getMassPDG to physics constant --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 6f51926 commit 66e9f8a

5 files changed

Lines changed: 203 additions & 61 deletions

File tree

PWGLF/DataModel/Vtx3BodyTables.h

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Track0, track0, int, Tracks, "_0"); //!
2525
DECLARE_SOA_INDEX_COLUMN_FULL(Track1, track1, int, Tracks, "_1"); //!
2626
DECLARE_SOA_INDEX_COLUMN_FULL(Track2, track2, int, Tracks, "_2"); //!
2727
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
28+
DECLARE_SOA_INDEX_COLUMN(Decay3Body, decay3body); //!
2829

2930
// General 3 body Vtx properties: position, momentum
3031
DECLARE_SOA_COLUMN(PxTrack0, pxtrack0, float); //! track0 px at min
@@ -109,7 +110,7 @@ DECLARE_SOA_EXPRESSION_COLUMN(Pz, pz, //! 3 body vtx pz
109110
} // namespace vtx3body
110111

111112
DECLARE_SOA_TABLE_FULL(StoredVtx3BodyDatas, "Vtx3BodyDatas", "AOD", "Vtx3BodyDATA", //!
112-
o2::soa::Index<>, vtx3body::Track0Id, vtx3body::Track1Id, vtx3body::Track2Id, vtx3body::CollisionId,
113+
o2::soa::Index<>, vtx3body::Track0Id, vtx3body::Track1Id, vtx3body::Track2Id, vtx3body::CollisionId, vtx3body::Decay3BodyId,
113114
vtx3body::X, vtx3body::Y, vtx3body::Z,
114115
vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0,
115116
vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1,
@@ -152,11 +153,31 @@ namespace vtx3body
152153
DECLARE_SOA_INDEX_COLUMN(Vtx3BodyData, vtx3BodyData); //! Index to Vtx3BodyData entry
153154
}
154155

155-
DECLARE_SOA_TABLE(Vtx3BodyDataLink, "AOD", "VtxDATALINK", //! Joinable table with Decay3bodys which links to Vtx3BodyData which is not produced for all entries
156+
DECLARE_SOA_TABLE(Decay3BodyDataLink, "AOD", "DECAY3BODYLINK", //! Joinable table with Decay3bodys which links to Vtx3BodyData which is not produced for all entries
156157
vtx3body::Vtx3BodyDataId);
157158

158-
using Vtxs3BodyLinked = soa::Join<Decay3Bodys, Vtx3BodyDataLink>;
159-
using Vtx3BodyLinked = Vtxs3BodyLinked::iterator;
159+
using Decay3BodysLinked = soa::Join<Decay3Bodys, Decay3BodyDataLink>;
160+
using Decay3BodyLinked = Decay3BodysLinked::iterator;
161+
162+
// Definition of labels for Vtx3BodyDatas
163+
namespace mcvtx3bodylabel
164+
{
165+
DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Vtx3BodyDatas
166+
} // namespace mcvtx3bodylabel
167+
168+
DECLARE_SOA_TABLE(McVtx3BodyLabels, "AOD", "MCVTXLABEL", //! Table joinable with Vtx3BodyData containing the MC labels
169+
mcvtx3bodylabel::McParticleId);
170+
using McVtx3BodyLabel = McVtx3BodyLabels::iterator;
171+
172+
// Definition of labels for Decay3Bodys // Full table, joinable with Decay3Bodys (CAUTION: NOT WITH Vtx3BodyDATA)
173+
namespace mcfullvtx3bodylabel
174+
{
175+
DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Decay3Bodys
176+
} // namespace mcfullvtx3bodylabel
177+
178+
DECLARE_SOA_TABLE(McFullVtx3BodyLabels, "AOD", "MCFULLVTXLABEL", //! Table joinable with Decay3Bodys
179+
mcfullvtx3bodylabel::McParticleId);
180+
using McFullVtx3BodyLabel = McFullVtx3BodyLabels::iterator;
160181

161182
} // namespace o2::aod
162183
#endif // PWGLF_DATAMODEL_VTX3BODYTABLES_H_

PWGLF/TableProducer/hypertriton3bodybuilder.cxx

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ using MyTracksIU = FullTracksExtIU;
4949
// in case requested
5050
using LabeledTracks = soa::Join<FullTracksExtIU, aod::McTrackLabels>;
5151

52-
struct hypertriton3bodybuilder {
52+
struct hypertriton3bodyBuilder {
5353

5454
Produces<aod::StoredVtx3BodyDatas> vtx3bodydata;
5555
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -188,7 +188,7 @@ struct hypertriton3bodybuilder {
188188
initCCDB(bc);
189189
registry.fill(HIST("hEventCounter"), 0.5);
190190

191-
for (auto& vtx3body : decay3bodys) { // FIXME: turn into combination(...)
191+
for (auto& vtx3body : decay3bodys) {
192192

193193
registry.fill(HIST("hVtx3BodyCounter"), 0.5);
194194

@@ -264,7 +264,7 @@ struct hypertriton3bodybuilder {
264264
registry.fill(HIST("hVtx3BodyCounter"), 6.5);
265265

266266
vtx3bodydata(
267-
t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), collision.globalIndex(),
267+
t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), collision.globalIndex(), vtx3body.globalIndex(),
268268
pos[0], pos[1], pos[2],
269269
p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2],
270270
fitter3body.getChi2AtPCACandidate(),
@@ -273,9 +273,30 @@ struct hypertriton3bodybuilder {
273273
}
274274
};
275275

276+
struct hypertriton3bodyDataLinkBuilder {
277+
Produces<aod::Decay3BodyDataLink> vtxdataLink;
278+
279+
void init(InitContext const&) {}
280+
281+
void process(aod::Decay3Bodys const& decay3bodytable, aod::Vtx3BodyDatas const& vtxdatatable)
282+
{
283+
std::vector<int> lIndices;
284+
lIndices.reserve(decay3bodytable.size());
285+
for (int ii = 0; ii < decay3bodytable.size(); ii++)
286+
lIndices[ii] = -1;
287+
for (auto& vtxdata : vtxdatatable) {
288+
lIndices[vtxdata.decay3bodyId()] = vtxdata.globalIndex();
289+
}
290+
for (int ii = 0; ii < decay3bodytable.size(); ii++) {
291+
vtxdataLink(lIndices[ii]);
292+
}
293+
}
294+
};
295+
276296
struct hypertriton3bodyLabelBuilder {
277297

278-
Produces<aod::McV0Labels> vtxlabels;
298+
Produces<aod::McVtx3BodyLabels> vtxlabels;
299+
Produces<aod::McFullVtx3BodyLabels> vtxfulllabels;
279300

280301
// for bookkeeping purposes: how many V0s come from same mother etc
281302
HistogramRegistry registry{
@@ -314,32 +335,38 @@ struct hypertriton3bodyLabelBuilder {
314335
}
315336
PROCESS_SWITCH(hypertriton3bodyLabelBuilder, processDoNotBuildLabels, "Do not produce MC label tables", true);
316337

317-
void processBuildLabels(aod::Collisions::iterator const& collision, aod::Decay3Bodys const& decay3bodys, LabeledTracks const&, aod::McParticles const& particlesMC)
338+
void processBuildLabels(aod::Decay3BodysLinked const& decay3bodys, aod::Vtx3BodyDatas const& vtx3bodydatas, LabeledTracks const&, aod::McParticles const& particlesMC)
318339
{
319-
for (auto& vtx : decay3bodys) {
340+
std::vector<int> lIndices;
341+
lIndices.reserve(vtx3bodydatas.size());
342+
for (int ii = 0; ii < vtx3bodydatas.size(); ii++) {
343+
lIndices[ii] = -1;
344+
}
345+
346+
for (auto& decay3body : decay3bodys) {
320347

321348
int lLabel = -1;
322349
int lPDG = -1;
323350
float lPt = -1;
324351
double MClifetime = -1;
325352
bool is3bodyDecay = false; // all considered V0s
326353

327-
auto lTrack0 = vtx.track0_as<LabeledTracks>();
328-
auto lTrack1 = vtx.track1_as<LabeledTracks>();
329-
auto lTrack2 = vtx.track2_as<LabeledTracks>();
354+
auto lTrack0 = decay3body.track0_as<LabeledTracks>();
355+
auto lTrack1 = decay3body.track1_as<LabeledTracks>();
356+
auto lTrack2 = decay3body.track2_as<LabeledTracks>();
330357
registry.fill(HIST("hLabelCounter"), 0.5);
331358

332359
// Association check
333360
// There might be smarter ways of doing this in the future
334361
if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) {
335-
vtxlabels(-1);
362+
vtxfulllabels(-1);
336363
continue;
337364
}
338365
auto lMCTrack0 = lTrack0.mcParticle_as<aod::McParticles>();
339366
auto lMCTrack1 = lTrack1.mcParticle_as<aod::McParticles>();
340367
auto lMCTrack2 = lTrack2.mcParticle_as<aod::McParticles>();
341368
if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) {
342-
vtxlabels(-1);
369+
vtxfulllabels(-1);
343370
continue;
344371
}
345372

@@ -350,22 +377,22 @@ struct hypertriton3bodyLabelBuilder {
350377
lLabel = lMother1.globalIndex();
351378
lPt = lMother1.pt();
352379
lPDG = lMother1.pdgCode();
353-
MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * 2.991 / lMother2.p();
380+
MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p();
354381
is3bodyDecay = true; // vtxs with the same mother
355382
}
356383
}
357384
}
358385
} // end association check
359386
if (!is3bodyDecay) {
360-
vtxlabels(-1);
387+
vtxfulllabels(-1);
361388
continue;
362389
}
363390
registry.fill(HIST("hLabelCounter"), 1.5);
364391

365392
// Intended for cross-checks only
366393
// N.B. no rapidity cut!
367394
if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) {
368-
double hypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{RecoDecay::getMassPDG(kProton), RecoDecay::getMassPDG(kPiPlus), 1.87561});
395+
double hypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron});
369396
registry.fill(HIST("hHypertritonCounter"), 0.5);
370397
registry.fill(HIST("hHypertriton"), lPt);
371398
registry.fill(HIST("hHypertritonMass"), hypertritonMCMass);
@@ -384,7 +411,7 @@ struct hypertriton3bodyLabelBuilder {
384411
}
385412
}
386413
if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) {
387-
double antiHypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kProton), 1.87561});
414+
double antiHypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron});
388415
registry.fill(HIST("hHypertritonCounter"), 2.5);
389416
registry.fill(HIST("hAntiHypertriton"), lPt);
390417
registry.fill(HIST("hAntiHypertritonMass"), antiHypertritonMCMass);
@@ -403,24 +430,30 @@ struct hypertriton3bodyLabelBuilder {
403430
}
404431
}
405432

406-
// Construct label table (note: this will be joinable with V0Datas)
407-
vtxlabels(
408-
lLabel);
433+
// Construct label table
434+
vtxfulllabels(lLabel);
435+
if (decay3body.vtx3BodyDataId() != -1) {
436+
lIndices[decay3body.vtx3BodyDataId()] = lLabel;
437+
}
438+
}
439+
for (int ii = 0; ii < vtx3bodydatas.size(); ii++) {
440+
vtxlabels(lIndices[ii]);
409441
}
410442
}
411443
PROCESS_SWITCH(hypertriton3bodyLabelBuilder, processBuildLabels, "Produce MC label tables", false);
412444
};
413445

414-
struct hypertriton3bodyinitializer {
446+
struct hypertriton3bodyInitializer {
415447
Spawns<aod::Vtx3BodyDatas> vtx3bodydatas;
416448
void init(InitContext const&) {}
417449
};
418450

419451
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
420452
{
421453
return WorkflowSpec{
422-
adaptAnalysisTask<hypertriton3bodyinitializer>(cfgc),
454+
adaptAnalysisTask<hypertriton3bodyBuilder>(cfgc),
455+
adaptAnalysisTask<hypertriton3bodyDataLinkBuilder>(cfgc),
423456
adaptAnalysisTask<hypertriton3bodyLabelBuilder>(cfgc),
424-
adaptAnalysisTask<hypertriton3bodybuilder>(cfgc),
457+
adaptAnalysisTask<hypertriton3bodyInitializer>(cfgc),
425458
};
426459
}

PWGLF/TableProducer/hypertriton3bodyfinder.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,10 @@ struct hypertriton3bodyFinder {
496496
float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0);
497497
// apply mass selections
498498
// float p2Pos = pP[0] * pP[0] + pP[1] * pP[1] + pP[2] * pP[2], p2Neg = pN[0] * pN[0] + pN[1] * pN[1] + pN[2] * pN[2];
499-
float massV0LambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{RecoDecay::getMassPDG(kProton), RecoDecay::getMassPDG(kPiPlus)});
500-
float massV0AntiLambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kProton)});
499+
float massV0LambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
500+
float massV0AntiLambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton});
501501
float massMargin = 20 * (0.001 * (1. + 0.5 * ptV0)) + 0.07;
502-
if (massV0LambdaHyp - RecoDecay::getMassPDG(kLambda0) > massMargin && massV0AntiLambdaHyp - RecoDecay::getMassPDG(kLambda0) > massMargin) {
502+
if (massV0LambdaHyp - o2::constants::physics::MassLambda > massMargin && massV0AntiLambdaHyp - o2::constants::physics::MassLambda > massMargin) {
503503
continue;
504504
}
505505
registry.fill(HIST("hV0Counter"), 7.5);
@@ -642,7 +642,7 @@ struct hypertriton3bodyFinder {
642642

643643
// Fix: Reconstruction H3L DCA Check
644644
vtx3bodydata(
645-
t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), collision.globalIndex(),
645+
t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), collision.globalIndex(), 0,
646646
vertexXYZ[0], vertexXYZ[1], vertexXYZ[2],
647647
p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2],
648648
fitter3body.getChi2AtPCACandidate(),

0 commit comments

Comments
 (0)