Skip to content

Commit 95d40f0

Browse files
nkaratzenxk335-local
andauthored
[PWGLF] PWGLF:v0ptinvmassplots Updated the Generated Pt Spectrum Process (#8259)
Co-authored-by: nxk335-local <nxk335-local@uob239226a.bham.ac.uk>
1 parent a3a45ec commit 95d40f0

File tree

1 file changed

+90
-78
lines changed

1 file changed

+90
-78
lines changed

PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx

Lines changed: 90 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ struct v0ptinvmassplots {
4848

4949
// Configurable for histograms
5050
Configurable<int> nBins{"nBins", 100, "N bins in all histos"};
51+
Configurable<int> xaxisgenbins{"xaxisgenbins", 20, "Number of bins for Generated Pt Spectrum"};
52+
Configurable<float> xaxismingenbin{"xaxismingenbin", 0.0, "Minimum bin value of the Generated Pt Spectrum Plot"};
53+
Configurable<float> xaxismaxgenbin{"xaxismaxgenbin", 3.0, "Maximum bin value of the Generated Pt Spectrum Plot"};
5154

5255
// Configurable Kaonsh Topological Cuts (best cuts determined by v0topologicalcuts task)
5356
Configurable<float> kaonshsetting_dcav0dau{"kaonshsetting_dcav0dau", 100.0, "DCA V0 Daughters"};
@@ -87,7 +90,7 @@ struct v0ptinvmassplots {
8790
AxisSpec LambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{+}#pi^{-} [GeV/#it{c}^{2}]"};
8891
AxisSpec AntiLambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{-}#pi^{+} [GeV/#it{c}^{2}]"};
8992
AxisSpec ptAxis = {nBins, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"};
90-
AxisSpec GenptAxis = {20, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"};
93+
AxisSpec GenptAxis = {xaxisgenbins, xaxismingenbin, xaxismaxgenbin, "#it{p}_{T} (GeV/#it{c})"};
9194

9295
rPtAnalysis.add("hV0PtAll", "hV0PtAll", {HistType::kTH1F, {{nBins, 0.0f, 10.0f}}});
9396

@@ -156,112 +159,121 @@ struct v0ptinvmassplots {
156159
// Defining filters for events (event selection)
157160
// Processed events will be already fulfilling the event selection requirements
158161
Filter eventFilter = (o2::aod::evsel::sel8 == true);
162+
Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < 10.0f);
163+
Filter posZFilter = (nabs(o2::aod::collision::posZ) < 10.0f);
159164

160165
// Defining the type of the daughter tracks
161166
using DaughterTracks = soa::Join<aod::TracksIU, aod::TracksExtra, aod::McTrackLabels>;
162167

163168
// This is the Process for the MC Generated Data
164-
void GenMCprocess(const soa::SmallGroups<soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels, o2::aod::EvSels>>& collisions,
169+
void GenMCprocess(soa::Filtered<aod::McCollisions>::iterator const&,
170+
const soa::SmallGroups<soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels, o2::aod::EvSels>>&,
165171
aod::McParticles const& mcParticles)
166172
{
167173
for (const auto& mcParticle : mcParticles) {
168-
if (mcParticle.pdgCode() == 310) // kzero matched
169-
{
170-
rPtAnalysis.fill(HIST("hK0ShGeneratedPtSpectrum"), mcParticle.pt());
171-
}
172-
if (mcParticle.pdgCode() == 3122) // lambda matched
173-
{
174-
rPtAnalysis.fill(HIST("hLambdaGeneratedPtSpectrum"), mcParticle.pt());
175-
}
176-
if (mcParticle.pdgCode() == -3122) // antilambda matched
177-
{
178-
rPtAnalysis.fill(HIST("hAntilambdaGeneratedPtSpectrum"), mcParticle.pt());
174+
if (mcParticle.isPhysicalPrimary()) {
175+
if (TMath::Abs(mcParticle.y()) < 0.5f) {
176+
if (mcParticle.pdgCode() == 310) // kzero matched
177+
{
178+
rPtAnalysis.fill(HIST("hK0ShGeneratedPtSpectrum"), mcParticle.pt());
179+
}
180+
if (mcParticle.pdgCode() == 3122) // lambda matched
181+
{
182+
rPtAnalysis.fill(HIST("hLambdaGeneratedPtSpectrum"), mcParticle.pt());
183+
}
184+
if (mcParticle.pdgCode() == -3122) // antilambda matched
185+
{
186+
rPtAnalysis.fill(HIST("hAntilambdaGeneratedPtSpectrum"), mcParticle.pt());
187+
}
188+
}
179189
}
180190
}
181191
}
182192
// This is the Process for the MC reconstructed Data
183193
void RecMCprocess(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>::iterator const&,
184194
soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s,
185195
DaughterTracks const&, // no need to define a variable for tracks, if we don't access them directly
186-
aod::McParticles const&)
196+
aod::McParticles const& mcParticles)
187197
{
188198
for (const auto& v0 : V0s) {
189199
rPtAnalysis.fill(HIST("hV0PtAll"), v0.pt());
190200
// 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)
191201
if (v0.has_mcParticle()) {
192202
auto v0mcParticle = v0.mcParticle();
193-
if (kzerosh_analysis == true) {
194-
if (v0mcParticle.pdgCode() == 310) { // kzero matched
195-
rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short());
196-
rPtAnalysis.fill(HIST("hK0ShortPtSpectrumBeforeCuts"), v0.pt());
197-
// Implementing best kzero cuts
198-
if (v0.v0cosPA() > kaonshsetting_cospa && v0.dcaV0daughters() < kaonshsetting_dcav0dau && v0.v0radius() > kaonshsetting_radius && TMath::Abs(v0.dcapostopv()) > kaonshsetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > kaonshsetting_dcanegtopv) {
199-
rPtAnalysis.fill(HIST("hMassK0ShortAllAfterCuts"), v0.mK0Short());
200-
rPtAnalysis.fill(HIST("hK0ShortReconstructedPtSpectrum"), v0.pt());
201-
for (int i = 0; i < 20; i++) {
202-
// getting the pt value in #_# for and converting it to a number #.# for use, we get two values which correspond to the range of each bin
203-
std::string pt1 = pthistos::kaonptbins[i]; // getting the lower string-value of the bin
204-
std::string pt2 = pthistos::kaonptbins[i + 1]; // getting the higher string-value of the bin
205-
size_t pos1 = pt1.find("_"); // finding the "_" character of the lower string-value
206-
size_t pos2 = pt2.find("_"); // finding the "_" character of the higher string-value
207-
pt1[pos1] = '.'; // changing the "_" character of the lower string-value to a "."
208-
pt2[pos2] = '.'; // changing the "_" character of the higher string-value to a "."
209-
const float ptlowervalue = std::stod(pt1); // converting the lower string value to a double
210-
const float pthighervalue = std::stod(pt2); // converting the higher string value to a double
211-
if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { // finding v0s with pt withing the range of our lower and higher value
212-
pthistos::KaonPt[i]->Fill(v0.mK0Short()); // filling the 20 kaon namespace histograms
203+
if (v0mcParticle.isPhysicalPrimary()) {
204+
if (kzerosh_analysis == true) {
205+
if (v0mcParticle.pdgCode() == 310) { // kzero matched
206+
rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short());
207+
rPtAnalysis.fill(HIST("hK0ShortPtSpectrumBeforeCuts"), v0.pt());
208+
// Implementing best kzero cuts
209+
if (v0.v0cosPA() > kaonshsetting_cospa && v0.dcaV0daughters() < kaonshsetting_dcav0dau && v0.v0radius() > kaonshsetting_radius && TMath::Abs(v0.dcapostopv()) > kaonshsetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > kaonshsetting_dcanegtopv) {
210+
rPtAnalysis.fill(HIST("hMassK0ShortAllAfterCuts"), v0.mK0Short());
211+
rPtAnalysis.fill(HIST("hK0ShortReconstructedPtSpectrum"), v0.pt());
212+
for (int i = 0; i < 20; i++) {
213+
// getting the pt value in #_# for and converting it to a number #.# for use, we get two values which correspond to the range of each bin
214+
std::string pt1 = pthistos::kaonptbins[i]; // getting the lower string-value of the bin
215+
std::string pt2 = pthistos::kaonptbins[i + 1]; // getting the higher string-value of the bin
216+
size_t pos1 = pt1.find("_"); // finding the "_" character of the lower string-value
217+
size_t pos2 = pt2.find("_"); // finding the "_" character of the higher string-value
218+
pt1[pos1] = '.'; // changing the "_" character of the lower string-value to a "."
219+
pt2[pos2] = '.'; // changing the "_" character of the higher string-value to a "."
220+
const float ptlowervalue = std::stod(pt1); // converting the lower string value to a double
221+
const float pthighervalue = std::stod(pt2); // converting the higher string value to a double
222+
if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { // finding v0s with pt withing the range of our lower and higher value
223+
pthistos::KaonPt[i]->Fill(v0.mK0Short()); // filling the 20 kaon namespace histograms
224+
}
213225
}
214226
}
215227
}
216228
}
217-
}
218-
// lambda analysis
219-
if (lambda_analysis == true) {
220-
if (v0mcParticle.pdgCode() == 3122) { // lambda matched
221-
rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda());
222-
rPtAnalysis.fill(HIST("hLambdaPtSpectrumBeforeCuts"), v0.pt());
223-
// Implementing best lambda cuts
224-
if (v0.v0cosPA() > lambdasetting_cospa && v0.dcaV0daughters() < lambdasetting_dcav0dau && v0.v0radius() > lambdasetting_radius && TMath::Abs(v0.dcapostopv()) > lambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > lambdasetting_dcanegtopv) {
225-
rPtAnalysis.fill(HIST("hMassLambdaAllAfterCuts"), v0.mLambda());
226-
rPtAnalysis.fill(HIST("hLambdaReconstructedPtSpectrum"), v0.pt());
227-
for (int i = 0; i < 20; i++) {
228-
// same as above with kzerosh we fill the 20 lambda namespace histograms within their Pt range
229-
std::string pt1 = pthistos::lambdaptbins[i];
230-
std::string pt2 = pthistos::lambdaptbins[i + 1];
231-
size_t pos1 = pt1.find("_");
232-
size_t pos2 = pt2.find("_");
233-
pt1[pos1] = '.';
234-
pt2[pos2] = '.';
235-
const float ptlowervalue = std::stod(pt1);
236-
const float pthighervalue = std::stod(pt2);
237-
if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) {
238-
pthistos::LambdaPt[i]->Fill(v0.mLambda());
229+
// lambda analysis
230+
if (lambda_analysis == true) {
231+
if (v0mcParticle.pdgCode() == 3122) { // lambda matched
232+
rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda());
233+
rPtAnalysis.fill(HIST("hLambdaPtSpectrumBeforeCuts"), v0.pt());
234+
// Implementing best lambda cuts
235+
if (v0.v0cosPA() > lambdasetting_cospa && v0.dcaV0daughters() < lambdasetting_dcav0dau && v0.v0radius() > lambdasetting_radius && TMath::Abs(v0.dcapostopv()) > lambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > lambdasetting_dcanegtopv) {
236+
rPtAnalysis.fill(HIST("hMassLambdaAllAfterCuts"), v0.mLambda());
237+
rPtAnalysis.fill(HIST("hLambdaReconstructedPtSpectrum"), v0.pt());
238+
for (int i = 0; i < 20; i++) {
239+
// same as above with kzerosh we fill the 20 lambda namespace histograms within their Pt range
240+
std::string pt1 = pthistos::lambdaptbins[i];
241+
std::string pt2 = pthistos::lambdaptbins[i + 1];
242+
size_t pos1 = pt1.find("_");
243+
size_t pos2 = pt2.find("_");
244+
pt1[pos1] = '.';
245+
pt2[pos2] = '.';
246+
const float ptlowervalue = std::stod(pt1);
247+
const float pthighervalue = std::stod(pt2);
248+
if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) {
249+
pthistos::LambdaPt[i]->Fill(v0.mLambda());
250+
}
239251
}
240252
}
241253
}
242254
}
243-
}
244-
// antilambda analysis
245-
if (antilambda_analysis == true) {
246-
if (v0mcParticle.pdgCode() == -3122) { // antilambda matched
247-
rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda());
248-
rPtAnalysis.fill(HIST("hAntilambdaPtSpectrumBeforeCuts"), v0.pt());
249-
// Implementing best antilambda cuts
250-
if (v0.v0cosPA() > antilambdasetting_cospa && v0.dcaV0daughters() < antilambdasetting_dcav0dau && v0.v0radius() > antilambdasetting_radius && TMath::Abs(v0.dcapostopv()) > antilambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > antilambdasetting_dcanegtopv) {
251-
rPtAnalysis.fill(HIST("hMassAntilambdaAllAfterCuts"), v0.mAntiLambda());
252-
rPtAnalysis.fill(HIST("hAntilambdaReconstructedPtSpectrum"), v0.pt());
253-
for (int i = 0; i < 20; i++) {
254-
// same as above with kzerosh and lambda we fill the 20 anti-lambda namespace histograms within their Pt range
255-
std::string pt1 = pthistos::antilambdaptbins[i];
256-
std::string pt2 = pthistos::antilambdaptbins[i + 1];
257-
size_t pos1 = pt1.find("_");
258-
size_t pos2 = pt2.find("_");
259-
pt1[pos1] = '.';
260-
pt2[pos2] = '.';
261-
const float ptlowervalue = std::stod(pt1);
262-
const float pthighervalue = std::stod(pt2);
263-
if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) {
264-
pthistos::AntilambdaPt[i]->Fill(v0.mAntiLambda());
255+
// antilambda analysis
256+
if (antilambda_analysis == true) {
257+
if (v0mcParticle.pdgCode() == -3122) { // antilambda matched
258+
rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda());
259+
rPtAnalysis.fill(HIST("hAntilambdaPtSpectrumBeforeCuts"), v0.pt());
260+
// Implementing best antilambda cuts
261+
if (v0.v0cosPA() > antilambdasetting_cospa && v0.dcaV0daughters() < antilambdasetting_dcav0dau && v0.v0radius() > antilambdasetting_radius && TMath::Abs(v0.dcapostopv()) > antilambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > antilambdasetting_dcanegtopv) {
262+
rPtAnalysis.fill(HIST("hMassAntilambdaAllAfterCuts"), v0.mAntiLambda());
263+
rPtAnalysis.fill(HIST("hAntilambdaReconstructedPtSpectrum"), v0.pt());
264+
for (int i = 0; i < 20; i++) {
265+
// same as above with kzerosh and lambda we fill the 20 anti-lambda namespace histograms within their Pt range
266+
std::string pt1 = pthistos::antilambdaptbins[i];
267+
std::string pt2 = pthistos::antilambdaptbins[i + 1];
268+
size_t pos1 = pt1.find("_");
269+
size_t pos2 = pt2.find("_");
270+
pt1[pos1] = '.';
271+
pt2[pos2] = '.';
272+
const float ptlowervalue = std::stod(pt1);
273+
const float pthighervalue = std::stod(pt2);
274+
if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) {
275+
pthistos::AntilambdaPt[i]->Fill(v0.mAntiLambda());
276+
}
265277
}
266278
}
267279
}

0 commit comments

Comments
 (0)