Skip to content

Commit ce757e4

Browse files
authored
[PWGLF] Fixed motherparts bug and Signal Splitting Feeddown (#18756)
1 parent 189ef40 commit ce757e4

1 file changed

Lines changed: 46 additions & 89 deletions

File tree

‎PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx‎

Lines changed: 46 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ static std::vector<std::string> antilambdaPtBins;
6868
std::vector<std::shared_ptr<TH2>> kaonSplit;
6969
std::vector<std::shared_ptr<TH2>> lambdaSplit;
7070
std::vector<std::shared_ptr<TH2>> antilambdaSplit;
71-
std::vector<std::shared_ptr<TH2>> kaonSplitFeeddown;
72-
std::vector<std::shared_ptr<TH2>> lambdaSplitFeeddown;
73-
std::vector<std::shared_ptr<TH2>> antilambdaSplitFeeddown;
7471
} // namespace pthistos
7572
using namespace o2;
7673
using namespace o2::framework;
@@ -227,15 +224,12 @@ struct V0PtInvMassPlots {
227224
int nLambdaHistograms = pthistos::lambdaPtBins.size() - 1;
228225
int nAntilambdaHistograms = pthistos::antilambdaPtBins.size() - 1;
229226

230-
pthistos::kaonPt.resize(nKaonHistograms); // number of Kaon Pt histograms to expect
231-
pthistos::lambdaPt.resize(nLambdaHistograms); // number of Lambda histograms to expect
232-
pthistos::antilambdaPt.resize(nAntilambdaHistograms); // number of AntiLambda histograms to expect
233-
pthistos::kaonSplit.resize(nKaonHistograms); // number of Kaon Split Pt histograms to expect
234-
pthistos::lambdaSplit.resize(nLambdaHistograms); // number of Lambda Split Pt histograms to expect
235-
pthistos::antilambdaSplit.resize(nAntilambdaHistograms); // number of AntiLambda Split Pt histograms to expect
236-
pthistos::kaonSplitFeeddown.resize(nKaonHistograms); // number of Kaon Split Pt histograms to expect
237-
pthistos::lambdaSplitFeeddown.resize(nLambdaHistograms); // number of Lambda Split Pt histograms to expect
238-
pthistos::antilambdaSplitFeeddown.resize(nAntilambdaHistograms); // number of AntiLambda Split Pt histograms to expect
227+
pthistos::kaonPt.resize(nKaonHistograms); // number of Kaon Pt histograms to expect
228+
pthistos::lambdaPt.resize(nLambdaHistograms); // number of Lambda histograms to expect
229+
pthistos::antilambdaPt.resize(nAntilambdaHistograms); // number of AntiLambda histograms to expect
230+
pthistos::kaonSplit.resize(nKaonHistograms); // number of Kaon Split Pt histograms to expect
231+
pthistos::lambdaSplit.resize(nLambdaHistograms); // number of Lambda Split Pt histograms to expect
232+
pthistos::antilambdaSplit.resize(nAntilambdaHistograms); // number of AntiLambda Split Pt histograms to expect
239233

240234
// initialize and convert tokenized strings into vector of doubles for AxisSpec
241235
std::vector<double> kaonptedgevalues(pthistos::kaonPtBins.size());
@@ -316,7 +310,6 @@ struct V0PtInvMassPlots {
316310
for (int i = 0; i < nKaonHistograms; i++) {
317311
pthistos::kaonPt[i] = rK0shMassPlotsPerPtBin.add<TH2>(fmt::format("hK0shPt_vs_Cent_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("K0s mass vs centrality, pT from {0} to {1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH2D, {{k0ShortMassAxis}, {centAxis}}});
318312
pthistos::kaonSplit[i] = rK0shSplitMassPlotsPerPtBin.add<TH2>(fmt::format("hK0shSplitPt_vs_Cent_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("Split K0s mass vs centrality, pT from {0} to {1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH2D, {{k0ShortMassAxis}, {centAxis}}});
319-
pthistos::kaonSplitFeeddown[i] = rK0shSplitMassPlotsPerPtBin.add<TH2>(fmt::format("hK0shSplitFeeddownPt_vs_Cent_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("Feeddown Split K0s mass vs centrality, pT from {0} to {1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH2D, {{k0ShortMassAxis}, {centAxis}}});
320313
}
321314
rFeeddownMatrices.add("hK0shFeeddownMatrix", "hK0shFeeddownMatrix", {HistType::kTH3D, {k0ShortPtAxis, k0ShortPtAxis, centAxis}});
322315
rFeeddownMatrices.add("hK0shPhiFeeddownMatrix", "hK0shPhiFeeddownMatrix", {HistType::kTH3D, {k0ShortPtAxis, k0ShortPtAxis, centAxis}});
@@ -337,7 +330,6 @@ struct V0PtInvMassPlots {
337330
for (int i = 0; i < nLambdaHistograms; i++) {
338331
pthistos::lambdaPt[i] = rLambdaMassPlotsPerPtBin.add<TH2>(fmt::format("hLambdaPt_vs_Cent_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("Lambda mass vs centrality, pT from {0} to {1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH2D, {{lambdaMassAxis}, {centAxis}}});
339332
pthistos::lambdaSplit[i] = rLambdaSplitMassPlotsPerPtBin.add<TH2>(fmt::format("hLambdaSplitPt_vs_Cent_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("Split Lambda mass vs centrality, pT from {0} to {1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH2D, {{lambdaMassAxis}, {centAxis}}});
340-
pthistos::lambdaSplitFeeddown[i] = rLambdaSplitMassPlotsPerPtBin.add<TH2>(fmt::format("hLambdaSplitFeeddownPt_vs_Cent_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("Feeddown Split Lambda mass vs centrality, pT from {0} to {1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH2D, {{lambdaMassAxis}, {centAxis}}});
341333
}
342334
// lambdafeeddown matrices
343335
rFeeddownMatrices.add("hLambdaFeeddownMatrix", "hLambdaFeeddownMatrix", {HistType::kTH3D, {lambdaPtAxis, lambdaPtAxis, centAxis}});
@@ -360,7 +352,6 @@ struct V0PtInvMassPlots {
360352
for (int i = 0; i < nAntilambdaHistograms; i++) {
361353
pthistos::antilambdaPt[i] = rAntilambdaMassPlotsPerPtBin.add<TH2>(fmt::format("hAntiLambdaPt_vs_Cent_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("AntiLambda mass vs centrality, pT from {0} to {1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH2D, {{antiLambdaMassAxis}, {centAxis}}});
362354
pthistos::antilambdaSplit[i] = rAntilambdaSplitMassPlotsPerPtBin.add<TH2>(fmt::format("hAntiLambdaSplitPt_vs_Cent_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("Split AntiLambda mass vs centrality, pT from {0} to {1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH2D, {{antiLambdaMassAxis}, {centAxis}}});
363-
pthistos::antilambdaSplitFeeddown[i] = rAntilambdaSplitMassPlotsPerPtBin.add<TH2>(fmt::format("hAntiLambdaSplitFeeddownPt_vs_Cent_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("Feeddown Split AntiLambda mass vs centrality, pT from {0} to {1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH2D, {{antiLambdaMassAxis}, {centAxis}}});
364355
}
365356
// antilambdafeeddown matrices
366357
rFeeddownMatrices.add("hAntiLambdaFeeddownMatrix", "hAntiLambdaFeeddownMatrix", {HistType::kTH3D, {antilambdaPtAxis, antilambdaPtAxis, centAxis}});
@@ -1033,13 +1024,6 @@ struct V0PtInvMassPlots {
10331024
}
10341025
}
10351026
if (!v0mcParticle.isPhysicalPrimary()) {
1036-
// Split Feeddown Start
1037-
for (int i = 0; i < nKaonHistograms; i++) {
1038-
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) {
1039-
pthistos::kaonSplitFeeddown[i]->Fill(v0.mK0Short(), mcCollision.centFT0M());
1040-
}
1041-
}
1042-
// Split Feeddown End
10431027
auto v0mothers = v0mcParticle.mothers_as<aod::McParticles>(); // Get mothers
10441028
if (!v0mothers.empty()) {
10451029
auto& v0mcParticleMother = v0mothers.front(); // First mother
@@ -1074,13 +1058,6 @@ struct V0PtInvMassPlots {
10741058
}
10751059
}
10761060
if (!v0mcParticle.isPhysicalPrimary()) {
1077-
// Split Feeddown Start
1078-
for (int i = 0; i < nLambdaHistograms; i++) {
1079-
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1080-
pthistos::lambdaSplitFeeddown[i]->Fill(v0.mLambda(), mcCollision.centFT0M());
1081-
}
1082-
}
1083-
// Split Feeddown End
10841061
auto v0mothers = v0mcParticle.mothers_as<aod::McParticles>(); // Get mothers
10851062
if (!v0mothers.empty()) {
10861063
auto& v0mcParticleMother = v0mothers.front(); // First mother
@@ -1121,13 +1098,6 @@ struct V0PtInvMassPlots {
11211098
}
11221099
}
11231100
if (!v0mcParticle.isPhysicalPrimary()) {
1124-
// Split Feeddown Start
1125-
for (int i = 0; i < nAntilambdaHistograms; i++) {
1126-
if (antilambdaptedgevalues[i] <= v0.pt() && v0.pt() < antilambdaptedgevalues[i + 1]) {
1127-
pthistos::antilambdaSplitFeeddown[i]->Fill(v0.mAntiLambda(), mcCollision.centFT0M());
1128-
}
1129-
}
1130-
// Split Feeddown End
11311101
auto v0mothers = v0mcParticle.mothers_as<aod::McParticles>(); // Get mothers
11321102
if (!v0mothers.empty()) {
11331103
auto& v0mcParticleMother = v0mothers.front(); // First mother
@@ -1303,6 +1273,7 @@ struct V0PtInvMassPlots {
13031273
soa::Join<aod::StraMCCollisions, aod::McCentFT0Ms> const& /*mcCollisions*/,
13041274
soa::Join<aod::V0CollRefs, aod::V0Cores, aod::V0Extras, aod::V0CoreMCLabels, aod::V0MCMothers> const& V0s,
13051275
aod::V0MCCores const&,
1276+
aod::MotherMCParts const&,
13061277
DaughterTracksDerived const&)
13071278
{
13081279
// tokenise strings into individual values
@@ -1349,31 +1320,26 @@ struct V0PtInvMassPlots {
13491320
// K0sh Analysis
13501321
if (kzeroAnalysis == true) {
13511322
if (acceptK0sh(v0, posDaughterTrack, negDaughterTrack, mcCollision)) { // K0sh Selection
1352-
// K0sh Signal Split Numerator Start
1353-
for (int i = 0; i < nKaonHistograms; i++) {
1354-
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges for K0sh Splitting Numerator
1355-
pthistos::kaonSplit[i]->Fill(v0.mK0Short(), mcCollision.centFT0M()); // filling the k0s namespace histograms for K0sh Splitting Numerator
1356-
}
1357-
}
1358-
// K0sh SignaL Split Numerator End
13591323
if (v0.has_v0MCCore()) {
13601324
auto v0mcParticle = v0.v0MCCore_as<aod::V0MCCores>();
1361-
if (k0shSelection.dotruthK0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched
1362-
if (v0mcParticle.isPhysicalPrimary()) {
1325+
if (v0mcParticle.isPhysicalPrimary()) {
1326+
// K0sh Signal Split Numerator Start
1327+
for (int i = 0; i < nKaonHistograms; i++) {
1328+
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges for K0sh Splitting Numerator
1329+
pthistos::kaonSplit[i]->Fill(v0.mK0Short(), mcCollision.centFT0M()); // filling the k0s namespace histograms for K0sh Splitting Numerator
1330+
}
1331+
}
1332+
// K0sh SignaL Split Numerator End
1333+
if (k0shSelection.dotruthK0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched
13631334
for (int i = 0; i < nKaonHistograms; i++) {
13641335
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges
13651336
pthistos::kaonPt[i]->Fill(v0.mK0Short(), mcCollision.centFT0M()); // filling the k0s namespace histograms
13661337
}
13671338
}
13681339
}
1369-
if (!v0mcParticle.isPhysicalPrimary()) {
1370-
// Split Feeddown Start
1371-
for (int i = 0; i < nKaonHistograms; i++) {
1372-
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) {
1373-
pthistos::kaonSplitFeeddown[i]->Fill(v0.mK0Short(), mcCollision.centFT0M());
1374-
}
1375-
}
1376-
// Split Feeddown End
1340+
}
1341+
if (!v0mcParticle.isPhysicalPrimary()) {
1342+
if (v0.has_motherMCPart()) {
13771343
auto v0mother = v0.motherMCPart(); // Get mothers
13781344
rFeeddownMatrices.fill(HIST("hK0shPhiFeeddownMatrix"), v0mcParticle.ptMC(), std::hypot(v0mother.px(), v0mother.py()), mcCollision.centFT0M());
13791345
if (v0mother.pdgCode() == kPhi) { // Phi Mother Matched
@@ -1387,32 +1353,27 @@ struct V0PtInvMassPlots {
13871353
// Lambda analysis
13881354
if (lambdaAnalysis == true) {
13891355
if (acceptLambda(v0, posDaughterTrack, negDaughterTrack, mcCollision)) { // Lambda Selections
1390-
// Lambda Signal Split Numerator Start
1391-
for (int i = 0; i < nLambdaHistograms; i++) {
1392-
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1393-
pthistos::lambdaSplit[i]->Fill(v0.mLambda(), mcCollision.centFT0M());
1394-
}
1395-
}
1396-
// Lambda Signal Split Numerator End
13971356
if (v0.has_v0MCCore()) {
13981357
auto v0mcParticle = v0.v0MCCore_as<aod::V0MCCores>();
1399-
if (lambdaSelection.dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched
1400-
if (v0mcParticle.isPhysicalPrimary()) {
1401-
for (int i = 0; i < nLambdaHistograms; i++) {
1402-
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1403-
pthistos::lambdaPt[i]->Fill(v0.mLambda(), mcCollision.centFT0M());
1404-
}
1358+
if (v0mcParticle.isPhysicalPrimary()) {
1359+
// Lambda Signal Split Numerator Start
1360+
for (int i = 0; i < nLambdaHistograms; i++) {
1361+
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1362+
pthistos::lambdaSplit[i]->Fill(v0.mLambda(), mcCollision.centFT0M());
14051363
}
14061364
}
1407-
if (!v0mcParticle.isPhysicalPrimary()) {
1408-
// Split Feeddown Start
1365+
// Lambda Signal Split Numerator End
1366+
if (lambdaSelection.dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched
14091367
for (int i = 0; i < nLambdaHistograms; i++) {
14101368
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1411-
pthistos::lambdaSplitFeeddown[i]->Fill(v0.mLambda(), mcCollision.centFT0M());
1369+
pthistos::lambdaPt[i]->Fill(v0.mLambda(), mcCollision.centFT0M());
14121370
}
14131371
}
1414-
// Split Feeddown End
1415-
auto v0mother = v0.motherMCPart(); // Get mothers
1372+
}
1373+
}
1374+
if (!v0mcParticle.isPhysicalPrimary()) {
1375+
if (v0.has_motherMCPart()) { // Get mothers
1376+
auto v0mother = v0.motherMCPart();
14161377
rFeeddownMatrices.fill(HIST("hLambdaFeeddownMatrix"), v0mcParticle.ptMC(), std::hypot(v0mother.px(), v0mother.py()), mcCollision.centFT0M());
14171378
if (v0mother.pdgCode() == kXiMinus) { // Xi Minus Mother Matched
14181379
rFeeddownMatrices.fill(HIST("hLambdaXiMinusFeeddownMatrix"), v0mcParticle.ptMC(), std::hypot(v0mother.px(), v0mother.py()), mcCollision.centFT0M());
@@ -1431,31 +1392,26 @@ struct V0PtInvMassPlots {
14311392
// AntiLambda analysis
14321393
if (antiLambdaAnalysis == true) {
14331394
if (acceptAntilambda(v0, posDaughterTrack, negDaughterTrack, mcCollision)) { // AntiLambda Selections
1434-
// AntiLambda Signal Split Numerator Start
1435-
for (int i = 0; i < nAntilambdaHistograms; i++) {
1436-
if (antilambdaptedgevalues[i] <= v0.pt() && v0.pt() < antilambdaptedgevalues[i + 1]) {
1437-
pthistos::antilambdaSplit[i]->Fill(v0.mAntiLambda(), mcCollision.centFT0M());
1438-
}
1439-
}
1440-
// AntiLambda Signal Split Numerator End
14411395
if (v0.has_v0MCCore()) {
14421396
auto v0mcParticle = v0.v0MCCore_as<aod::V0MCCores>();
1443-
if (antilambdaSelection.dotruthAntiLambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched
1444-
if (v0mcParticle.isPhysicalPrimary()) {
1445-
for (int i = 0; i < nAntilambdaHistograms; i++) {
1446-
if (antilambdaptedgevalues[i] <= v0.pt() && v0.pt() < antilambdaptedgevalues[i + 1]) {
1447-
pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda(), mcCollision.centFT0M());
1448-
}
1397+
if (v0mcParticle.isPhysicalPrimary()) {
1398+
// AntiLambda Signal Split Numerator Start
1399+
for (int i = 0; i < nAntilambdaHistograms; i++) {
1400+
if (antilambdaptedgevalues[i] <= v0.pt() && v0.pt() < antilambdaptedgevalues[i + 1]) {
1401+
pthistos::antilambdaSplit[i]->Fill(v0.mAntiLambda(), mcCollision.centFT0M());
14491402
}
14501403
}
1451-
if (!v0mcParticle.isPhysicalPrimary()) {
1452-
// Split Feeddown Start
1404+
// AntiLambda Signal Split Numerator End
1405+
if (antilambdaSelection.dotruthAntiLambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched
14531406
for (int i = 0; i < nAntilambdaHistograms; i++) {
14541407
if (antilambdaptedgevalues[i] <= v0.pt() && v0.pt() < antilambdaptedgevalues[i + 1]) {
1455-
pthistos::antilambdaSplitFeeddown[i]->Fill(v0.mAntiLambda(), mcCollision.centFT0M());
1408+
pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda(), mcCollision.centFT0M());
14561409
}
14571410
}
1458-
// Split Feeddown End
1411+
}
1412+
}
1413+
if (!v0mcParticle.isPhysicalPrimary()) {
1414+
if (v0.has_motherMCPart()) {
14591415
auto v0mother = v0.motherMCPart(); // Get mothers
14601416
rFeeddownMatrices.fill(HIST("hAntiLambdaFeeddownMatrix"), v0mcParticle.ptMC(), std::hypot(v0mother.px(), v0mother.py()), mcCollision.centFT0M());
14611417
if (v0mother.pdgCode() == kXiPlusBar) { // Xi Plus Mother Matched
@@ -1565,13 +1521,14 @@ struct V0PtInvMassPlots {
15651521
rMCCorrections.fill(HIST("hNEvents_Corrections"), 3.5, mcCollision.centFT0M()); // Selected reconstructed collisions
15661522
if (collision.multNTracksPVeta1() > 0) {
15671523
hasSelectedInelGt0Collision = true;
1524+
rMCCorrections.fill(HIST("hNEvents_Corrections"), 4.5, mcCollision.centFT0M());
15681525
}
15691526
}
15701527

15711528
if (!hasSelectedInelGt0Collision) {
15721529
return;
15731530
}
1574-
1531+
rMCCorrections.fill(HIST("hNEvents_Corrections"), 5.5, mcCollision.centFT0M());
15751532
// Fill the signal-loss numerator once per MC collision.
15761533
for (const auto& v0 : V0s) {
15771534
if (!v0.isPhysicalPrimary()) {

0 commit comments

Comments
 (0)