Skip to content

Commit 403fe6c

Browse files
nkaratzenkaratze
andauthored
[PWGLF] Signal Split Correction and Small Changes (#13551)
Co-authored-by: nkaratze <nxk335@student.bham.ac.uk>
1 parent aacbe99 commit 403fe6c

File tree

1 file changed

+63
-29
lines changed

1 file changed

+63
-29
lines changed

PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ std::vector<std::shared_ptr<TH1>> lambdaPt;
4848
static std::vector<std::string> lambdaPtBins;
4949
std::vector<std::shared_ptr<TH1>> antilambdaPt;
5050
static std::vector<std::string> antilambdaPtBins;
51+
std::vector<std::shared_ptr<TH1>> kaonSplit;
52+
std::vector<std::shared_ptr<TH1>> lambdaSplit;
53+
std::vector<std::shared_ptr<TH1>> antilambdaSplit;
5154
} // namespace pthistos
5255
using namespace o2;
5356
using namespace o2::framework;
@@ -60,6 +63,9 @@ struct V0PtInvMassPlots {
6063
HistogramRegistry rKaonshMassPlotsPerPtBin{"KaonshMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
6164
HistogramRegistry rLambdaMassPlotsPerPtBin{"LambdaMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
6265
HistogramRegistry rAntilambdaMassPlotsPerPtBin{"AntilambdaMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
66+
HistogramRegistry rKaonshSplitMassPlotsPerPtBin{"KaonshSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
67+
HistogramRegistry rLambdaSplitMassPlotsPerPtBin{"LambdaSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
68+
HistogramRegistry rAntilambdaSplitMassPlotsPerPtBin{"AntilambdaSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
6369
HistogramRegistry rFeeddownMatrices{"FeeddownMatrices", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
6470
HistogramRegistry rMCCorrections{"MCCorrections", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
6571

@@ -169,9 +175,12 @@ struct V0PtInvMassPlots {
169175

170176
void init(InitContext const&)
171177
{
172-
pthistos::kaonPt.resize(nmaxHistograms); // number of Kaon Pt histograms to expect
173-
pthistos::lambdaPt.resize(nmaxHistograms); // number of Lambda histograms to expect
174-
pthistos::antilambdaPt.resize(nmaxHistograms); // number of Antilambda histograms to expect
178+
pthistos::kaonPt.resize(nmaxHistograms); // number of Kaon Pt histograms to expect
179+
pthistos::lambdaPt.resize(nmaxHistograms); // number of Lambda histograms to expect
180+
pthistos::antilambdaPt.resize(nmaxHistograms); // number of Antilambda histograms to expect
181+
pthistos::kaonSplit.resize(nmaxHistograms); // number of Kaon Split Pt histograms to expect
182+
pthistos::lambdaSplit.resize(nmaxHistograms); // number of Lambda Split Pt histograms to expect
183+
pthistos::antilambdaSplit.resize(nmaxHistograms); // number of Antilambda Split Pt histograms to expect
175184
// tokenise strings into individual values
176185
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
177186
pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ',');
@@ -202,7 +211,7 @@ struct V0PtInvMassPlots {
202211
std::vector<std::string> kaonhistvalue(nmaxHistograms + 1);
203212
std::vector<std::string> lambdahistvalue(nmaxHistograms + 1);
204213
std::vector<std::string> antilambdahistvalue(nmaxHistograms + 1);
205-
// K0short Histogram Pt Bin Edges
214+
// K0short Histogram Pt Bin Edges (and Split)
206215
for (int i = 0; i < nmaxHistograms + 1; i++) { // Histos won't accept "." character so converting it to "_"
207216
std::string kaonptbin = pthistos::kaonPtBins[i]; // getting the value of the bin edge
208217
size_t pos = kaonptbin.find("."); // finding the "." character
@@ -249,6 +258,7 @@ struct V0PtInvMassPlots {
249258
rPtAnalysis.add("hK0shDCANegDaughter", "hK0shDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}});
250259
for (int i = 0; i < nmaxHistograms; i++) {
251260
pthistos::kaonPt[i] = rKaonshMassPlotsPerPtBin.add<TH1>(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}});
261+
pthistos::kaonSplit[i] = rKaonshSplitMassPlotsPerPtBin.add<TH1>(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}});
252262
}
253263
rFeeddownMatrices.add("hK0shFeeddownMatrix", "hK0shFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}});
254264
rFeeddownMatrices.add("hK0shPhiFeeddownMatrix", "hK0shPhiFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}});
@@ -268,6 +278,7 @@ struct V0PtInvMassPlots {
268278
rPtAnalysis.add("hLambdaDCANegDaughter", "hLambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}});
269279
for (int i = 0; i < nmaxHistograms; i++) {
270280
pthistos::lambdaPt[i] = rLambdaMassPlotsPerPtBin.add<TH1>(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}});
281+
pthistos::lambdaSplit[i] = rLambdaSplitMassPlotsPerPtBin.add<TH1>(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}});
271282
}
272283
// lambdafeeddown matrices
273284
rFeeddownMatrices.add("hLambdaFeeddownMatrix", "hLambdaFeeddownMatrix", {HistType::kTH2F, {{lambdaPtAxis}, {lambdaPtAxis}}});
@@ -290,6 +301,7 @@ struct V0PtInvMassPlots {
290301
rPtAnalysis.add("hAntilambdaDCANegDaughter", "hAntilambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}});
291302
for (int i = 0; i < nmaxHistograms; i++) {
292303
pthistos::antilambdaPt[i] = rAntilambdaMassPlotsPerPtBin.add<TH1>(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}});
304+
pthistos::antilambdaSplit[i] = rAntilambdaSplitMassPlotsPerPtBin.add<TH1>(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}});
293305
}
294306
// antilambdafeeddown matrices
295307
rFeeddownMatrices.add("hAntiLambdaFeeddownMatrix", "hAntiLambdaFeeddownMatrix", {HistType::kTH2F, {{antilambdaPtAxis}, {antilambdaPtAxis}}});
@@ -299,12 +311,7 @@ struct V0PtInvMassPlots {
299311
}
300312

301313
// Particle Level Corrections
302-
rMCCorrections.add("hK0ShSplitDenominatorPtSpectrum", "hK0ShSplitDenominatorPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}});
303-
rMCCorrections.add("hLambdaSplitDenominatorPtSpectrum", "hLambdaSplitDenominatorPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}});
304-
rMCCorrections.add("hAntilambdaSplitDenominatorPtSpectrum", "hAntilambdaSplitDenominatorPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}});
305-
rMCCorrections.add("hK0ShSplitNumenatorPtSpectrum", "hK0ShSplitNumenatorPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}});
306-
rMCCorrections.add("hLambdaSplitNumenatorPtSpectrum", "hLambdaSplitNumenatorPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}});
307-
rMCCorrections.add("hAntilambdaSplitNumenatorPtSpectrum", "hAntilambdaSplitNumenatorPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}});
314+
rMCCorrections.add("hK0ShNoMCParticle", "hK0ShNoMCParticle", {HistType::kTH1D, {k0ShortPtAxis}});
308315
rMCCorrections.add("hK0ShBeforeEventSelectionPtSpectrum", "hK0ShBeforeEventSelectionPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}});
309316
rMCCorrections.add("hLambdaBeforeEventSelectionPtSpectrum", "hLambdaBeforeEventSelectionPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}});
310317
rMCCorrections.add("hAntilambdaBeforeEventSelectionPtSpectrum", "hAntilambdaBeforeEventSelectionPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}});
@@ -771,6 +778,7 @@ struct V0PtInvMassPlots {
771778
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
772779
pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ',');
773780
pthistos::antilambdaPtBins = o2::utils::Str::tokenize(antilambdaSettingPtBinsString, ',');
781+
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
774782

775783
// initialize and convert tokenized strings into vector of doubles for Pt Bin Edges
776784
std::vector<double> kaonptedgevalues(nmaxHistograms + 1);
@@ -789,16 +797,22 @@ struct V0PtInvMassPlots {
789797

790798
for (const auto& v0 : V0s) {
791799
// Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace)
792-
if (v0.has_mcParticle()) {
793-
auto v0mcParticle = v0.mcParticle();
794-
795-
if (!acceptV0(v0)) { // V0 Selections
796-
continue;
797-
}
798-
// kzero analysis
799-
if (kzeroAnalysis == true) {
800-
if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched
801-
if (acceptK0sh(v0)) { // K0sh Selection
800+
if (!acceptV0(v0)) { // V0 Selections
801+
continue;
802+
}
803+
// kzero analysis
804+
if (kzeroAnalysis == true) {
805+
if (acceptK0sh(v0)) { // K0sh Selection
806+
// K0sh Signal Split Numerator Start
807+
for (int i = 0; i < nmaxHistograms; i++) {
808+
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
809+
pthistos::kaonSplit[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms for K0sh Splitting Numerator
810+
}
811+
}
812+
// K0sh Signla Split Numerator End
813+
if (v0.has_mcParticle()) {
814+
auto v0mcParticle = v0.mcParticle();
815+
if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched
802816
if (v0mcParticle.isPhysicalPrimary()) {
803817
for (int i = 0; i < nmaxHistograms; i++) {
804818
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges
@@ -819,10 +833,20 @@ struct V0PtInvMassPlots {
819833
}
820834
}
821835
}
822-
// lambda analysis
823-
if (lambdaAnalysis == true) {
824-
if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched
825-
if (acceptLambda(v0)) { // Lambda Selections
836+
}
837+
// lambda analysis
838+
if (lambdaAnalysis == true) {
839+
if (acceptLambda(v0)) { // Lambda Selections
840+
// Lambda Signal Split Numerator Start
841+
for (int i = 0; i < nmaxHistograms; i++) {
842+
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
843+
pthistos::lambdaSplit[i]->Fill(v0.mLambda());
844+
}
845+
}
846+
// Lambda Signal Split Numerator End
847+
if (v0.has_mcParticle()) {
848+
auto v0mcParticle = v0.mcParticle();
849+
if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched
826850
if (v0mcParticle.isPhysicalPrimary()) {
827851
for (int i = 0; i < nmaxHistograms; i++) {
828852
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
@@ -849,10 +873,20 @@ struct V0PtInvMassPlots {
849873
}
850874
}
851875
}
852-
// antilambda analysis
853-
if (antiLambdaAnalysis == true) {
854-
if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched
855-
if (acceptAntilambda(v0)) { // Antilambda Selections
876+
}
877+
// antilambda analysis
878+
if (antiLambdaAnalysis == true) {
879+
if (acceptAntilambda(v0)) { // Antilambda Selections
880+
// Antilambda Signal Split Numerator End
881+
for (int i = 0; i < nmaxHistograms; i++) {
882+
if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) {
883+
pthistos::antilambdaSplit[i]->Fill(v0.mAntiLambda());
884+
}
885+
}
886+
// Antilambda Signal Split Numerator End
887+
if (v0.has_mcParticle()) {
888+
auto v0mcParticle = v0.mcParticle();
889+
if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched
856890
if (v0mcParticle.isPhysicalPrimary()) {
857891
for (int i = 0; i < nmaxHistograms; i++) {
858892
if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) {
@@ -904,7 +938,7 @@ struct V0PtInvMassPlots {
904938
if (!acceptEvent(collision)) { // Event Selection
905939
return;
906940
}
907-
rPtAnalysis.fill(HIST("hNRecEvents_Data"), 1.0); // Number of Reconstructed Events
941+
rPtAnalysis.fill(HIST("hNRecEvents_Data"), 0.5); // Number of Reconstructed Events
908942

909943
for (const auto& v0 : V0s) {
910944
// Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace)

0 commit comments

Comments
 (0)