Skip to content
Closed
Show file tree
Hide file tree
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
36 changes: 7 additions & 29 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 @@ -57,7 +57,7 @@
// Particles
static const std::vector<std::string> parameterNames{"Enable"};
static constexpr int nParameters = 1;
static const int defaultParticles[PIDExtended::NIDsTot][nParameters]{{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {1}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
static const int defaultParticles[PIDExtended::NIDsTot][nParameters]{{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {1}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
bool enabledParticlesArray[PIDExtended::NIDsTot];

// Estimators
Expand Down Expand Up @@ -180,7 +180,6 @@
"Estimators enabled"};
Configurable<bool> selectInelGt0{"selectInelGt0", true, "Select only inelastic events"};
Configurable<bool> selectPrimaries{"selectPrimaries", true, "Select only primary particles"};
Configurable<float> rapidityCut{"rapidityCut", 0.5, "Select only particles within |y| < cut"};
Configurable<bool> requireCoincidenceEstimators{"requireCoincidenceEstimators", false, "Asks for a coincidence when two estimators are used"};
Configurable<bool> discardkIsGoodZvtxFT0vsPV{"discardkIsGoodZvtxFT0vsPV", false, "Select only collisions with matching BC and MC BC"};
Configurable<bool> discardMismatchedBCs{"discardMismatchedBCs", false, "Select only collisions with matching BC and MC BC"};
Expand Down Expand Up @@ -456,7 +455,7 @@
}

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

Check failure on line 458 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 @@ -494,41 +493,20 @@
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 502 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()) >= rapidityCut) {
continue;
}

// Check if particle has daughters (not a final state particle)
auto daughters = particle.daughters_as<aod::McParticles>();
bool isValid = false;

if (daughters.size() > 0) {
isValid = true;
for (const auto& daughter : daughters) {
if (!daughter.isPhysicalPrimary()) {
isValid = false;
break;
}
}
} else {
// Final state particle - check if particle itself is physical primary
isValid = particle.isPhysicalPrimary();
}

if (!isValid) {
if (std::abs(particle.y()) > 0.5) {

Check failure on line 509 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.
continue;
}

Expand Down Expand Up @@ -694,10 +672,10 @@
float nMultRecoMCBC[Estimators::nEstimators] = {0};
if (mcBC.has_ft0()) {
const auto& ft0 = mcBC.ft0();
for (const auto& amplitude : ft0.amplitudeA()) {
for (auto amplitude : ft0.amplitudeA()) {

Check failure on line 675 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 (const auto& amplitude : ft0.amplitudeC()) {
for (auto amplitude : ft0.amplitudeC()) {

Check failure on line 678 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
6 changes: 5 additions & 1 deletion PWGLF/Utils/mcParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class PIDExtended
static constexpr ID KstarPM = PIDCounts + 40;
static constexpr ID Kshort = PIDCounts + 41;
static constexpr ID Xi1530 = PIDCounts + 42;
static constexpr ID NIDsTot = PIDCounts + 43;
static constexpr ID Lambda1520 = PIDCounts + 43;
static constexpr ID NIDsTot = PIDCounts + 44;

static constexpr const char* sNames[NIDsTot + 1] = {
o2::track::pid_constants::sNames[Electron], // Electron
Expand Down Expand Up @@ -199,6 +200,7 @@ class PIDExtended
"KstarPM", // KstarPM
"Kshort", // Kshort
"Xi1530", // Xi1530
"Lambda1520", // Lambda1520
nullptr};

static std::vector<std::string> arrayNames()
Expand Down Expand Up @@ -341,6 +343,8 @@ class PIDExtended
return Kshort;
case 3324:
return Xi1530;
case 3124:
return Lambda1520;
default:
LOG(debug) << "Cannot identify particle with PDG code " << particle.pdgCode();
break;
Expand Down
Loading