1515// / \author Marianna Mazzilli <[email protected] >1616// / \author Zhen Zhang <[email protected] >1717
18+ #include < vector>
19+
1820#include " CommonConstants/PhysicsConstants.h"
1921#include " Framework/AnalysisTask.h"
2022#include " Framework/HistogramRegistry.h"
3032#include " PWGHF/DataModel/CandidateReconstructionTables.h"
3133#include " PWGHF/DataModel/CandidateSelectionTables.h"
3234#include " PWGHF/HFC/DataModel/CorrelationTables.h"
35+ #include " PWGHF/HFC/Utils/utilsCorrelations.h"
3336
3437using namespace o2 ;
3538using namespace o2 ::analysis;
3639using namespace o2 ::constants::physics;
3740using namespace o2 ::framework;
3841using namespace o2 ::framework::expressions;
42+ using namespace o2 ::analysis::hf_correlations;
3943
4044// /
4145// / Returns deltaPhi values in range [-pi/2., 3.*pi/2.], typically used for correlation studies
@@ -189,10 +193,14 @@ struct HfCorrelatorLcHadrons {
189193 ConfigurableAxis binsMultiplicity{" binsMultiplicity" , {VARIABLE_WIDTH, 0 .0f , 2000 .0f , 6000 .0f , 100000 .0f }, " Mixing bins - multiplicity" };
190194 ConfigurableAxis binsZVtx{" binsZVtx" , {VARIABLE_WIDTH, -10 .0f , -2 .5f , 2 .5f , 10 .0f }, " Mixing bins - z-vertex" };
191195 ConfigurableAxis binsMultiplicityMc{" binsMultiplicityMc" , {VARIABLE_WIDTH, 0 .0f , 20 .0f , 50 .0f , 500 .0f }, " Mixing bins - MC multiplicity" }; // In MCGen multiplicity is defined by counting tracks
196+ Configurable<bool > storeAutoCorrelationFlag{" storeAutoCorrelationFlag" , false , " Store flag that indicates if the track is paired to its D-meson mother instead of skipping it" };
197+ Configurable<bool > correlateLcWithLeadingParticle{" correlateLcWithLeadingParticle" , false , " Switch for correlation of Lc baryons with leading particle only" };
192198
193199 HfHelper hfHelper;
194200 SliceCache cache;
195201 BinningType corrBinning{{binsZVtx, binsMultiplicity}, true };
202+ int leadingIndex = 0 ;
203+ bool correlationStatus = false ;
196204
197205 // Filters for ME
198206 Filter collisionFilter = aod::hf_selection_lc_collision::lcSel >= filterFlagLc;
@@ -263,6 +271,12 @@ struct HfCorrelatorLcHadrons {
263271 if (selectedLcCandidates.size () == 0 ) {
264272 return ;
265273 }
274+
275+ // find leading particle
276+ if (correlateLcWithLeadingParticle) {
277+ leadingIndex = findLeadingParticle (tracks, dcaXYTrackMax.value , dcaZTrackMax.value );
278+ }
279+
266280 int poolBin = corrBinning.getBin (std::make_tuple (collision.posZ (), collision.multFT0M ()));
267281 int nTracks = 0 ;
268282 if (collision.numContrib () > 1 ) {
@@ -335,24 +349,37 @@ struct HfCorrelatorLcHadrons {
335349 if (std::abs (track.dcaXY ()) >= dcaXYTrackMax || std::abs (track.dcaZ ()) >= dcaZTrackMax) {
336350 continue ; // Remove secondary tracks
337351 }
352+
338353 // Remove Lc daughters by checking track indices
339354 if ((candidate.prong0Id () == track.globalIndex ()) || (candidate.prong1Id () == track.globalIndex ()) || (candidate.prong2Id () == track.globalIndex ())) {
340- continue ;
355+ if (!storeAutoCorrelationFlag) {
356+ continue ;
357+ }
358+ correlationStatus = true ;
341359 }
360+
361+ if (correlateLcWithLeadingParticle) {
362+ if (track.globalIndex () != leadingIndex) {
363+ continue ;
364+ }
365+ }
366+
342367 if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
343368 entryLcHadronPair (getDeltaPhi (track.phi (), candidate.phi ()),
344369 track.eta () - candidate.eta (),
345370 candidate.pt (),
346371 track.pt (),
347- poolBin);
372+ poolBin,
373+ correlationStatus);
348374 entryLcHadronRecoInfo (hfHelper.invMassLcToPKPi (candidate), false );
349375 }
350376 if (candidate.isSelLcToPiKP () >= selectionFlagLc) {
351377 entryLcHadronPair (getDeltaPhi (track.phi (), candidate.phi ()),
352378 track.eta () - candidate.eta (),
353379 candidate.pt (),
354380 track.pt (),
355- poolBin);
381+ poolBin,
382+ correlationStatus);
356383 entryLcHadronRecoInfo (hfHelper.invMassLcToPiKP (candidate), false );
357384 }
358385 } // Hadron Tracks loop
@@ -370,6 +397,12 @@ struct HfCorrelatorLcHadrons {
370397 if (selectedLcCandidatesMc.size () == 0 ) {
371398 return ;
372399 }
400+
401+ // find leading particle
402+ if (correlateLcWithLeadingParticle) {
403+ leadingIndex = findLeadingParticle (tracks, dcaXYTrackMax.value , dcaZTrackMax.value );
404+ }
405+
373406 int poolBin = corrBinning.getBin (std::make_tuple (collision.posZ (), collision.multFT0M ()));
374407 int nTracks = 0 ;
375408 if (collision.numContrib () > 1 ) {
@@ -472,24 +505,35 @@ struct HfCorrelatorLcHadrons {
472505 }
473506 // Removing Lc daughters by checking track indices
474507 if ((candidate.prong0Id () == track.globalIndex ()) || (candidate.prong1Id () == track.globalIndex ()) || (candidate.prong2Id () == track.globalIndex ())) {
475- continue ;
508+ if (!storeAutoCorrelationFlag) {
509+ continue ;
510+ }
511+ correlationStatus = true ;
476512 }
477513 registry.fill (HIST (" hPtParticleAssocMcRec" ), track.pt ());
478514
515+ if (correlateLcWithLeadingParticle) {
516+ if (track.globalIndex () != leadingIndex) {
517+ continue ;
518+ }
519+ }
520+
479521 if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
480522 entryLcHadronPair (getDeltaPhi (track.phi (), candidate.phi ()),
481523 track.eta () - candidate.eta (),
482524 candidate.pt (),
483525 track.pt (),
484- poolBin);
526+ poolBin,
527+ correlationStatus);
485528 entryLcHadronRecoInfo (hfHelper.invMassLcToPKPi (candidate), isLcSignal);
486529 }
487530 if (candidate.isSelLcToPiKP () >= selectionFlagLc) {
488531 entryLcHadronPair (getDeltaPhi (track.phi (), candidate.phi ()),
489532 track.eta () - candidate.eta (),
490533 candidate.pt (),
491534 track.pt (),
492- poolBin);
535+ poolBin,
536+ correlationStatus);
493537 entryLcHadronRecoInfo (hfHelper.invMassLcToPiKP (candidate), isLcSignal);
494538 }
495539 } // end inner loop (Tracks)
@@ -506,6 +550,11 @@ struct HfCorrelatorLcHadrons {
506550 int counterLcHadron = 0 ;
507551 registry.fill (HIST (" hMcEvtCount" ), 0 );
508552
553+ // find leading particle
554+ if (correlateLcWithLeadingParticle) {
555+ leadingIndex = findLeadingParticleMcGen (mcParticles, etaTrackMax.value , ptTrackMin.value );
556+ }
557+
509558 auto getTracksSize = [&mcParticles](aod::McCollision const & /* collision*/ ) {
510559 int nTracks = 0 ;
511560 for (const auto & track : mcParticles) {
@@ -556,15 +605,26 @@ struct HfCorrelatorLcHadrons {
556605 }
557606
558607 if ((std::abs (particleAssoc.pdgCode ()) != kElectron ) && (std::abs (particleAssoc.pdgCode ()) != kMuonMinus ) && (std::abs (particleAssoc.pdgCode ()) != kPiPlus ) && (std::abs (particle.pdgCode ()) != kKPlus ) && (std::abs (particleAssoc.pdgCode ()) != kProton )) {
559- continue ;
608+ if (!storeAutoCorrelationFlag) {
609+ continue ;
610+ }
611+ correlationStatus = true ;
560612 }
613+
614+ if (correlateLcWithLeadingParticle) {
615+ if (particleAssoc.globalIndex () != leadingIndex) {
616+ continue ;
617+ }
618+ }
619+
561620 int poolBin = corrBinningMcGen.getBin (std::make_tuple (mcCollision.posZ (), getTracksSize (mcCollision)));
562621 registry.fill (HIST (" hPtParticleAssocMcGen" ), particleAssoc.pt ());
563622 entryLcHadronPair (getDeltaPhi (particleAssoc.phi (), particle.phi ()),
564623 particleAssoc.eta () - particle.eta (),
565624 particle.pt (),
566625 particleAssoc.pt (),
567- poolBin);
626+ poolBin,
627+ correlationStatus);
568628 entryLcHadronRecoInfo (MassLambdaCPlus, true );
569629 } // end inner loop
570630 }
@@ -600,15 +660,17 @@ struct HfCorrelatorLcHadrons {
600660 t1.eta () - t2.eta (),
601661 t1.pt (),
602662 t2.pt (),
603- poolBin);
663+ poolBin,
664+ correlationStatus);
604665 entryLcHadronRecoInfo (hfHelper.invMassLcToPKPi (t1), false );
605666 }
606667 if (t1.isSelLcToPiKP () >= selectionFlagLc) {
607668 entryLcHadronPair (getDeltaPhi (t1.phi (), t2.phi ()),
608669 t1.eta () - t2.eta (),
609670 t1.pt (),
610671 t2.pt (),
611- poolBin);
672+ poolBin,
673+ correlationStatus);
612674 entryLcHadronRecoInfo (hfHelper.invMassLcToPiKP (t1), false );
613675 }
614676 }
@@ -634,15 +696,17 @@ struct HfCorrelatorLcHadrons {
634696 t1.eta () - t2.eta (),
635697 t1.pt (),
636698 t2.pt (),
637- poolBin);
699+ poolBin,
700+ correlationStatus);
638701 entryLcHadronRecoInfo (hfHelper.invMassLcToPKPi (t1), false );
639702 }
640703 if (t1.isSelLcToPiKP () >= selectionFlagLc) {
641704 entryLcHadronPair (getDeltaPhi (t1.phi (), t2.phi ()),
642705 t1.eta () - t2.eta (),
643706 t1.pt (),
644707 t2.pt (),
645- poolBin);
708+ poolBin,
709+ correlationStatus);
646710 entryLcHadronRecoInfo (hfHelper.invMassLcToPiKP (t1), false );
647711 }
648712 }
@@ -696,7 +760,8 @@ struct HfCorrelatorLcHadrons {
696760 t1.eta () - t2.eta (),
697761 t1.pt (),
698762 t2.pt (),
699- poolBin);
763+ poolBin,
764+ correlationStatus);
700765 }
701766 }
702767 }
0 commit comments