Skip to content

Commit 5a7ef57

Browse files
committed
Update hStrangeCorrelation.cxx
1 parent 4f61e2a commit 5a7ef57

1 file changed

Lines changed: 56 additions & 15 deletions

File tree

PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ struct HStrangeCorrelation {
328328
Configurable<bool> triggerTracksRequireITS{"triggerTracksRequireITS", true, "must match triggerRequireITS in hStrangeCorrelationFilter.cxx"};
329329
Configurable<int> triggerTracksMaxSharedClusters{"triggerTracksMaxSharedClusters", 200, "must match triggerMaxTPCSharedClusters in hStrangeCorrelationFilter.cxx"};
330330
Configurable<bool> triggerTracksRequireLayer0{"triggerTracksRequireLayer0", false, "must match triggerRequireL0 in hStrangeCorrelationFilter.cxx"};
331+
// Separate from trackSelection.dcaXY*, which is this task's systematic-variation knob: the
332+
// replica must follow the value the filter was run with, not the varied analysis-level one.
333+
Configurable<float> triggerTracksDcaXYconstant{"triggerTracksDcaXYconstant", 0.004f, "must match dcaXYconstant in hStrangeCorrelationFilter.cxx"};
334+
Configurable<float> triggerTracksDcaXYpTdep{"triggerTracksDcaXYpTdep", 0.013f, "must match dcaXYpTdep in hStrangeCorrelationFilter.cxx"};
331335
} pairLossK0Configurations;
332336

