Skip to content

Commit ceeb8ed

Browse files
committed
Safeguard check on efficiencies
1 parent 453532d commit ceeb8ed

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,13 @@ struct Phik0shortanalysis {
25152515
isCountedPhi = true;
25162516
}
25172517

2518-
float weightPhi = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity())) : 1.0f;
2518+
float efficiencyPhi = 1.0f;
2519+
if (applyEfficiency) {
2520+
efficiencyPhi = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity());
2521+
if (efficiencyPhi == 0)
2522+
efficiencyPhi = 1.0f;
2523+
}
2524+
float weightPhi = applyEfficiency ? 1.0f / efficiencyPhi : 1.0f;
25192525
dataPhiHist.fill(HIST("h3PhiDataNewProc"), multiplicity, recPhi.Pt(), recPhi.M(), weightPhi);
25202526

25212527
// V0 already reconstructed by the builder
@@ -2543,7 +2549,13 @@ struct Phik0shortanalysis {
25432549
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
25442550
continue;
25452551

2546-
float weightPhiK0S = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(multiplicity, v0.pt(), v0.yK0Short())) : 1.0f;
2552+
float efficiencyPhiK0S = 1.0f;
2553+
if (applyEfficiency) {
2554+
efficiencyPhiK0S = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(multiplicity, v0.pt(), v0.yK0Short());
2555+
if (efficiencyPhiK0S == 0)
2556+
efficiencyPhiK0S = 1.0f;
2557+
}
2558+
float weightPhiK0S = applyEfficiency ? 1.0f / efficiencyPhiK0S : 1.0f;
25472559
dataPhiK0SHist.fill(HIST("h5PhiK0SDataNewProc"), v0.yK0Short() - recPhi.Rapidity(), multiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), weightPhiK0S);
25482560
}
25492561

@@ -2559,7 +2571,13 @@ struct Phik0shortanalysis {
25592571

25602572
float nSigmaTOFPi = (track.hasTOF() ? track.tofNSigmaPi() : -999);
25612573

2562-
float weightPhiPion = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(multiplicity, track.pt(), track.rapidity(massPi))) : 1.0f;
2574+
float efficiencyPhiPion = 1.0f;
2575+
if (applyEfficiency) {
2576+
efficiencyPhiPion = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(multiplicity, track.pt(), track.rapidity(massPi));
2577+
if (efficiencyPhiPion == 0)
2578+
efficiencyPhiPion = 1.0f;
2579+
}
2580+
float weightPhiPion = applyEfficiency ? 1.0f / efficiencyPhiPion : 1.0f;
25632581
dataPhiPionHist.fill(HIST("h6PhiPiDataNewProc"), track.rapidity(massPi) - recPhi.Rapidity(), multiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), weightPhiPion);
25642582
}
25652583
}
@@ -2615,7 +2633,13 @@ struct Phik0shortanalysis {
26152633
isCountedPhi = true;
26162634
}
26172635

2618-
float weightPhi = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity())) : 1.0f;
2636+
float efficiencyPhi = 1.0f;
2637+
if (applyEfficiency) {
2638+
efficiencyPhi = effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity());
2639+
if (efficiencyPhi == 0)
2640+
efficiencyPhi = 1.0f;
2641+
}
2642+
float weightPhi = applyEfficiency ? 1.0f / efficiencyPhi : 1.0f;
26192643
closureMCPhiHist.fill(HIST("h3PhiMCClosureNewProc"), genmultiplicity, recPhi.Pt(), recPhi.M(), weightPhi);
26202644

26212645
// V0 already reconstructed by the builder
@@ -2639,7 +2663,13 @@ struct Phik0shortanalysis {
26392663
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
26402664
continue;
26412665

2642-
float weightPhiK0S = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(genmultiplicity, v0.pt(), v0.yK0Short())) : 1.0f;
2666+
float efficiencyPhiK0S = 1.0f;
2667+
if (applyEfficiency) {
2668+
efficiencyPhiK0S = effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(genmultiplicity, v0.pt(), v0.yK0Short());
2669+
if (efficiencyPhiK0S == 0)
2670+
efficiencyPhiK0S = 1.0f;
2671+
}
2672+
float weightPhiK0S = applyEfficiency ? 1.0f / efficiencyPhiK0S : 1.0f;
26432673
closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosureNewProc"), v0.yK0Short() - recPhi.Rapidity(), genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), weightPhiK0S);
26442674
}
26452675

@@ -2661,7 +2691,13 @@ struct Phik0shortanalysis {
26612691

26622692
float nSigmaTOFPi = (track.hasTOF() ? track.tofNSigmaPi() : -999);
26632693

2664-
float weightPhiPion = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(genmultiplicity, track.pt(), track.rapidity(massPi))) : 1.0f;
2694+
float efficiencyPhiPion = 1.0f;
2695+
if (applyEfficiency) {
2696+
efficiencyPhiPion = effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(genmultiplicity, track.pt(), track.rapidity(massPi));
2697+
if (efficiencyPhiPion == 0)
2698+
efficiencyPhiPion = 1.0f;
2699+
}
2700+
float weightPhiPion = applyEfficiency ? 1.0f / efficiencyPhiPion : 1.0f;
26652701
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosureNewProc"), track.rapidity(massPi) - recPhi.Rapidity(), genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), weightPhiPion);
26662702
}
26672703
}

0 commit comments

Comments
 (0)