@@ -112,14 +112,14 @@ struct HfCorrelatorLcScHadronsSelection {
112112 bool isSel8 = true ;
113113 bool isNosameBunchPileUp = true ;
114114 double yCand = -999 .;
115- const int chargeScZero = 0 ;
115+ const int chargeZero = 0 ;
116116 if (doSelLcCollision) {
117117 for (const auto & candidate : candidates) {
118118
119119 if constexpr (isCandSc) {
120120 int8_t chargeCand = candidate.charge ();
121121
122- if (chargeCand == chargeScZero ) {
122+ if (chargeCand == chargeZero ) {
123123 yCand = hfHelper.ySc0 (candidate);
124124 } else {
125125 yCand = hfHelper.yScPlusPlus (candidate);
@@ -268,13 +268,18 @@ struct HfCorrelatorLcScHadrons {
268268 HfHelper hfHelper;
269269 SliceCache cache;
270270 Service<o2::framework::O2DatabasePDG> pdg;
271+ int8_t chargeCand = 3 ;
272+ int8_t signSoftPion = 0 ;
271273 int leadingIndex = 0 ;
272274 int poolBin = 0 ;
273275 int poolBinLc = 0 ;
274276 bool correlationStatus = false ;
275277 bool isPrompt = false ;
276278 bool isNonPrompt = false ;
277279 bool isSignal = false ;
280+ const int8_t chargeScPlusPlus = 2 ;
281+ const int8_t chargeZero = 0 ;
282+ const int8_t assignedChargeSc0 = 1 ; // to distingush sc0 from anti-sc0, charge set to +1 and -1
278283
279284 TRandom3* rnd = new TRandom3(0 );
280285 // std::vector<float> outputMl = {-1., -1., -1.};
@@ -413,11 +418,10 @@ struct HfCorrelatorLcScHadrons {
413418 double estimateY (CandType const & candidate)
414419 {
415420 double y = -999 .;
416- const int chargeScZero = 0 ;
417421 if constexpr (isCandSc) {
418422 int8_t chargeCand = candidate.charge ();
419423
420- if (chargeCand == chargeScZero ) {
424+ if (chargeCand == chargeZero ) {
421425 y = hfHelper.ySc0 (candidate);
422426 } else {
423427 y = hfHelper.yScPlusPlus (candidate);
@@ -512,8 +516,6 @@ struct HfCorrelatorLcScHadrons {
512516
513517 int nTracks = 0 ;
514518 int64_t timeStamp = 0 ;
515- const int chargeScPlusPlus = 2 ;
516- const int chargeScZero = 0 ;
517519 bool skipMixedEventTableFilling = false ;
518520 float multiplicityFT0M = collision.multFT0M ();
519521 int gCollisionId = collision.globalIndex ();
@@ -555,8 +557,6 @@ struct HfCorrelatorLcScHadrons {
555557 int countCand = 1 ;
556558
557559 for (const auto & candidate : candidates) {
558-
559- int8_t chargeCand = 3 ;
560560 double efficiencyWeightCand = 1 .;
561561 double yCand = -999.0 ;
562562 double etaCand = -999.0 ;
@@ -601,31 +601,38 @@ struct HfCorrelatorLcScHadrons {
601601 if (selLcPKPi) {
602602 const auto & probs = candidateLc.mlProbLcToPKPi ();
603603 fillMlOutput (probs, outputMlPKPi);
604- massCandPKPi = hfHelper.invMassScRecoLcToPKPi (candidate, candidateLc);
604+ massCandPKPi = std::abs ( hfHelper.invMassScRecoLcToPKPi (candidate, candidateLc) - hfHelper. invMassLcToPKPi (candidateLc) );
605605 }
606606 if (selLcPiKP) {
607607 const auto & probs = candidateLc.mlProbLcToPiKP ();
608608 fillMlOutput (probs, outputMlPiKP);
609- massCandPiKP = hfHelper.invMassScRecoLcToPiKP (candidate, candidateLc);
609+ massCandPiKP = std::abs ( hfHelper.invMassScRecoLcToPiKP (candidate, candidateLc) - hfHelper. invMassLcToPiKP (candidateLc) );
610610 }
611611 if constexpr (isMcRec) {
612612 // isSignal =
613613 // (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == 0) ||
614614 // (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs(chargeCand) == 2);
615615 isSignal =
616- (std::abs (candidate.flagMcMatchRec ()) == (1 << aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == chargeScZero ) ||
616+ (std::abs (candidate.flagMcMatchRec ()) == (1 << aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == chargeZero ) ||
617617 (std::abs (candidate.flagMcMatchRec ()) == (1 << aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs (chargeCand) == chargeScPlusPlus);
618618
619619 auto trackPos1 = candidateLc.template prong0_as <aod::TracksWMc>();
620620 auto trackPos2 = candidateLc.template prong2_as <aod::TracksWMc>();
621+ signSoftPion = candidate.template prong1_as <aod::TracksWMc>().sign ();
621622 if (calTrkEff && countCand == 1 && (isSignal || !calEffEventWithCand)) {
622623 calculateTrkEff (trackPos1, trackPos2, *mcParticles);
623624 }
624625 registry.fill (HIST (" hPtProng1" ), candidate.template prong1_as <aod::TracksWMc>().pt ());
625626 } else {
627+ signSoftPion = candidate.template prong1_as <aod::Tracks>().sign ();
626628 registry.fill (HIST (" hPtProng1" ), candidate.prong1 ().pt ());
627629 }
628630 registry.fill (HIST (" hPtProng0" ), ptCandLc);
631+
632+ if (chargeCand == chargeZero) {
633+ chargeCand = (signSoftPion < chargeZero) ? assignedChargeSc0 : -assignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1
634+ }
635+
629636 } else {
630637 selLcPKPi = candidate.isSelLcToPKPi () >= selectionFlagLc;
631638 selLcPiKP = candidate.isSelLcToPiKP () >= selectionFlagLc;
@@ -792,8 +799,6 @@ struct HfCorrelatorLcScHadrons {
792799 double massCandPiKP = -999.0 ;
793800 bool selLcPKPi = false ;
794801 bool selLcPiKP = false ;
795- const int chargeScPlusPlus = 2 ;
796- const int chargeScZero = 0 ;
797802
798803 auto tracksTuple = std::make_tuple (candidates, tracks);
799804 Pair<CollisionType, CandType, TrackType, BinningType> pairData{corrBinning, numberEventsMixed, -1 , collisions, tracksTuple, &cache};
@@ -817,22 +822,29 @@ struct HfCorrelatorLcScHadrons {
817822 if constexpr (isCandSc) {
818823 const auto & candidateLc = candidate.template prongLc_as <CandsLcData>();
819824 chargeCand = candidate.charge ();
825+
820826 selLcPKPi = (candidateLc.isSelLcToPKPi () >= selectionFlagLc) && (candidate.statusSpreadLcMinvPKPiFromPDG ());
821827 selLcPiKP = (candidateLc.isSelLcToPiKP () >= selectionFlagLc) && (candidate.statusSpreadLcMinvPiKPFromPDG ());
822828 if (selLcPKPi) {
823829 const auto & probs = candidateLc.mlProbLcToPKPi ();
824830 fillMlOutput (probs, outputMlPKPi);
825- massCandPKPi = hfHelper.invMassScRecoLcToPKPi (candidate, candidateLc);
831+ massCandPKPi = std::abs ( hfHelper.invMassScRecoLcToPKPi (candidate, candidateLc) - hfHelper. invMassLcToPKPi (candidateLc) );
826832 }
827833 if (selLcPiKP) {
828834 const auto & probs = candidateLc.mlProbLcToPiKP ();
829835 fillMlOutput (probs, outputMlPiKP);
830- massCandPiKP = hfHelper.invMassScRecoLcToPKPi (candidate, candidateLc);
836+ massCandPiKP = std::abs ( hfHelper.invMassScRecoLcToPiKP (candidate, candidateLc) - hfHelper. invMassLcToPiKP (candidateLc) );
831837 }
832838 if constexpr (isMcRec) {
833839 isSignal =
834- (TESTBIT (std::abs (candidate.flagMcMatchRec ()), aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == chargeScZero ) ||
840+ (TESTBIT (std::abs (candidate.flagMcMatchRec ()), aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == chargeZero ) ||
835841 (TESTBIT (std::abs (candidate.flagMcMatchRec ()), aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs (chargeCand) == chargeScPlusPlus);
842+ signSoftPion = candidate.template prong1_as <aod::TracksWMc>().sign ();
843+ } else {
844+ signSoftPion = candidate.template prong1_as <aod::Tracks>().sign ();
845+ }
846+ if (chargeCand == chargeZero) {
847+ chargeCand = (signSoftPion < chargeZero) ? assignedChargeSc0 : -assignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1
836848 }
837849 } else {
838850 selLcPKPi = candidate.isSelLcToPKPi () >= selectionFlagLc;
@@ -897,6 +909,8 @@ struct HfCorrelatorLcScHadrons {
897909 {
898910
899911 int counterCharmCand = 0 ;
912+ static constexpr std::size_t PDGChargeScale{3u };
913+
900914 registry.fill (HIST (" hMcEvtCount" ), 0 );
901915 BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true };
902916 poolBin = corrBinningMcGen.getBin (std::make_tuple (mcCollision.posZ (), mcCollision.multMCFT0A ()));
@@ -925,19 +939,19 @@ struct HfCorrelatorLcScHadrons {
925939 registry.fill (HIST (" hPhiMcGen" ), RecoDecay::constrainAngle (particle.phi (), -PIHalf));
926940 registry.fill (HIST (" hYMcGen" ), yCand);
927941
928- int8_t chargeLc = pdg->GetParticle (particle.pdgCode ())->Charge (); // Retrieve charge
929- if (chargeLc != 0 ) {
930- chargeLc = chargeLc / std::abs (chargeLc);
942+ int8_t chargeCand = pdg->GetParticle (particle.pdgCode ())->Charge () / PDGChargeScale ; // Retrieve charge
943+ if (chargeCand == chargeZero ) {
944+ chargeCand = (particle. pdgCode () > chargeZero) ? assignedChargeSc0 : -assignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1
931945 }
932946
933947 isPrompt = particle.originMcGen () == RecoDecay::OriginType::Prompt;
934948 isNonPrompt = particle.originMcGen () == RecoDecay::OriginType::NonPrompt;
935949 if (isPrompt) {
936950 registry.fill (HIST (" hPtCandMcGenPrompt" ), particle.pt ());
937- registry.fill (HIST (" hPtCandVsChargeMcGenPrompt" ), particle.pt (), chargeLc );
951+ registry.fill (HIST (" hPtCandVsChargeMcGenPrompt" ), particle.pt (), chargeCand );
938952 } else if (isNonPrompt) {
939953 registry.fill (HIST (" hPtCandMcGenNonPrompt" ), particle.pt ());
940- registry.fill (HIST (" hPtCandVsChargeMcGenNonPrompt" ), particle.pt (), chargeLc );
954+ registry.fill (HIST (" hPtCandVsChargeMcGenNonPrompt" ), particle.pt (), chargeCand );
941955 }
942956
943957 static constexpr std::size_t NDaughtersSc{4u };
@@ -1015,7 +1029,7 @@ struct HfCorrelatorLcScHadrons {
10151029 entryCandHadronPairY (particleAssoc.y () - yCand);
10161030 entryCandHadronRecoInfo (massCand, true );
10171031 entryCandHadronGenInfo (isPrompt, particleAssoc.isPhysicalPrimary (), trackOrigin);
1018- entryPairCandCharge (chargeLc );
1032+ entryPairCandCharge (chargeCand );
10191033 } // end inner loop
10201034 } // end outer loop
10211035 registry.fill (HIST (" hcountCandHadronPerEvent" ), counterCharmCand);
0 commit comments