Skip to content

Commit d37f235

Browse files
IgorPtakalibuild
andauthored
[PWGCF] Femto: add Lc support to the femto framework (#17424)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 55f54a0 commit d37f235

19 files changed

Lines changed: 1729 additions & 573 deletions

PWGCF/Femto/Core/charmHadronBuilder.h

Lines changed: 372 additions & 120 deletions
Large diffs are not rendered by default.

PWGCF/Femto/Core/charmHadronHistManager.h

Lines changed: 265 additions & 62 deletions
Large diffs are not rendered by default.

PWGCF/Femto/Core/closePairRejection.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ struct ConfCpr : o2::framework::ConfigurableGroup {
8484
constexpr const char PrefixCprTrackTrack[] = "CprTrackTrack";
8585
constexpr const char PrefixCprTrackV0Daughter[] = "CprTrackV0Daughter";
8686
constexpr const char PrefixCprTrackD0Daughter[] = "CprTrackD0Daughter";
87+
constexpr const char PrefixCprTrackLcProton[] = "CprTrackLcProton";
88+
constexpr const char PrefixCprTrackLcKaon[] = "CprTrackLcKaon";
89+
constexpr const char PrefixCprTrackLcPion[] = "CprTrackLcPion";
8790
constexpr const char PrefixCprD0DaughterD0DaughterPos[] = "CprD0DaughterD0DaughterPos";
8891
constexpr const char PrefixCprD0DaughterD0DaughterNeg[] = "CprD0DaughterD0DaughterNeg";
8992
constexpr const char PrefixCprTrackResonanceDaughter[] = "CprTrackResonanceDaughter";
@@ -98,6 +101,9 @@ constexpr const char PrefixCprTrackCascadeBachelor[] = "CprTrackCascadeBachelor"
98101
using ConfCprTrackTrack = ConfCpr<PrefixCprTrackTrack>;
99102
using ConfCprTrackV0Daughter = ConfCpr<PrefixCprTrackV0Daughter>;
100103
using ConfCprTrackD0Daughter = ConfCpr<PrefixCprTrackD0Daughter>;
104+
using ConfCprTrackLcProton = ConfCpr<PrefixCprTrackLcProton>;
105+
using ConfCprTrackLcKaon = ConfCpr<PrefixCprTrackLcKaon>;
106+
using ConfCprTrackLcPion = ConfCpr<PrefixCprTrackLcPion>;
101107
using ConfCprD0DaugherD0DaughterPos = ConfCpr<PrefixCprD0DaughterD0DaughterPos>;
102108
using ConfCprD0DaugherD0DaughterNeg = ConfCpr<PrefixCprD0DaughterD0DaughterNeg>;
103109
using ConfCprTrackResonanceDaughter = ConfCpr<PrefixCprTrackResonanceDaughter>;
@@ -123,6 +129,12 @@ constexpr char PrefixD0D0PosSe[] = "CPR_D0D0_PosDau/SE/";
123129
constexpr char PrefixD0D0NegSe[] = "CPR_D0D0_NegDau/SE/";
124130
constexpr char PrefixD0D0PosMe[] = "CPR_D0D0_PosDau/ME/";
125131
constexpr char PrefixD0D0NegMe[] = "CPR_D0D0_NegDau/ME/";
132+
constexpr char PrefixTrackLcProtonSe[] = "CPR_TrackLc_Proton/SE/";
133+
constexpr char PrefixTrackLcKaonSe[] = "CPR_TrackLc_Kaon/SE/";
134+
constexpr char PrefixTrackLcPionSe[] = "CPR_TrackLc_Pion/SE/";
135+
constexpr char PrefixTrackLcProtonMe[] = "CPR_TrackLc_Proton/ME/";
136+
constexpr char PrefixTrackLcKaonMe[] = "CPR_TrackLc_Kaon/ME/";
137+
constexpr char PrefixTrackLcPionMe[] = "CPR_TrackLc_Pion/ME/";
126138
constexpr char PrefixV0V0PosSe[] = "CPR_V0V0_PosDau/SE/";
127139
constexpr char PrefixV0V0NegSe[] = "CPR_V0V0_NegDau/SE/";
128140
constexpr char PrefixV0V0PosMe[] = "CPR_V0V0_PosDau/ME/";
@@ -539,6 +551,58 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h
539551
CloseTrackRejection<prefixTrackV0> mCtr;
540552
};
541553

554+
template <auto& prefixProton, auto& prefixKaon, auto& prefixPion>
555+
class ClosePairRejectionTrackLc
556+
{
557+
public:
558+
template <typename T1, typename T2, typename T3>
559+
void init(o2::framework::HistogramRegistry* registry,
560+
std::map<CprHist, std::vector<o2::framework::AxisSpec>> const& specsProton,
561+
std::map<CprHist, std::vector<o2::framework::AxisSpec>> const& specsKaon,
562+
std::map<CprHist, std::vector<o2::framework::AxisSpec>> const& specsPion,
563+
T1 const& confCprProton,
564+
T2 const& confCprKaon,
565+
T3 const& confCprPion,
566+
int absChargeTrack)
567+
{
568+
mCtrProton.init(registry, specsProton, confCprProton, absChargeTrack, 1);
569+
mCtrKaon.init(registry, specsKaon, confCprKaon, absChargeTrack, 1);
570+
mCtrPion.init(registry, specsPion, confCprPion, absChargeTrack, 1);
571+
}
572+
573+
void setMagField(float magField)
574+
{
575+
mCtrProton.setMagField(magField);
576+
mCtrKaon.setMagField(magField);
577+
mCtrPion.setMagField(magField);
578+
}
579+
580+
template <typename T1, typename T2, typename T3>
581+
void setPair(T1 const& track, T2 const& lc, T3 const& trackTable)
582+
{
583+
auto prong0 = trackTable.rawIteratorAt(lc.prong0DauId() - trackTable.offset());
584+
mCtrProton.compute(track, prong0);
585+
auto prong1 = trackTable.rawIteratorAt(lc.prong1DauId() - trackTable.offset());
586+
mCtrKaon.compute(track, prong1);
587+
auto prong2 = trackTable.rawIteratorAt(lc.prong2DauId() - trackTable.offset());
588+
mCtrPion.compute(track, prong2);
589+
}
590+
591+
[[nodiscard]] bool isClosePair() const { return mCtrProton.isClosePair() || mCtrKaon.isClosePair() || mCtrPion.isClosePair(); }
592+
593+
void fill(float kstar)
594+
{
595+
mCtrProton.fill(kstar);
596+
mCtrKaon.fill(kstar);
597+
mCtrPion.fill(kstar);
598+
}
599+
600+
private:
601+
CloseTrackRejection<prefixProton> mCtrProton;
602+
CloseTrackRejection<prefixKaon> mCtrKaon;
603+
CloseTrackRejection<prefixPion> mCtrPion;
604+
};
605+
542606
template <auto& prefixBachelor, auto& prefixV0Daughter>
543607
class ClosePairRejectionTrackCascade
544608
{

PWGCF/Femto/Core/mcBuilder.h

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct McBuilderProducts : o2::framework::ProducesGroup {
6363
o2::framework::Produces<o2::aod::FLambdaLabels> producedLambdaLabels;
6464
o2::framework::Produces<o2::aod::FK0shortLabels> producedK0shortLabels;
6565
o2::framework::Produces<o2::aod::FD0Labels> producedD0Labels;
66+
o2::framework::Produces<o2::aod::FLcLabels> producedLcLabels;
6667
o2::framework::Produces<o2::aod::FSigmaLabels> producedSigmaLabels;
6768
o2::framework::Produces<o2::aod::FSigmaPlusLabels> producedSigmaPlusLabels;
6869
o2::framework::Produces<o2::aod::FXiLabels> producedXiLabels;
@@ -82,6 +83,7 @@ struct ConfMcTables : o2::framework::ConfigurableGroup {
8283
o2::framework::Configurable<int> producedLambdaLabels{"producedLambdaLabels", -1, "Produce lambda labels (-1: auto; 0 off; 1 on)"};
8384
o2::framework::Configurable<int> producedK0shortLabels{"producedK0shortLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"};
8485
o2::framework::Configurable<int> producedD0Labels{"producedD0Labels", -1, "Produce D0 labels (-1: auto; 0 off; 1 on)"};
86+
o2::framework::Configurable<int> producedLcLabels{"producedLcLabels", -1, "Produce Lc labels (-1: auto; 0 off; 1 on)"};
8587
o2::framework::Configurable<int> producedSigmaLabels{"producedSigmaLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"};
8688
o2::framework::Configurable<int> producedSigmaPlusLabels{"producedSigmaPlusLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"};
8789
o2::framework::Configurable<int> producedXiLabels{"producedXiLabels", -1, "Produce xi labels (-1: auto; 0 off; 1 on)"};
@@ -148,6 +150,7 @@ class McBuilder
148150
mProduceLambdaLabels = utils::enableTable("FLambdaLabels", table.producedLambdaLabels.value, initContext);
149151
mProduceK0shortLabels = utils::enableTable("FK0shortLabels", table.producedK0shortLabels.value, initContext);
150152
mProduceD0Labels = utils::enableTable("FD0Labels", table.producedD0Labels.value, initContext);
153+
mProduceLcLabels = utils::enableTable("FLcLabels", table.producedLcLabels.value, initContext);
151154
mProduceSigmaLabels = utils::enableTable("FSigmaLabels", table.producedSigmaLabels.value, initContext);
152155
mProduceSigmaPlusLabels = utils::enableTable("FSigmaPlusLabels", table.producedSigmaPlusLabels.value, initContext);
153156
mProduceXiLabels = utils::enableTable("FXiLabels", table.producedXiLabels.value, initContext);
@@ -160,7 +163,7 @@ class McBuilder
160163
mProduceLambdaLabels || mProduceK0shortLabels ||
161164
mProduceSigmaLabels || mProduceSigmaPlusLabels ||
162165
mProduceXiLabels || mProduceOmegaLabels ||
163-
mProduceD0Labels) {
166+
mProduceD0Labels || mProduceLcLabels) {
164167
mFillAnyTable = true;
165168
} else {
166169
LOG(info) << "No tables configured...";
@@ -257,7 +260,8 @@ class McBuilder
257260
{
258261
// charm hadrons get a prompt/non-prompt origin, consistent with the reco-matched path;
259262
// all other particles use the generic getOrigin inside getOrCreateMcParticleRow
260-
if (std::abs(mcParticle.pdgCode()) == o2::constants::physics::Pdg::kD0) {
263+
const int pdgAbs = std::abs(mcParticle.pdgCode());
264+
if (pdgAbs == o2::constants::physics::Pdg::kD0) {
261265
// truth-level acceptance for the efficiency denominator: keep only
262266
// generated D0 -> K pi decays inside the rapidity acceptance
263267
int8_t sign = 0;
@@ -268,6 +272,15 @@ class McBuilder
268272
return;
269273
}
270274
}
275+
if (pdgAbs == o2::constants::physics::Pdg::kLambdaCPlus) {
276+
int8_t sign = 0;
277+
if (!RecoDecay::isMatchedMCGen(mcParticles, mcParticle, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2)) {
278+
return;
279+
}
280+
if (std::abs(mcParticle.y()) > mCharmYGenMax) {
281+
return;
282+
}
283+
}
271284
this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, mcProducts);
272285
}
273286

@@ -357,6 +370,35 @@ class McBuilder
357370
mcProducts.producedD0Labels(mcParticleRow);
358371
}
359372

373+
// Lc has no direct MC label. The three prongs are matched to a generated
374+
// Lc -> p K pi decay;depthMax = 2 because the decay also proceeds through intermediate resonances.
375+
template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5>
376+
void fillMcLcWithLabel(T1 const& lcCandidate, T2 const& /*tracks*/, T3 const& mcParticles, T4 const& /*mcCols*/, T5& mcProducts)
377+
{
378+
if (!mProduceLcLabels) {
379+
mcProducts.producedLcLabels(-1);
380+
return;
381+
}
382+
383+
auto prong0 = lcCandidate.template prong0_as<T2>();
384+
auto prong1 = lcCandidate.template prong1_as<T2>();
385+
auto prong2 = lcCandidate.template prong2_as<T2>();
386+
auto arrayDaughters = std::array{prong0, prong1, prong2};
387+
int8_t sign = 0;
388+
const int indexMcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
389+
390+
if (indexMcRec < 0) {
391+
mcProducts.producedLcLabels(-1);
392+
return;
393+
}
394+
395+
auto mcParticle = mcParticles.rawIteratorAt(indexMcRec);
396+
auto mcCol = mcParticle.template mcCollision_as<T4>();
397+
int64_t mcParticleRow = this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, mcProducts);
398+
399+
mcProducts.producedLcLabels(mcParticleRow);
400+
}
401+
360402
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
361403
void fillMcSigmaWithLabel(T1 const& sigmaDaughter, T2 const& mcParticles, T3 const& mcCols, T4& mcProducts)
362404
{
@@ -467,7 +509,10 @@ class McBuilder
467509
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
468510
int64_t getOrCreateMcParticleRow(T1 const& mcParticle, T2 const& mcParticles, T3 const& mcCol, T4& mcProducts)
469511
{
470-
auto origin = std::abs(mcParticle.pdgCode()) == o2::constants::physics::Pdg::kD0
512+
const int pdgAbs = std::abs(mcParticle.pdgCode());
513+
const bool isCharmHadron = (pdgAbs == o2::constants::physics::Pdg::kD0 ||
514+
pdgAbs == o2::constants::physics::Pdg::kLambdaCPlus);
515+
auto origin = isCharmHadron
471516
? this->getHeavyFlavourOrigin(mcParticle, mcParticles)
472517
: this->getOrigin(mcParticle);
473518
return this->buildMcParticleRow<system>(mcParticle, mcParticles, mcCol, origin, mcProducts);
@@ -686,6 +731,7 @@ class McBuilder
686731
bool mProduceLambdaLabels = false;
687732
bool mProduceK0shortLabels = false;
688733
bool mProduceD0Labels = false;
734+
bool mProduceLcLabels = false;
689735
bool mProduceSigmaLabels = false;
690736
bool mProduceSigmaPlusLabels = false;
691737
bool mProduceXiLabels = false;

PWGCF/Femto/Core/modes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ enum class TwoTrackResonance : o2::analysis::femto::datatypes::TwoTrackResonance
174174
enum class CharmHadron : o2::analysis::femto::datatypes::CharmHadronType {
175175
kD0,
176176
kD0Bar,
177-
kDplus,
178-
kLc
177+
kLc,
178+
kLcBar
179179
};
180180

181181
enum class QvecDetector : o2::analysis::femto::datatypes::QvecDetectorType {

0 commit comments

Comments
 (0)