Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 87 additions & 12 deletions PWGLF/Tasks/QC/mcParticlePrediction.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/Tasks/QC/mcParticlePrediction.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -41,6 +41,7 @@

#include <TH1.h>
#include <TH2.h>
#include <TPDGCode.h>
#include <TParticlePDG.h>
#include <TString.h>

Expand Down Expand Up @@ -446,6 +447,9 @@
return nMult;
}

int noOfDaughters = 2;
float rapidityMother = 0.5;

void process(aod::McCollision const& mcCollision,
aod::McParticles const& mcParticles)
{
Expand All @@ -455,7 +459,7 @@
}

histos.fill(HIST("collisions/generated"), 1);
if (std::abs(mcCollision.posZ()) > 10.f) {

Check failure on line 462 in PWGLF/Tasks/QC/mcParticlePrediction.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return;
}
histos.fill(HIST("collisions/generated"), 2);
Expand Down Expand Up @@ -493,34 +497,105 @@
continue;
}

if (!particle.isPhysicalPrimary()) {
continue;
}
// if (!particle.isPhysicalPrimary()) {
// continue;
// }

TParticlePDG* p = pdgDB->GetParticle(particle.pdgCode());
if (p) {
if (std::abs(p->Charge()) > 1e-3) {

Check failure on line 506 in PWGLF/Tasks/QC/mcParticlePrediction.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("particles/eta/charged"), particle.eta());
} else {
histos.fill(HIST("particles/eta/neutral"), particle.eta());
}
}

if (std::abs(particle.y()) > 0.5) {
if (std::abs(particle.y()) >= rapidityMother) {
continue;
}

histos.fill(HIST("particles/vtx/x"), particle.vx());
histos.fill(HIST("particles/vtx/y"), particle.vy());
histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ());
if (particle.pdgCode() == o2::constants::physics::kK0Star892) {
auto kDaughters = particle.daughters_as<aod::McParticles>();
if (kDaughters.size() != noOfDaughters) {
continue;
}

auto passkaon = false;
auto passpion = false;
for (const auto& kCurrentDaughter : kDaughters) {
if (!kCurrentDaughter.isPhysicalPrimary()) {
continue;
}

if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kKPlus) {
passkaon = true;
} else if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kPiPlus) {
passpion = true;
}
}
if (passkaon && passpion) {
histos.fill(HIST("particles/vtx/x"), particle.vx());
histos.fill(HIST("particles/vtx/y"), particle.vy());
histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ());

histos.fill(HIST("particles/yields"), id);
for (int i = 0; i < Estimators::nEstimators; i++) {
if (!enabledEstimatorsArray[i]) {
continue;
}
hpt[i][id]->Fill(particle.pt(), nMult[i]);
hyield[i][id]->Fill(nMult[i]);
}
}
} else if (particle.pdgCode() == o2::constants::physics::kPhi) {
auto kDaughters = particle.daughters_as<aod::McParticles>();
if (kDaughters.size() != noOfDaughters) {
continue;
}

histos.fill(HIST("particles/yields"), id);
for (int i = 0; i < Estimators::nEstimators; i++) {
if (!enabledEstimatorsArray[i]) {
auto passkaonPos = false;
auto passkaonNeg = false;
for (const auto& kCurrentDaughter : kDaughters) {
if (!kCurrentDaughter.isPhysicalPrimary()) {
continue;
}

if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) {
passkaonPos = true;
} else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) {
passkaonNeg = true;
}
}
if (passkaonPos && passkaonNeg) {
histos.fill(HIST("particles/vtx/x"), particle.vx());
histos.fill(HIST("particles/vtx/y"), particle.vy());
histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ());

histos.fill(HIST("particles/yields"), id);
for (int i = 0; i < Estimators::nEstimators; i++) {
if (!enabledEstimatorsArray[i]) {
continue;
}
hpt[i][id]->Fill(particle.pt(), nMult[i]);
hyield[i][id]->Fill(nMult[i]);
}
}
} else {
if (!particle.isPhysicalPrimary()) {
continue;
}
hpt[i][id]->Fill(particle.pt(), nMult[i]);
hyield[i][id]->Fill(nMult[i]);
histos.fill(HIST("particles/vtx/x"), particle.vx());
histos.fill(HIST("particles/vtx/y"), particle.vy());
histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ());

histos.fill(HIST("particles/yields"), id);
for (int i = 0; i < Estimators::nEstimators; i++) {
if (!enabledEstimatorsArray[i]) {
continue;
}
hpt[i][id]->Fill(particle.pt(), nMult[i]);
hyield[i][id]->Fill(nMult[i]);
}
}
}
}
Expand Down Expand Up @@ -672,10 +747,10 @@
float nMultRecoMCBC[Estimators::nEstimators] = {0};
if (mcBC.has_ft0()) {
const auto& ft0 = mcBC.ft0();
for (auto amplitude : ft0.amplitudeA()) {

Check failure on line 750 in PWGLF/Tasks/QC/mcParticlePrediction.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
nMultRecoMCBC[Estimators::FT0A] += amplitude;
}
for (auto amplitude : ft0.amplitudeC()) {

Check failure on line 753 in PWGLF/Tasks/QC/mcParticlePrediction.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
nMultRecoMCBC[Estimators::FT0C] += amplitude;
}
nMultRecoMCBC[Estimators::FT0AC] = nMultRecoMCBC[Estimators::FT0A] + nMultRecoMCBC[Estimators::FT0C];
Expand Down
Loading