@@ -185,6 +185,7 @@ struct HfCorrelatorD0Hadrons {
185185 Configurable<float > multMax{" multMax" , 10000 ., " maximum multiplicity accepted" };
186186 Configurable<float > ptSoftPionMax{" ptSoftPionMax" , 3 * 800 . * pow (10 ., -6 .), " max. pT cut for soft pion identification" };
187187 Configurable<bool > correlateD0WithLeadingParticle{" correlateD0WithLeadingParticle" , false , " Switch for correlation of D0 mesons with leading particle only" };
188+ Configurable<bool > storeAutoCorrelationFlag{" storeAutoCorrelationFlag" , false , " Store flag that indicates if the track is paired to its D-meson mother instead of skipping it" };
188189
189190 HfHelper hfHelper;
190191
@@ -367,8 +368,12 @@ struct HfCorrelatorD0Hadrons {
367368 for (const auto & track : tracks) {
368369 registry.fill (HIST (" hTrackCounter" ), 1 ); // fill total no. of tracks
369370 // Remove D0 daughters by checking track indices
371+ bool correlationStatus = false ;
370372 if ((candidate1.prong0Id () == track.globalIndex ()) || (candidate1.prong1Id () == track.globalIndex ())) {
371- continue ;
373+ if (!storeAutoCorrelationFlag) {
374+ continue ;
375+ }
376+ correlationStatus = true ;
372377 }
373378 if (std::abs (track.dcaXY ()) >= 1 . || std::abs (track.dcaZ ()) >= 1 .)
374379 continue ; // Remove secondary tracks
@@ -416,7 +421,8 @@ struct HfCorrelatorD0Hadrons {
416421 track.eta () - candidate1.eta (),
417422 candidate1.pt (),
418423 track.pt (),
419- poolBin);
424+ poolBin,
425+ correlationStatus);
420426 entryD0HadronRecoInfo (hfHelper.invMassD0ToPiK (candidate1), hfHelper.invMassD0barToKPi (candidate1), signalStatus);
421427
422428 } // end inner loop (tracks)
@@ -435,6 +441,10 @@ struct HfCorrelatorD0Hadrons {
435441 if (selectedD0candidatesMc.size () == 0 ) {
436442 return ;
437443 }
444+ // find leading particle
445+ if (correlateD0WithLeadingParticle) {
446+ leadingIndex = findLeadingParticle (tracks);
447+ }
438448 int poolBin = corrBinning.getBin (std::make_tuple (collision.posZ (), collision.multFV0M ()));
439449 int nTracks = 0 ;
440450 if (collision.numContrib () > 1 ) {
@@ -526,8 +536,12 @@ struct HfCorrelatorD0Hadrons {
526536 continue ;
527537 }
528538 // Removing D0 daughters by checking track indices
539+ bool correlationStatus = false ;
529540 if ((candidate1.prong0Id () == track.globalIndex ()) || (candidate1.prong1Id () == track.globalIndex ())) {
530- continue ;
541+ if (!storeAutoCorrelationFlag) {
542+ continue ;
543+ }
544+ correlationStatus = true ;
531545 }
532546 if (std::abs (track.dcaXY ()) >= 1 . || std::abs (track.dcaZ ()) >= 1 .) {
533547 continue ; // Remove secondary tracks
@@ -558,6 +572,13 @@ struct HfCorrelatorD0Hadrons {
558572
559573 registry.fill (HIST (" hTrackCounterRec" ), 3 ); // fill no. of tracks after soft pion removal
560574
575+ if (correlateD0WithLeadingParticle) {
576+ if (track.globalIndex () != leadingIndex) {
577+ continue ;
578+ }
579+ registry.fill (HIST (" hTrackCounter" ), 4 ); // fill no. of tracks have leading particle
580+ }
581+
561582 int signalStatus = 0 ;
562583 if (flagD0 && (candidate1.isSelD0 () >= selectionFlagD0) && !isSoftPiD0) {
563584 SETBIT (signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Sig);
@@ -583,7 +604,8 @@ struct HfCorrelatorD0Hadrons {
583604 track.eta () - candidate1.eta (),
584605 candidate1.pt (),
585606 track.pt (),
586- poolBin);
607+ poolBin,
608+ correlationStatus);
587609 entryD0HadronRecoInfo (hfHelper.invMassD0ToPiK (candidate1), hfHelper.invMassD0barToKPi (candidate1), signalStatus);
588610 } // end inner loop (Tracks)
589611 } // end of outer loop (D0)
@@ -660,11 +682,13 @@ struct HfCorrelatorD0Hadrons {
660682 BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBinsMcGen}, true };
661683 int poolBin = corrBinningMcGen.getBin (std::make_tuple (mcCollision.posZ (), getTracksSize (mcCollision)));
662684
685+ bool correlationStatus = false ;
663686 entryD0HadronPair (getDeltaPhi (particle2.phi (), particle1.phi ()),
664687 particle2.eta () - particle1.eta (),
665688 particle1.pt (),
666689 particle2.pt (),
667- poolBin);
690+ poolBin,
691+ correlationStatus);
668692 entryD0HadronRecoInfo (massD0, massD0, 0 ); // dummy info
669693 } // end inner loop (Tracks)
670694 } // end outer loop (D0)
@@ -727,8 +751,8 @@ struct HfCorrelatorD0Hadrons {
727751 signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnlySoftPi;
728752 }
729753 }
730-
731- entryD0HadronPair (getDeltaPhi (t1.phi (), t2.phi ()), t1.eta () - t2.eta (), t1.pt (), t2.pt (), poolBin);
754+ bool correlationStatus = false ;
755+ entryD0HadronPair (getDeltaPhi (t1.phi (), t2.phi ()), t1.eta () - t2.eta (), t1.pt (), t2.pt (), poolBin, correlationStatus );
732756 entryD0HadronRecoInfo (hfHelper.invMassD0ToPiK (t1), hfHelper.invMassD0barToKPi (t1), signalStatus);
733757 }
734758 }
@@ -827,9 +851,9 @@ struct HfCorrelatorD0Hadrons {
827851 SETBIT (signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi);
828852 }
829853 } // background case D0bar
830-
831854 registry.fill (HIST (" hSignalStatusMERec" ), signalStatus);
832- entryD0HadronPair (getDeltaPhi (t1.phi (), t2.phi ()), t1.eta () - t2.eta (), t1.pt (), t2.pt (), poolBin);
855+ bool correlationStatus = false ;
856+ entryD0HadronPair (getDeltaPhi (t1.phi (), t2.phi ()), t1.eta () - t2.eta (), t1.pt (), t2.pt (), poolBin, correlationStatus);
833857 entryD0HadronRecoInfo (hfHelper.invMassD0ToPiK (t1), hfHelper.invMassD0barToKPi (t1), signalStatus);
834858 }
835859 }
@@ -891,7 +915,8 @@ struct HfCorrelatorD0Hadrons {
891915 continue ;
892916 }
893917 int poolBin = corrBinningMcGen.getBin (std::make_tuple (c2.posZ (), getTracksSize (c2)));
894- entryD0HadronPair (getDeltaPhi (t2.phi (), t1.phi ()), t2.eta () - t1.eta (), t1.pt (), t2.pt (), poolBin);
918+ bool correlationStatus = false ;
919+ entryD0HadronPair (getDeltaPhi (t2.phi (), t1.phi ()), t2.eta () - t1.eta (), t1.pt (), t2.pt (), poolBin, correlationStatus);
895920 entryD0HadronRecoInfo (massD0, massD0, 0 ); // dummy info
896921 }
897922 }
0 commit comments