Skip to content

Commit 230d973

Browse files
authored
[PWGLF] Add closure-test correlations for truth triggers with reconstructed-track matches in hStrangeCorrelation.cxx (#17350)
1 parent 3ff15bf commit 230d973

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#include <string>
7777
#include <string_view>
7878
#include <unordered_map>
79+
#include <unordered_set>
7980
#include <utility>
8081
#include <variant>
8182
#include <vector>
@@ -130,6 +131,7 @@ struct HStrangeCorrelation {
130131
Configurable<int> mixingParameter{"mixingParameter", 10, "how many events are mixed"};
131132
Configurable<bool> doMCassociation{"doMCassociation", false, "fill everything only for MC associated"};
132133
Configurable<bool> doTriggPhysicalPrimary{"doTriggPhysicalPrimary", false, "require physical primary for trigger particles"};
134+
Configurable<bool> doClosureTestTriggerWithRecoTrackMatch{"doClosureTestTriggerWithRecoTrackMatch", false, "add closure-test correlations requiring the truth trigger to have at least one reconstructed track with a matching MC label"};
133135
Configurable<bool> applyNewMCSelection{"applyNewMCSelection", false, "apply new MC Generated selection"};
134136
Configurable<bool> doSeparateFT0Prediction{"doSeparateFT0Prediction", false, "separate FT0M to FT0A and FT0C in prediction process"};
135137
Configurable<bool> useCentralityinPrediction{"useCentralityinPrediction", false, "if true, use centrality instead of multiplisity"};
@@ -2172,6 +2174,7 @@ struct HStrangeCorrelation {
21722174
histos.add("PairLossK0/Stage/hCounts", "pair-loss diagnostic stage counts", kTH1F, {axisPairLossStage});
21732175
histos.add("PairLossK0/Stage/hCountsFindable", "pair-loss diagnostic stage counts for findable K0", kTH1F, {axisPairLossStage});
21742176
histos.add("PairLossK0/Stage/hPhysics", "stages in h-K0 physics variables", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign});
2177+
histos.add("PairLossK0/Stage/hPhysicsFindable", "stages in h-K0 physics variables for findable K0", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign});
21752178
histos.add("PairLossK0/Stage/hClose", "stages in trigger-daughter close-pair variables", kTHnF, {axisPairLossStage, axisPairLossMinDeltaPhiStar, axisPairLossDaughterDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign, axisPairLossChargeProduct});
21762179

21772180
histos.add("PairLossK0/State/hFinalObjectStatePhysics", "00/01/10/11 final trigger-K0 object state", kTHnF, {axisPairLossFinalObjectState, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign});
@@ -2480,16 +2483,26 @@ struct HStrangeCorrelation {
24802483
for (int i = 0; i < AssocParticleTypes; i++) {
24812484
if (TESTBIT(doCorrelation, i)) {
24822485
histos.add(fmt::format("ClosureTest/sameEvent/{}", Particlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
2486+
if (masterConfigurations.doClosureTestTriggerWithRecoTrackMatch) {
2487+
histos.add(fmt::format("ClosureTest/TriggerWithRecoTrackMatch/sameEvent/{}", Particlenames[i]).c_str(), "truth pairs whose trigger has at least one reconstructed track with a matching MC label", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
2488+
}
24832489
if (masterConfigurations.doCorrelationsHadronV0daughter) {
24842490
histos.add(fmt::format("ClosureTest/sameEvent/{}_SameSignDaughter", Particlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
24852491
histos.add(fmt::format("ClosureTest/sameEvent/{}_OppSignDaughter", Particlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
2492+
if (masterConfigurations.doClosureTestTriggerWithRecoTrackMatch) {
2493+
histos.add(fmt::format("ClosureTest/TriggerWithRecoTrackMatch/sameEvent/{}_SameSignDaughter", Particlenames[i]).c_str(), "truth trigger-daughter pairs whose trigger has a reconstructed-track match; same-sign daughter", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
2494+
histos.add(fmt::format("ClosureTest/TriggerWithRecoTrackMatch/sameEvent/{}_OppSignDaughter", Particlenames[i]).c_str(), "truth trigger-daughter pairs whose trigger has a reconstructed-track match; opposite-sign daughter", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
2495+
}
24862496
}
24872497
}
24882498
if (TESTBIT(doCorrelation, i)) {
24892499
histos.add(fmt::format("ClosureTest/h{}", Particlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
24902500
}
24912501
}
24922502
histos.add("ClosureTest/hTrigger", "Trigger Tracks", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
2503+
if (masterConfigurations.doClosureTestTriggerWithRecoTrackMatch) {
2504+
histos.add("ClosureTest/TriggerWithRecoTrackMatch/hTrigger", "Truth triggers with at least one reconstructed track with a matching MC label;#it{p}_{T}^{truth} (GeV/c);#eta^{truth};centrality (%)", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
2505+
}
24932506
}
24942507
if (doprocessFeedDown) {
24952508
histos.add("hLambdaXiMinusFeeddownMatrix", "hLambdaXiMinusFeeddownMatrix", kTH2F, {axisPtLambda, axisPtCascade});
@@ -4083,6 +4096,7 @@ struct HStrangeCorrelation {
40834096
histos.fill(HIST("PairLossK0/Stage/hPhysics"), stage, truthDeltaPhi, truthDeltaEta, truthK0.pt, truthTrigger.pt, magneticFieldSign);
40844097
if (truthK0.findable) {
40854098
histos.fill(HIST("PairLossK0/Stage/hCountsFindable"), stage);
4099+
histos.fill(HIST("PairLossK0/Stage/hPhysicsFindable"), stage, truthDeltaPhi, truthDeltaEta, truthK0.pt, truthTrigger.pt, magneticFieldSign);
40864100
if (closestDeltaPhiStar.valid) {
40874101
histos.fill(HIST("PairLossK0/Stage/hClose"), stage, closestDeltaPhiStar.minAbs, closestDeltaEta, truthK0.pt, truthTrigger.pt, magneticFieldSign, closestChargeProduct);
40884102
}
@@ -4154,7 +4168,10 @@ struct HStrangeCorrelation {
41544168
}
41554169
}
41564170

4157-
void processClosureTest(aod::McCollision const& /*mcCollision*/, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::CentFT0Cs, aod::PVMults>> const& recCollisions, aod::McParticles const& mcParticles)
4171+
void processClosureTest(aod::McCollision const& /*mcCollision*/,
4172+
soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::CentFT0Cs, aod::PVMults>> const& recCollisions,
4173+
aod::McParticles const& mcParticles,
4174+
TracksCompleteMC const& tracks)
41584175
{
41594176

41604177
std::vector<uint32_t> triggerIndices;
@@ -4169,6 +4186,22 @@ struct HStrangeCorrelation {
41694186
std::vector<uint32_t> omegaMinusIndices;
41704187
std::vector<uint32_t> omegaPlusIndices;
41714188

4189+
// A truth trigger belongs to this set when at least one reconstructed track
4190+
// in any reconstructed collision associated with the current MC collision
4191+
// points back to it through its MC label. No best-collision, track-quality,
4192+
// or final-trigger selection is imposed here: this is the "any track" stage.
4193+
std::unordered_set<int64_t> mcParticleIdsWithRecoTrackMatch;
4194+
if (masterConfigurations.doClosureTestTriggerWithRecoTrackMatch) {
4195+
for (auto const& recCollision : recCollisions) {
4196+
const auto trackSlice = tracks.sliceBy(pairLossTracksPerCollision, recCollision.globalIndex());
4197+
for (auto const& track : trackSlice) {
4198+
if (track.has_mcParticle()) {
4199+
mcParticleIdsWithRecoTrackMatch.insert(track.mcParticleId());
4200+
}
4201+
}
4202+
}
4203+
}
4204+
41724205
for (auto const& mcParticle : mcParticles) {
41734206
double geta = mcParticle.eta();
41744207
if (std::abs(geta) > etaSel) {
@@ -4274,6 +4307,9 @@ struct HStrangeCorrelation {
42744307
if (!masterConfigurations.doTriggPhysicalPrimary || mcParticle.isPhysicalPrimary()) {
42754308
triggerIndices.emplace_back(iteratorNum);
42764309
histos.fill(HIST("ClosureTest/hTrigger"), gpt, geta, bestCollisionCentpercentile);
4310+
if (masterConfigurations.doClosureTestTriggerWithRecoTrackMatch && mcParticleIdsWithRecoTrackMatch.find(mcParticle.globalIndex()) != mcParticleIdsWithRecoTrackMatch.end()) {
4311+
histos.fill(HIST("ClosureTest/TriggerWithRecoTrackMatch/hTrigger"), gpt, geta, bestCollisionCentpercentile);
4312+
}
42774313
}
42784314
if (masterConfigurations.doCorrelationHadron) {
42794315
if (!doAssocPhysicalPrimary || mcParticle.isPhysicalPrimary()) {
@@ -4337,6 +4373,7 @@ struct HStrangeCorrelation {
43374373
double getatrigger = triggerParticle.eta();
43384374
double gphitrigger = triggerParticle.phi();
43394375
double pttrigger = triggerParticle.pt();
4376+
const bool triggerHasRecoTrackMatch = masterConfigurations.doClosureTestTriggerWithRecoTrackMatch && mcParticleIdsWithRecoTrackMatch.find(triggerParticle.globalIndex()) != mcParticleIdsWithRecoTrackMatch.end();
43404377
auto const* triggerPdg = pdgDB->GetParticle(triggerParticle.pdgCode());
43414378
const double triggerCharge = triggerPdg ? triggerPdg->Charge() : 0.;
43424379
auto const& mother = triggerParticle.mothers_first_as<aod::McParticles>();
@@ -4364,6 +4401,9 @@ struct HStrangeCorrelation {
43644401
}
43654402
if (TESTBIT(doCorrelation, i)) {
43664403
histos.fill(HIST("ClosureTest/sameEvent/") + HIST(Particlenames[Index]), computeDeltaPhi(gphitrigger, gphiassoc), deltaeta, ptassoc, pttrigger, bestCollisionVtxZ, bestCollisionCentpercentile);
4404+
if (triggerHasRecoTrackMatch) {
4405+
histos.fill(HIST("ClosureTest/TriggerWithRecoTrackMatch/sameEvent/") + HIST(Particlenames[Index]), computeDeltaPhi(gphitrigger, gphiassoc), deltaeta, ptassoc, pttrigger, bestCollisionVtxZ, bestCollisionCentpercentile);
4406+
}
43674407
}
43684408
if (i < 3 && TESTBIT(doCorrelation, i) && masterConfigurations.doCorrelationsHadronV0daughter) {
43694409
auto const assocParticleDaughters = assocParticle.daughters_as<aod::McParticles>();
@@ -4376,8 +4416,14 @@ struct HStrangeCorrelation {
43764416
}
43774417
if (triggerCharge * daughterCharge > 0.) {
43784418
histos.fill(HIST("ClosureTest/sameEvent/") + HIST(Particlenames[Index]) + HIST("_SameSignDaughter"), computeDeltaPhi(gphitrigger, assocParticleDaughter.phi()), getatrigger - assocParticleDaughter.eta(), assocParticleDaughter.pt(), pttrigger, bestCollisionVtxZ, bestCollisionCentpercentile);
4419+
if (triggerHasRecoTrackMatch) {
4420+
histos.fill(HIST("ClosureTest/TriggerWithRecoTrackMatch/sameEvent/") + HIST(Particlenames[Index]) + HIST("_SameSignDaughter"), computeDeltaPhi(gphitrigger, assocParticleDaughter.phi()), getatrigger - assocParticleDaughter.eta(), assocParticleDaughter.pt(), pttrigger, bestCollisionVtxZ, bestCollisionCentpercentile);
4421+
}
43794422
} else {
43804423
histos.fill(HIST("ClosureTest/sameEvent/") + HIST(Particlenames[Index]) + HIST("_OppSignDaughter"), computeDeltaPhi(gphitrigger, assocParticleDaughter.phi()), getatrigger - assocParticleDaughter.eta(), assocParticleDaughter.pt(), pttrigger, bestCollisionVtxZ, bestCollisionCentpercentile);
4424+
if (triggerHasRecoTrackMatch) {
4425+
histos.fill(HIST("ClosureTest/TriggerWithRecoTrackMatch/sameEvent/") + HIST(Particlenames[Index]) + HIST("_OppSignDaughter"), computeDeltaPhi(gphitrigger, assocParticleDaughter.phi()), getatrigger - assocParticleDaughter.eta(), assocParticleDaughter.pt(), pttrigger, bestCollisionVtxZ, bestCollisionCentpercentile);
4426+
}
43814427
}
43824428
}
43834429
}

0 commit comments

Comments
 (0)