333337
struct ValidCollision {
@@ -503,18 +507,26 @@ struct HStrangeCorrelation {
503507
int tpcSharedClusters = 0;
504508
int itsClusters = 0;
505509
bool hasLayer0 = false;
510+
// Needed to replicate the declarative preFilterTracks DCAxy cut of
511+
// hStrangeCorrelationFilter.cxx, which uses exactly these two columns.
512+
float dcaXY = 0.0f;
513+
float signed1Pt = 0.0f;
506514
};
507515

508516
// First-failing-condition breakdown for the stage3->4 gate ("Trigger track, best collision"
509-
// -> "Trigger in TriggerTracks"). Order mirrors the early-return order of isValidTrigger()
510-
// in hStrangeCorrelationFilter.cxx exactly, so "first reason to fail" means the same thing here.
517+
// -> "Trigger in TriggerTracks"). Order mirrors the order in which hStrangeCorrelationFilter.cxx
518+
// applies its conditions -- the declarative preFilterTracks DCAxy cut first, then the early
519+
// returns of isValidTrigger() -- so "first reason to fail" means the same thing here.
511520
//
512521
// Pass/fail itself is decided by the real TriggerTracks table, not by the replica below;
513522
// the replica only attributes a reason once the table has already said "not in". That keeps
514523
// the Passed bin numerically identical to stage 4 even when the replica's configurables have
515524
// drifted away from the filter's, and routes any such drift into the two dedicated bins.
516525
enum PairLossTriggerTracksFailureReason : int {
517526
PairLossTriggerTracksPassed = 0,
527+
// First, because preFilterTracks is applied to the track table before isValidTrigger() ever
528+
// sees the track, so DCAxy is the earliest condition a trigger candidate can fail.
529+
PairLossTriggerTracksFailDcaXY,
518530
PairLossTriggerTracksFailEta,
519531
PairLossTriggerTracksFailPt,
520532
PairLossTriggerTracksFailCrossedRows,
@@ -533,6 +545,7 @@ struct HStrangeCorrelation {
533545

534546
static constexpr std::array<std::string_view, PairLossTriggerTracksNReasons> PairLossTriggerTracksFailureNames = {
535547
"Passed (really in TriggerTracks)",
548+
"Failed DCAxy prefilter",
536549
"Failed eta window",
537550
"Failed pT window",
538551
"Failed min TPC crossed rows",
@@ -675,15 +688,22 @@ struct HStrangeCorrelation {
675688
.tpcCrossedRows = track.tpcNClsCrossedRows(),
676689
.tpcSharedClusters = track.tpcNClsShared(),
677690
.itsClusters = track.itsNCls(),
678-
.hasLayer0 = static_cast<bool>(TESTBIT(track.itsClusterMap(), 0))};
691+
.hasLayer0 = static_cast<bool>(TESTBIT(track.itsClusterMap(), 0)),
692+
.dcaXY = track.dcaXY(),
693+
.signed1Pt = track.signed1Pt()};
679694
}
680695

681-
// Replicates isValidTrigger() from hStrangeCorrelationFilter.cxx condition-by-condition
682-
// (same early-return order) so that, for a trigger already known to exist in the best
696+
// Replicates preFilterTracks and isValidTrigger() from hStrangeCorrelationFilter.cxx
697+
// condition-by-condition (same order) so that, for a trigger already known to exist in the best
683698
// collision (stage 3), we can tell which single cut is responsible for it not making it
684699
// into the TriggerTracks table (stage 4), instead of only knowing that it failed overall.
685700
int classifyTriggerTracksFailure(PairLossTrackInfo const& info)
686701
{
702+
// Negation of "Filter preFilterTracks = nabs(dcaXY) < dcaXYconstant + dcaXYpTdep * nabs(signed1Pt)":
703+
// same columns, same formula, and >= so that the boundary is rejected exactly as the filter does.
704+
if (std::abs(info.dcaXY) >= pairLossK0Configurations.triggerTracksDcaXYconstant + pairLossK0Configurations.triggerTracksDcaXYpTdep * std::abs(info.signed1Pt)) {
705+
return PairLossTriggerTracksFailDcaXY;
706+
}
687707
if (info.eta > pairLossK0Configurations.triggerTracksEtaMax || info.eta < pairLossK0Configurations.triggerTracksEtaMin) {
688708
return PairLossTriggerTracksFailEta;
689709
}
@@ -2879,22 +2899,35 @@ struct HStrangeCorrelation {
28792899
if (doprocessClosureTest) {
28802900
if (pairLossK0Configurations.doClosureTestStages) {
28812901
// Naming inside ClosureTest/PairLossK0: each folder is one reconstruction
2882-
// requirement imposed on the same truth h-K0 pair.
2883-
// Truth no reconstruction requirement at all
2884-
// AnyTrack trigger must have a reconstructed-track match (any associated collision)
2885-
// AnyTrackK0 K0 must have a reconstructed-V0-candidate match (any associated collision)
2886-
// AnyTrackBoth both requirements at the same time
2887-
// The object-level (pT, eta, phi) spectra of the two individual
2888-
// requirements live in Truth/ and AnyTrack/, since each object is
2889-
// affected by one requirement only.
2902+
// requirement imposed on the same truth h-K0 pair. "Any" means the object
2903+
// must have at least one reconstructed counterpart (a track with a
2904+
// matching MC label for the trigger, a V0 candidate with a matching MC
2905+
// core for the K0) in any reconstructed collision associated with this MC
2906+
// collision, with no quality selection whatsoever.
2907+
// folder trigger K0 processPairLossK0MC stage
2908+
// Truth truth truth PairLossGenPair
2909+
// AnyTrack any truth PairLossTriggerAnyCollision
2910+
// AnyTrackK0 truth any PairLossV0AnyCollision
2911+
// AnyTrackBoth any any both stages at once
2912+
// Every folder has the same three objects -- sameEvent/K0Short, hTrigger,
2913+
// hK0Short -- and each of them is filled at the level its own folder
2914+
// prescribes, so a folder can be normalised without looking at any other.
2915+
// Consequence: the single-particle spectra repeat across folders in pairs
2916+
// (Truth/hTrigger == AnyTrackK0/hTrigger, AnyTrack/hTrigger ==
2917+
// AnyTrackBoth/hTrigger, Truth/hK0Short == AnyTrack/hK0Short,
2918+
// AnyTrackK0/hK0Short == AnyTrackBoth/hK0Short). That is intended.
28902919
histos.add("ClosureTest/PairLossK0/Truth/sameEvent/K0Short", "truth h-K0 pairs with the processPairLossK0MC selections", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
28912920
histos.add("ClosureTest/PairLossK0/AnyTrack/sameEvent/K0Short", "truth h-K0 pairs whose truth trigger has a reconstructed-track match in any associated collision", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
28922921
histos.add("ClosureTest/PairLossK0/AnyTrackK0/sameEvent/K0Short", "truth h-K0 pairs whose truth K0 has a V0-candidate match in any associated collision", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
28932922
histos.add("ClosureTest/PairLossK0/AnyTrackBoth/sameEvent/K0Short", "truth h-K0 pairs with both the trigger track match and the K0 V0-candidate match in any associated collision", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim});
28942923
histos.add("ClosureTest/PairLossK0/Truth/hTrigger", "truth triggers with the processPairLossK0MC selections;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
28952924
histos.add("ClosureTest/PairLossK0/Truth/hK0Short", "truth K0s with the processPairLossK0MC selections;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
28962925
histos.add("ClosureTest/PairLossK0/AnyTrack/hTrigger", "truth triggers with a reconstructed-track match in any associated collision;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
2897-
histos.add("ClosureTest/PairLossK0/AnyTrack/hK0Short", "truth K0s with a V0-candidate match in any associated collision;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
2926+
histos.add("ClosureTest/PairLossK0/AnyTrack/hK0Short", "truth K0s; the K0 stays at truth level in this folder;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
2927+
histos.add("ClosureTest/PairLossK0/AnyTrackK0/hTrigger", "truth triggers; the trigger stays at truth level in this folder;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
2928+
histos.add("ClosureTest/PairLossK0/AnyTrackK0/hK0Short", "truth K0s with a V0-candidate match in any associated collision;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
2929+
histos.add("ClosureTest/PairLossK0/AnyTrackBoth/hTrigger", "truth triggers with a reconstructed-track match in any associated collision;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
2930+
histos.add("ClosureTest/PairLossK0/AnyTrackBoth/hK0Short", "truth K0s with a V0-candidate match in any associated collision;#it{p}_{T}^{truth} (GeV/#it{c});#eta^{truth};#varphi^{truth}", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi});
28982931
}
28992932
for (int i = 0; i < AssocParticleTypes; i++) {
29002933
if (TESTBIT(doCorrelation, i)) {
@@ -5199,16 +5232,24 @@ struct HStrangeCorrelation {
51995232
pairLossTruthTriggers.push_back(leadingTriggerCopy);
52005233
}
52015234

5235+
// One entry per object per folder, at the level that folder prescribes:
5236+
// the trigger is at truth level in Truth/ and AnyTrackK0/, at any level in
5237+
// AnyTrack/ and AnyTrackBoth/; the K0 is at truth level in Truth/ and
5238+
// AnyTrack/, at any level in AnyTrackK0/ and AnyTrackBoth/.
52025239
for (auto const& truthTrigger : pairLossTruthTriggers) {
52035240
histos.fill(HIST("ClosureTest/PairLossK0/Truth/hTrigger"), truthTrigger.pt, truthTrigger.eta, truthTrigger.phi);
5241+
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrackK0/hTrigger"), truthTrigger.pt, truthTrigger.eta, truthTrigger.phi);
52045242
if (pairLossAnyTrackMcParticleIds.find(truthTrigger.globalIndex) != pairLossAnyTrackMcParticleIds.end()) {
52055243
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrack/hTrigger"), truthTrigger.pt, truthTrigger.eta, truthTrigger.phi);
5244+
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrackBoth/hTrigger"), truthTrigger.pt, truthTrigger.eta, truthTrigger.phi);
52065245
}
52075246
}
52085247
for (auto const& truthK0 : pairLossTruthK0s) {
52095248
histos.fill(HIST("ClosureTest/PairLossK0/Truth/hK0Short"), truthK0.pt, truthK0.eta, truthK0.phi);
5249+
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrack/hK0Short"), truthK0.pt, truthK0.eta, truthK0.phi);
52105250
if (pairLossAnyV0McParticleIds.find(truthK0.globalIndex) != pairLossAnyV0McParticleIds.end()) {
5211-
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrack/hK0Short"), truthK0.pt, truthK0.eta, truthK0.phi);
5251+
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrackK0/hK0Short"), truthK0.pt, truthK0.eta, truthK0.phi);
5252+
histos.fill(HIST("ClosureTest/PairLossK0/AnyTrackBoth/hK0Short"), truthK0.pt, truthK0.eta, truthK0.phi);
52125253
}
52135254
}
52145255

0 commit comments

Comments
 (0)