Skip to content

Commit 8c36246

Browse files
authored
PWGHF: Add finding leading particle in correlatorD0Hadrons for both McGen and McRec (#7722)
* Add files via upload * Delete correlatorD0Hadrons.cxx * Add files via upload * Add files via upload * Add files via upload
1 parent abc4962 commit 8c36246

2 files changed

Lines changed: 95 additions & 9 deletions

File tree

PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,28 @@ struct HfCorrelatorD0Hadrons {
280280
int leadingIndex = leadingParticle.globalIndex();
281281
return leadingIndex;
282282
}
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+
}
283305
// ======= Process starts for Data, Same event ============
284306

285307
/// D0-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
@@ -559,7 +581,7 @@ struct HfCorrelatorD0Hadrons {
559581
if (track.globalIndex() != leadingIndex) {
560582
continue;
561583
}
562-
registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle
584+
registry.fill(HIST("hTrackCounterRec"), 4); // fill no. of tracks have leading particle
563585
}
564586

565587
int signalStatus = 0;
@@ -605,6 +627,10 @@ struct HfCorrelatorD0Hadrons {
605627
{
606628
registry.fill(HIST("hEvtCountGen"), 0);
607629
// MC gen level
630+
// find leading particle
631+
if (correlateD0WithLeadingParticle) {
632+
leadingIndex = findLeadingParticleMcGen(mcParticles);
633+
}
608634
for (const auto& particle1 : mcParticles) {
609635
// 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!
610636
if (std::abs(particle1.pdgCode()) != Pdg::kD0) {
@@ -647,11 +673,23 @@ struct HfCorrelatorD0Hadrons {
647673

648674
auto indexMotherPi = RecoDecay::getMother(mcParticles, particle2, Pdg::kDStar, true, nullptr, 1); // last arguement 1 is written to consider immediate decay mother only
649675
auto indexMotherD0 = RecoDecay::getMother(mcParticles, particle1, Pdg::kDStar, true, nullptr, 1);
650-
if (std::abs(particle2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0)
651-
continue;
676+
bool correlationStatus = false;
677+
if (std::abs(particle2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) {
678+
if (!storeAutoCorrelationFlag) {
679+
continue;
680+
}
681+
correlationStatus = true;
682+
}
652683

653684
registry.fill(HIST("hTrackCounterGen"), 3); // fill after soft pion removal
654685

686+
if (correlateD0WithLeadingParticle) {
687+
if (particle2.globalIndex() != leadingIndex) {
688+
continue;
689+
}
690+
registry.fill(HIST("hTrackCounterGen"), 4); // fill no. of tracks have leading particle
691+
}
692+
655693
auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) {
656694
int nTracks = 0;
657695
for (const auto& track : mcParticles) {
@@ -664,8 +702,6 @@ struct HfCorrelatorD0Hadrons {
664702
using BinningTypeMcGen = FlexibleBinningPolicy<std::tuple<decltype(getTracksSize)>, aod::mccollision::PosZ, decltype(getTracksSize)>;
665703
BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zPoolBins, multPoolBinsMcGen}, true};
666704
int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision)));
667-
668-
bool correlationStatus = false;
669705
entryD0HadronPair(getDeltaPhi(particle2.phi(), particle1.phi()),
670706
particle2.eta() - particle1.eta(),
671707
particle1.pt(),

PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::m
5252
AxisSpec axisPtD = {10, 0., 10., ""};
5353
AxisSpec axisPtHadron = {11, 0., 11., ""};
5454
AxisSpec axisPoolBin = {9, 0., 9., ""};
55-
AxisSpec axisCorrelationState = {2, 0., 1., ""};
55+
AxisSpec axisCorrelationState = {2, 0., 2., ""};
5656
ConfigurableAxis axisMass{"axisMass", {250, 1.65f, 2.15f}, ""};
5757

5858
// definition of vectors for standard ptbin and invariant mass configurables
@@ -180,7 +180,16 @@ struct HfTaskCorrelationD0Hadrons {
180180
// Toward Transverse Away
181181
{"hToward", "Toward invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
182182
{"hTransverse", "Transverse invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
183-
{"hAway", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}}};
183+
{"hAway", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
184+
185+
// Toward Transverse Away for McRec
186+
{"hTowardRec", "Toward invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
187+
{"hTransverseRec", "Transverse invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
188+
{"hAwayRec", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
189+
// Toward Transverse Away for McGen
190+
{"hTowardGen", "Toward invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
191+
{"hTransverseGen", "Transverse invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}},
192+
{"hAwayGen", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}}};
184193
void init(InitContext&)
185194
{
186195
int nBinsPtAxis = binsCorrelations->size() - 1;
@@ -395,12 +404,32 @@ struct HfTaskCorrelationD0Hadrons {
395404
int signalStatus = pairEntry.signalStatus();
396405
int ptBinD = o2::analysis::findBin(binsCorrelations, ptD);
397406
int poolBin = pairEntry.poolBin();
407+
bool isAutoCorrelated = pairEntry.isAutoCorrelated();
398408

399409
double efficiencyWeight = 1.;
400410
if (applyEfficiency) {
401411
efficiencyWeight = 1. / (efficiencyDmeson->at(o2::analysis::findBin(binsEfficiency, ptD)));
402412
}
403-
413+
if (isTowardTransverseAway) {
414+
// Divide into three regions: toward, transverse, and away
415+
if (ptHadron < leadingParticlePtMin) {
416+
continue;
417+
}
418+
Region region = getRegion(deltaPhi);
419+
switch (region) {
420+
case Toward:
421+
registry.fill(HIST("hTowardRec"), massD, ptD, isAutoCorrelated, efficiencyWeight);
422+
break;
423+
case Away:
424+
registry.fill(HIST("hAwayRec"), massD, ptD, isAutoCorrelated, efficiencyWeight);
425+
break;
426+
case Transverse:
427+
registry.fill(HIST("hTransverseRec"), massD, ptD, isAutoCorrelated, efficiencyWeight);
428+
break;
429+
default:
430+
break;
431+
}
432+
}
404433
// fill correlation plots for signal/bagkground correlations
405434
if (pairEntry.signalStatus()) {
406435
registry.fill(HIST("hCorrel2DVsPtRecSig"), deltaPhi, deltaEta, ptD, ptHadron, efficiencyWeight);
@@ -589,14 +618,35 @@ struct HfTaskCorrelationD0Hadrons {
589618
double ptD = pairEntry.ptD();
590619
double ptHadron = pairEntry.ptHadron();
591620
int poolBin = pairEntry.poolBin();
621+
double massD = pairEntry.mD();
622+
bool isAutoCorrelated = pairEntry.isAutoCorrelated();
592623
// reject entries outside pT ranges of interest
593624
if (o2::analysis::findBin(binsCorrelations, ptD) < 0) {
594625
continue;
595626
}
596627
if (ptHadron > ptHadronMax) {
597628
ptHadron = ptHadronMax + 0.5;
598629
}
599-
630+
if (isTowardTransverseAway) {
631+
// Divide into three regions: toward, transverse, and away
632+
if (ptHadron < leadingParticlePtMin) {
633+
continue;
634+
}
635+
Region region = getRegion(deltaPhi);
636+
switch (region) {
637+
case Toward:
638+
registry.fill(HIST("hTowardGen"), massD, ptD, isAutoCorrelated);
639+
break;
640+
case Away:
641+
registry.fill(HIST("hAwayGen"), massD, ptD, isAutoCorrelated);
642+
break;
643+
case Transverse:
644+
registry.fill(HIST("hTransverseGen"), massD, ptD, isAutoCorrelated);
645+
break;
646+
default:
647+
break;
648+
}
649+
}
600650
registry.fill(HIST("hCorrel2DVsPtGen"), deltaPhi, deltaEta, ptD, ptHadron, poolBin);
601651
registry.fill(HIST("hCorrel2DPtIntGen"), deltaPhi, deltaEta);
602652
registry.fill(HIST("hDeltaEtaPtIntGen"), deltaEta);

0 commit comments

Comments
 (0)