Skip to content

Commit 2a7f97b

Browse files
1481014945vkucera
andauthored
[PWGHF] Add finding leading particle in correlatorLcHadrons (AliceO2Group#8183)
Co-authored-by: Vít Kučera <[email protected]>
1 parent e22a573 commit 2a7f97b

File tree

6 files changed

+304
-132
lines changed

6 files changed

+304
-132
lines changed

PWGHF/HFC/DataModel/CorrelationTables.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,23 @@ DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pair
9797
// Note: definition of columns and tables for Lc-Hadron correlation pairs
9898
namespace hf_correlation_lc_hadron
9999
{
100-
DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Lc and Hadrons
101-
DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Lc and Hadrons
102-
DECLARE_SOA_COLUMN(PtLc, ptLc, float); //! Transverse momentum of Lc
103-
DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron
104-
DECLARE_SOA_COLUMN(MLc, mLc, float); //! Invariant mass of Lc
105-
DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP
106-
DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent
100+
DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Lc and Hadrons
101+
DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Lc and Hadrons
102+
DECLARE_SOA_COLUMN(PtLc, ptLc, float); //! Transverse momentum of Lc
103+
DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron
104+
DECLARE_SOA_COLUMN(MLc, mLc, float); //! Invariant mass of Lc
105+
DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP
106+
DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent
107+
DECLARE_SOA_COLUMN(IsAutoCorrelated, isAutoCorrelated, bool); //! Correlation Status
107108
} // namespace hf_correlation_lc_hadron
108109

109110
DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informations
110111
aod::hf_correlation_lc_hadron::DeltaPhi,
111112
aod::hf_correlation_lc_hadron::DeltaEta,
112113
aod::hf_correlation_lc_hadron::PtLc,
113114
aod::hf_correlation_lc_hadron::PtHadron,
114-
aod::hf_correlation_lc_hadron::PoolBin);
115+
aod::hf_correlation_lc_hadron::PoolBin,
116+
aod::hf_correlation_lc_hadron::IsAutoCorrelated);
115117

116118
DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs Reconstructed Informations
117119
aod::hf_correlation_lc_hadron::MLc,

PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
/// \author Samrangy Sadhu <[email protected]>, INFN Bari
1616
/// \author Swapnesh Santosh Khade <[email protected]>, IIT Indore
1717

18+
#include <vector>
19+
1820
#include "CommonConstants/PhysicsConstants.h"
1921
#include "Framework/AnalysisTask.h"
2022
#include "Framework/HistogramRegistry.h"
@@ -30,12 +32,14 @@
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

3437
using namespace o2;
3538
using namespace o2::analysis;
3639
using namespace o2::constants::physics;
3740
using namespace o2::framework;
3841
using namespace o2::framework::expressions;
42+
using namespace o2::analysis::hf_correlations;
3943

4044
///
4145
/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies
@@ -264,44 +268,6 @@ struct HfCorrelatorD0Hadrons {
264268
registry.add("hCountD0TriggersGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
265269
}
266270

267-
// Find Leading Particle
268-
template <typename TTracks>
269-
int findLeadingParticle(TTracks const& tracks)
270-
{
271-
auto leadingParticle = tracks.begin();
272-
for (auto const& track : tracks) {
273-
if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) {
274-
continue;
275-
}
276-
if (track.pt() > leadingParticle.pt()) {
277-
leadingParticle = track;
278-
}
279-
}
280-
int leadingIndex = leadingParticle.globalIndex();
281-
return leadingIndex;
282-
}
283-
// ======= Find Leading Particle for McGen ============
284-
template <typename TMcParticles>
285-
int findLeadingParticleMcGen(TMcParticles const& mcParticles)
286-
{
287-
auto leadingParticle = mcParticles.begin();
288-
for (auto const& mcParticle : mcParticles) {
289-
if (std::abs(mcParticle.eta()) > etaTrackMax) {
290-
continue;
291-
}
292-
if (mcParticle.pt() < ptTrackMin) {
293-
continue;
294-
}
295-
if ((std::abs(mcParticle.pdgCode()) != kElectron) && (std::abs(mcParticle.pdgCode()) != kMuonMinus) && (std::abs(mcParticle.pdgCode()) != kPiPlus) && (std::abs(mcParticle.pdgCode()) != kKPlus) && (std::abs(mcParticle.pdgCode()) != kProton)) {
296-
continue;
297-
}
298-
if (mcParticle.pt() > leadingParticle.pt()) {
299-
leadingParticle = mcParticle;
300-
}
301-
}
302-
int leadingIndex = leadingParticle.globalIndex();
303-
return leadingIndex;
304-
}
305271
// ======= Process starts for Data, Same event ============
306272

307273
/// D0-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
@@ -315,7 +281,7 @@ struct HfCorrelatorD0Hadrons {
315281
}
316282
// find leading particle
317283
if (correlateD0WithLeadingParticle) {
318-
leadingIndex = findLeadingParticle(tracks);
284+
leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value);
319285
}
320286

321287
int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M()));
@@ -459,7 +425,7 @@ struct HfCorrelatorD0Hadrons {
459425
}
460426
// find leading particle
461427
if (correlateD0WithLeadingParticle) {
462-
leadingIndex = findLeadingParticle(tracks);
428+
leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value);
463429
}
464430
int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M()));
465431
int nTracks = 0;
@@ -629,7 +595,7 @@ struct HfCorrelatorD0Hadrons {
629595
// MC gen level
630596
// find leading particle
631597
if (correlateD0WithLeadingParticle) {
632-
leadingIndex = findLeadingParticleMcGen(mcParticles);
598+
leadingIndex = findLeadingParticleMcGen(mcParticles, etaTrackMax.value, ptTrackMin.value);
633599
}
634600
for (const auto& particle1 : mcParticles) {
635601
// check if the particle is D0 or D0bar (for general plot filling and selection, so both cases are fine) - NOTE: decay channel is not probed!

PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
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"
@@ -30,12 +32,14 @@
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

3437
using namespace o2;
3538
using namespace o2::analysis;
3639
using namespace o2::constants::physics;
3740
using namespace o2::framework;
3841
using 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

Comments
 (0)