Skip to content

Commit 2675309

Browse files
committed
Tree creator: Move index columns to separate table
1 parent 62b34be commit 2675309

1 file changed

Lines changed: 64 additions & 24 deletions

File tree

PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ DECLARE_SOA_COLUMN(InvMassXiPi1, invMassXiPi1, float);
9595
} // namespace full
9696

9797
DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE",
98-
full::XiId,
99-
full::Pi0Id,
100-
full::Pi1Id,
10198
full::CandidateSelFlag,
10299
full::XPv,
103100
full::YPv,
@@ -132,9 +129,6 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE",
132129
hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec);
133130

134131
DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF",
135-
full::XiId,
136-
full::Pi0Id,
137-
full::Pi1Id,
138132
full::CandidateSelFlag,
139133
full::XPv,
140134
full::YPv,
@@ -174,9 +168,6 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF",
174168
hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec);
175169

176170
DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL",
177-
full::XiId,
178-
full::Pi0Id,
179-
full::Pi1Id,
180171
full::CandidateSelFlag,
181172
full::XPv,
182173
full::YPv,
@@ -231,9 +222,6 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL",
231222
hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec);
232223

233224
DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF",
234-
full::XiId,
235-
full::Pi0Id,
236-
full::Pi1Id,
237225
full::CandidateSelFlag,
238226
full::XPv,
239227
full::YPv,
@@ -292,6 +280,11 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF",
292280
full::DcaPi1Xi,
293281
hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec);
294282

283+
DECLARE_SOA_TABLE(HfCandXicToXiPiPiDauInds, "AOD", "HFXICXI2PIDAUIN",
284+
full::XiId,
285+
full::Pi0Id,
286+
full::Pi1Id);
287+
295288
DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullEvs, "AOD", "HFXICXI2PIFULEV",
296289
collision::BCId,
297290
collision::NumContrib,
@@ -314,11 +307,13 @@ struct HfTreeCreatorXicToXiPiPi {
314307
Produces<o2::aod::HfCandXicToXiPiPiLiteKfs> rowCandidateLiteKf;
315308
Produces<o2::aod::HfCandXicToXiPiPiFulls> rowCandidateFull;
316309
Produces<o2::aod::HfCandXicToXiPiPiFullKfs> rowCandidateFullKf;
310+
Produces<o2::aod::HfCandXicToXiPiPiDauInds> rowCandidateDauIndices;
317311
Produces<o2::aod::HfCandXicToXiPiPiFullEvs> rowCandidateFullEvents;
318312
Produces<o2::aod::HfCandXicToXiPiPiFullPs> rowCandidateFullParticles;
319313

320314
Configurable<int> selectionFlagXic{"selectionXic", 1, "Selection Flag for Xic"};
321315
Configurable<bool> fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"};
316+
Configurable<bool> fillCandidateDauIndexTable{"fillCandidateDauIndexTable", false, "Switch to fill table with Xic daughters track indices"};
322317
// parameters for production of training samples
323318
Configurable<bool> fillOnlySignal{"fillOnlySignal", false, "Flag to fill derived tables with signal for ML trainings"};
324319
Configurable<bool> fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background for ML trainings"};
@@ -353,6 +348,15 @@ struct HfTreeCreatorXicToXiPiPi {
353348
collision.posZ());
354349
}
355350

