@@ -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 ;
0 commit comments