Skip to content
Merged
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
56 changes: 33 additions & 23 deletions PWGLF/TableProducer/QC/nucleiQC.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/TableProducer/QC/nucleiQC.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 All @@ -9,15 +9,10 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//
// Nuclei spectra analysis task
// ========================
//
// Executable + dependencies:
//
// Data (run3):
// o2-analysis-lf-nuclei-spectra, o2-analysis-timestamp
// o2-analysis-pid-tof-base, o2-analysis-multiplicity-table, o2-analysis-event-selection
// (to add flow: o2-analysis-qvector-table, o2-analysis-centrality-table)
/// \brief TableProducer/Task for nuclei QC. The produced table can be disabled with a configurable.
///
/// \author Giorgio Alberto Lucia (giorgio.alberto.lucia@cern.ch)
///

#include "PWGLF/DataModel/EPCalibrationTables.h"
#include "PWGLF/DataModel/LFSlimNucleiTables.h"
Expand Down Expand Up @@ -98,7 +93,7 @@

// CCDB options
Configurable<int> cfgMaterialCorrection{"cfgMaterialCorrection", static_cast<int>(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"};
Configurable<std::string> cfgCCDBurl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 96 in PWGLF/TableProducer/QC/nucleiQC.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Service<o2::ccdb::BasicCCDBManager> mCcdb;
int mRunNumber = 0;
float mBz = 0.f;
Expand Down Expand Up @@ -149,7 +144,7 @@
return;

float tpcBetheBlochParams[6];
for (int iParam = 0; iParam < 6; iParam++) {

Check failure on line 147 in PWGLF/TableProducer/QC/nucleiQC.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.
tpcBetheBlochParams[iParam] = cfgBetheBlochParams->get(kSpeciesRt, iParam);
}

Expand Down Expand Up @@ -185,10 +180,10 @@
track.tpcInnerParam() < cfgCutTpcMom ||
track.itsNCls() < cfgCutNclusITS ||
track.tpcNClsFound() < cfgCutNclusTPC ||
track.tpcNClsCrossedRows() < 70 ||

Check failure on line 183 in PWGLF/TableProducer/QC/nucleiQC.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.
track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() ||

Check failure on line 184 in PWGLF/TableProducer/QC/nucleiQC.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.
track.tpcChi2NCl() > 4.f ||

Check failure on line 185 in PWGLF/TableProducer/QC/nucleiQC.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.
track.itsChi2NCl() > 36.f) {

Check failure on line 186 in PWGLF/TableProducer/QC/nucleiQC.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 false;
}
return true;
Expand Down Expand Up @@ -250,19 +245,33 @@
} else {
candidate.flags |= nuclei::Flags::kIsSecondaryFromMaterial;
}

mFilledMcParticleIds.emplace_back(particle.globalIndex());
}

template <typename Tcollision, typename Ttrack>
void fillNucleusFlagsPdgs(const int iSpecies, const Tcollision& collision, const Ttrack& track, nuclei::SlimCandidate& candidate)
{
candidate.flags = static_cast<uint16_t>((track.pidForTracking() & 0xF) << 12);
candidate.flags |= iSpecies == nuclei::Species::kPr ? nuclei::Flags::kProton : iSpecies == nuclei::Species::kDe ? nuclei::Flags::kDeuteron
: iSpecies == nuclei::Species::kTr ? nuclei::Flags::kTriton
: iSpecies == nuclei::Species::kHe ? nuclei::Flags::kHe3
: iSpecies == nuclei::Species::kAl ? nuclei::Flags::kHe4
: 0;

switch (iSpecies) {
case nuclei::Species::kPr:
candidate.flags |= nuclei::Flags::kProton;
break;
case nuclei::Species::kDe:
candidate.flags |= nuclei::Flags::kDeuteron;
break;
case nuclei::Species::kTr:
candidate.flags |= nuclei::Flags::kTriton;
break;
case nuclei::Species::kHe:
candidate.flags |= nuclei::Flags::kHe3;
break;
case nuclei::Species::kAl:
candidate.flags |= nuclei::Flags::kHe4;
break;
default:
candidate.flags |= 0;
break;
}

if (track.hasTOF())
candidate.flags |= nuclei::Flags::kHasTOF;
Expand Down Expand Up @@ -414,11 +423,6 @@
if (cfgFillOnlyPhysicalPrimaries && !particle.isPhysicalPrimary())
return;

nuclei::SlimCandidate candidate;
candidate = fillCandidate</*isMc*/ true>(kSpeciesCt, collision, track);
if ((candidate.flags >> 10) & 0b1)
LOG(info) << "track from material before track selection";

mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kNoCuts);
if (!trackSelection(track))
return;
Expand All @@ -428,10 +432,11 @@
return;
mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kPidCuts);

// nuclei::SlimCandidate candidate;
// candidate = fillCandidate</*isMc*/ true>(kSpeciesCt, collision, track);
nuclei::SlimCandidate candidate;
candidate = fillCandidate</*isMc*/ true>(kSpeciesCt, collision, track);

mNucleiCandidates.emplace_back(candidate);
mFilledMcParticleIds.emplace_back(particle.globalIndex());
dispatchFillHistograms</*isGenerated*/ true>(kSpeciesRt, candidate);
dispatchFillHistograms</*isGenerated*/ false>(kSpeciesRt, candidate);
});
Expand All @@ -442,12 +447,16 @@
mcParticlesThisCollision.bindExternalIndices(&mcParticles);

for (const auto& particle : mcParticlesThisCollision) {

if (std::find(mFilledMcParticleIds.begin(), mFilledMcParticleIds.end(), particle.globalIndex()) != mFilledMcParticleIds.end())
continue;

if (cfgFillOnlyPhysicalPrimaries && !particle.isPhysicalPrimary())
continue;

if ((particle.y() - cfgRapidityCenterMass) < cfgRapidityMin || (particle.y() - cfgRapidityCenterMass) > cfgRapidityMax)
continue;

int iSpecies = nuclei::getSpeciesFromPdg(particle.pdgCode());
if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), iSpecies) == mSpeciesToProcess.end())
continue;
Expand All @@ -457,6 +466,7 @@
fillNucleusGeneratedVariables(particle, candidate);

mNucleiCandidates.emplace_back(candidate);
mFilledMcParticleIds.emplace_back(particle.globalIndex());
dispatchFillHistograms</*isGenerated*/ true>(iSpecies, candidate);
}

Expand Down
Loading