351+
template <typename T>
352+
void fillIndexTable(const T& candidate)
353+
{
354+
rowCandidateDauIndices(
355+
candidate.cascadeId(),
356+
candidate.pi0Id(),
357+
candidate.pi1Id());
358+
}
359+
356360
template <bool doMc, bool doKf, typename T>
357361
void fillCandidateTable(const T& candidate)
358362
{
@@ -363,9 +367,6 @@ struct HfTreeCreatorXicToXiPiPi {
363367
if constexpr (!doKf) {
364368
if (fillCandidateLiteTable) {
365369
rowCandidateLite(
366-
candidate.cascadeId(),
367-
candidate.pi0Id(),
368-
candidate.pi1Id(),
369370
candidate.isSelXicToXiPiPi(),
370371
candidate.posX(),
371372
candidate.posY(),
@@ -400,9 +401,6 @@ struct HfTreeCreatorXicToXiPiPi {
400401
flagMc);
401402
} else {
402403
rowCandidateFull(
403-
candidate.cascadeId(),
404-
candidate.pi0Id(),
405-
candidate.pi1Id(),
406404
candidate.isSelXicToXiPiPi(),
407405
candidate.posX(),
408406
candidate.posY(),
@@ -459,9 +457,6 @@ struct HfTreeCreatorXicToXiPiPi {
459457
} else {
460458
if (fillCandidateLiteTable) {
461459
rowCandidateLiteKf(
462-
candidate.cascadeId(),
463-
candidate.pi0Id(),
464-
candidate.pi1Id(),
465460
candidate.isSelXicToXiPiPi(),
466461
candidate.posX(),
467462
candidate.posY(),
@@ -501,9 +496,6 @@ struct HfTreeCreatorXicToXiPiPi {
501496
flagMc);
502497
} else {
503498
rowCandidateFullKf(
504-
candidate.cascadeId(),
505-
candidate.pi0Id(),
506-
candidate.pi1Id(),
507499
candidate.isSelXicToXiPiPi(),
508500
candidate.posX(),
509501
candidate.posY(),
@@ -576,6 +568,9 @@ struct HfTreeCreatorXicToXiPiPi {
576568
}
577569

578570
// Filling candidate properties
571+
if (fillCandidateDauIndexTable) {
572+
rowCandidateDauIndices.reserve(candidates.size());
573+
}
579574
if (fillCandidateLiteTable) {
580575
rowCandidateLite.reserve(candidates.size());
581576
} else {
@@ -589,6 +584,9 @@ struct HfTreeCreatorXicToXiPiPi {
589584
}
590585
}
591586
fillCandidateTable<false, false>(candidate);
587+
if (fillCandidateDauIndexTable) {
588+
fillIndexTable(candidate);
589+
}
592590
}
593591
}
594592
PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processData, "Process data", true);
@@ -604,6 +602,9 @@ struct HfTreeCreatorXicToXiPiPi {
604602
}
605603

606604
// Filling candidate properties
605+
if (fillCandidateDauIndexTable) {
606+
rowCandidateDauIndices.reserve(candidates.size());
607+
}
607608
if (fillCandidateLiteTable) {
608609
rowCandidateLite.reserve(candidates.size());
609610
} else {
@@ -617,6 +618,9 @@ struct HfTreeCreatorXicToXiPiPi {
617618
}
618619
}
619620
fillCandidateTable<false, true>(candidate);
621+
if (fillCandidateDauIndexTable) {
622+
fillIndexTable(candidate);
623+
}
620624
}
621625
}
622626
PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processDataKf, "Process data with KF Particle reconstruction", false);
@@ -635,15 +639,24 @@ struct HfTreeCreatorXicToXiPiPi {
635639

636640
// Filling candidate properties
637641
if (fillOnlySignal) {
642+
if (fillCandidateDauIndexTable) {
643+
rowCandidateDauIndices.reserve(candidates.size());
644+
}
638645
if (fillCandidateLiteTable) {
639646
rowCandidateLite.reserve(recSig.size());
640647
} else {
641648
rowCandidateFull.reserve(recSig.size());
642649
}
643650
for (const auto& candidate : recSig) {
644651
fillCandidateTable<true, false>(candidate);
652+
if (fillCandidateDauIndexTable) {
653+
fillIndexTable(candidate);
654+
}
645655
}
646656
} else if (fillOnlyBackground) {
657+
if (fillCandidateDauIndexTable) {
658+
rowCandidateDauIndices.reserve(candidates.size());
659+
}
647660
if (fillCandidateLiteTable) {
648661
rowCandidateLite.reserve(recBg.size());
649662
} else {
@@ -655,15 +668,24 @@ struct HfTreeCreatorXicToXiPiPi {
655668
continue;
656669
}
657670
fillCandidateTable<true, false>(candidate);
671+
if (fillCandidateDauIndexTable) {
672+
fillIndexTable(candidate);
673+
}
658674
}
659675
} else {
676+
if (fillCandidateDauIndexTable) {
677+
rowCandidateDauIndices.reserve(candidates.size());
678+
}
660679
if (fillCandidateLiteTable) {
661680
rowCandidateLite.reserve(candidates.size());
662681
} else {
663682
rowCandidateFull.reserve(candidates.size());
664683
}
665684
for (const auto& candidate : candidates) {
666685
fillCandidateTable<true, false>(candidate);
686+
if (fillCandidateDauIndexTable) {
687+
fillIndexTable(candidate);
688+
}
667689
}
668690
}
669691

@@ -697,15 +719,24 @@ struct HfTreeCreatorXicToXiPiPi {
697719

698720
// Filling candidate properties
699721
if (fillOnlySignal) {
722+
if (fillCandidateDauIndexTable) {
723+
rowCandidateDauIndices.reserve(candidates.size());
724+
}
700725
if (fillCandidateLiteTable) {
701726
rowCandidateLite.reserve(recSigKf.size());
702727
} else {
703728
rowCandidateFull.reserve(recSigKf.size());
704729
}
705730
for (const auto& candidate : recSigKf) {
706731
fillCandidateTable<true, true>(candidate);
732+
if (fillCandidateDauIndexTable) {
733+
fillIndexTable(candidate);
734+
}
707735
}
708736
} else if (fillOnlyBackground) {
737+
if (fillCandidateDauIndexTable) {
738+
rowCandidateDauIndices.reserve(candidates.size());
739+
}
709740
if (fillCandidateLiteTable) {
710741
rowCandidateLite.reserve(recBgKf.size());
711742
} else {
@@ -717,15 +748,24 @@ struct HfTreeCreatorXicToXiPiPi {
717748
continue;
718749
}
719750
fillCandidateTable<true, true>(candidate);
751+
if (fillCandidateDauIndexTable) {
752+
fillIndexTable(candidate);
753+
}
720754
}
721755
} else {
756+
if (fillCandidateDauIndexTable) {
757+
rowCandidateDauIndices.reserve(candidates.size());
758+
}
722759
if (fillCandidateLiteTable) {
723760
rowCandidateLite.reserve(candidates.size());
724761
} else {
725762
rowCandidateFull.reserve(candidates.size());
726763
}
727764
for (const auto& candidate : candidates) {
728765
fillCandidateTable<true, true>(candidate);
766+
if (fillCandidateDauIndexTable) {
767+
fillIndexTable(candidate);
768+
}
729769
}
730770
}
731771

0 commit comments

Comments
 (0)