Skip to content
Merged
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
8 changes: 7 additions & 1 deletion PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <TH1.h>

#include <fmt/format.h>

#include <algorithm>
#include <cstddef>
#include <string>
Expand Down Expand Up @@ -52,7 +54,11 @@
void fillSelectionHistogram()
{
int nBins = mSelections.size();
mQAHistogramRegistry->add((static_cast<std::string>(o2::aod::femtodreamparticle::ParticleTypeName[part]) + "/cuthist").c_str(), "; Cut; Value", o2::framework::HistType::kTH1F, {{nBins, 0, static_cast<double>(nBins)}});
// fmt::format, not std::string + const char*: the longest names here are
// exactly 32 characters, so the concatenation crosses std::string's SSO
// boundary and GCC 14 reports the constant-folded copy as
// -Werror=array-bounds= on a buffer that is never actually used.
mQAHistogramRegistry->add(fmt::format("{}/cuthist", o2::aod::femtodreamparticle::ParticleTypeName[part]).c_str(), "; Cut; Value", o2::framework::HistType::kTH1F, {{nBins, 0, static_cast<double>(nBins)}});
auto hist = mQAHistogramRegistry->get<TH1>(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/cuthist"));
for (size_t i = 0; i < mSelections.size(); ++i) {
hist->GetXaxis()->SetBinLabel(i + 1, Form("%u", mSelections.at(i).getSelectionVariable()));
Expand Down Expand Up @@ -122,7 +128,7 @@
break;
}

for (auto& sel : mSelections) {

Check failure on line 131 in PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h

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.
if (sel.getSelectionVariable() == selVar) {
switch (sel.getSelectionType()) {
case (femtoDreamSelection::SelectionType::kUpperLimit):
Expand Down Expand Up @@ -165,7 +171,7 @@
std::vector<FemtoDreamSelection<selValDataType, selVariable>> getSelections(selVariable selVar)
{
std::vector<FemtoDreamSelection<selValDataType, selVariable>> selValVec;
for (auto& it : mSelections) {

Check failure on line 174 in PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h

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.
if (it.getSelectionVariable() == selVar) {
selValVec.push_back(it);
}
Expand All @@ -178,7 +184,7 @@
std::vector<selVariable> getSelectionVariables()
{
std::vector<selVariable> selVarVec;
for (auto& it : mSelections) {

Check failure on line 187 in PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h

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.
auto selVar = it.getSelectionVariable();
if (std::none_of(selVarVec.begin(),
selVarVec.end(),
Expand Down
4 changes: 3 additions & 1 deletion PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <TMath.h>
#include <TPDGCode.h>

#include <fmt/format.h>

#include <cstdlib>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -340,7 +342,7 @@ class FemtoDreamParticleHisto
framework::AxisSpec InvMassAxis = {InvMassBins, "M_{inv} (GeV/#it{c}^{2})"};
framework::AxisSpec InvMassCompetingAxis = {InvMassCompetingBins, "M_{inv} (GeV/#it{c}^{2})"};

std::string folderName = (static_cast<std::string>(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]).c_str() + static_cast<std::string>(mFolderSuffix[mFolderSuffixType])).c_str();
std::string folderName = fmt::format("{}{}", o2::aod::femtodreamparticle::ParticleTypeName[mParticleType], mFolderSuffix[mFolderSuffixType]);

// Fill here the actual histogramms by calling init_base and init_MC
init_base<o2::aod::femtodreamMCparticle::MCType::kRecon>(folderName, tempFitVarAxisTitle, pTAxis, tempFitVarAxis, InvMassAxis, multAxis);
Expand Down
4 changes: 3 additions & 1 deletion PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <Framework/Logger.h>
#include <ReconstructionDataFormats/PID.h>

#include <fmt/format.h>

#include <array>
#include <cmath>
#include <cstddef>
Expand Down Expand Up @@ -114,7 +116,7 @@
void setPIDSpecies(T& pids)
{
std::vector<int> tmpPids = pids; /// necessary due to some features of the configurable
for (const o2::track::PID pid : tmpPids) {

Check failure on line 119 in PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h

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.
mPIDspecies.push_back(pid);
}
}
Expand Down Expand Up @@ -313,11 +315,11 @@
if (QAregistry && Registry) {
mHistogramRegistry = Registry;
mQAHistogramRegistry = QAregistry;
std::string folderName = static_cast<std::string>(o2::aod::femtodreamparticle::ParticleTypeName[part]) + "/" + static_cast<std::string>(o2::aod::femtodreamparticle::TrackTypeName[tracktype]);
std::string folderName = fmt::format("{}/{}", o2::aod::femtodreamparticle::ParticleTypeName[part], o2::aod::femtodreamparticle::TrackTypeName[tracktype]);

/// check whether the number of selection exceeds the bitmap size
unsigned int nSelections = getNSelections() - getNSelections(femtoDreamTrackSelection::kPIDnSigmaMax);
if (nSelections > 8 * sizeof(cutContainerType)) {

Check failure on line 322 in PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h

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.
LOG(fatal) << "FemtoDreamTrackCuts: Number of selections too large for your container - quitting!";
}

Expand Down Expand Up @@ -480,7 +482,7 @@
if (nDCAMinSel > 0 && std::fabs(dca) < dcaMin) {
return false;
}
if (nRejectNotPropagatedTracks && std::fabs(dca) > 1e3) {

Check failure on line 485 in PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h

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;
}

Expand Down Expand Up @@ -529,7 +531,7 @@
}

float observable = 0.;
for (auto& sel : mSelections) {

Check failure on line 534 in PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h

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.
auto selVariable = sel.getSelectionVariable();
if (selVariable == femtoDreamTrackSelection::kPIDnSigmaMax) {
/// PID needsgetNsigmaITSto be handled a bit differently since we may need more than one species
Expand Down Expand Up @@ -610,7 +612,7 @@
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/hITSclustersIB"), track.itsNClsInnerBarrel());
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/hDCAxy"), track.pt(), track.dcaXY());
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/hDCAz"), track.pt(), track.dcaZ());
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/hDCA"), track.pt(), std::sqrt(pow(track.dcaXY(), 2.) + pow(track.dcaZ(), 2.)));

Check failure on line 615 in PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/hTPCdEdX"), track.p(), track.tpcSignal());
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/nSigmaTPC_pi"), track.p(), track.tpcNSigmaPi());
mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/") + HIST(femtoDreamSelection::mCutStage[cutstage]) + HIST("/nSigmaTPC_K"), track.p(), track.tpcNSigmaKa());
Expand Down
6 changes: 4 additions & 2 deletions PWGCF/FemtoDream/Core/femtoDreamV0Selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <Framework/HistogramSpec.h>
#include <Framework/Logger.h>

#include <fmt/format.h>

#include <array>
#include <cstddef>
#include <cstdlib>
Expand Down Expand Up @@ -298,14 +300,14 @@
/// \todo this should be an automatic check in the parent class, and the
/// return type should be templated
size_t nSelections = getNSelections();
if (nSelections > 8 * sizeof(cutContainerType)) {

Check failure on line 303 in PWGCF/FemtoDream/Core/femtoDreamV0Selection.h

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.
LOG(fatal) << "FemtoDreamV0Cuts: Number of selections to large for your "
"container - quitting!";
}
for (int istage = 0; istage < femtoDreamSelection::kNcutStages; istage++) {
std::string folderName =
static_cast<std::string>(o2::aod::femtodreamparticle::ParticleTypeName[part]) + "/" +
static_cast<std::string>(femtoDreamSelection::mCutStage[istage]);
fmt::format("{}/{}", o2::aod::femtodreamparticle::ParticleTypeName[part],
femtoDreamSelection::mCutStage[istage]);
/// \todo initialize histograms for children tracks of v0s
mQAHistogramRegistry->add((folderName + "/hPt").c_str(),
"; #it{p}_{T} (GeV/#it{c}); Entries", o2::framework::HistType::kTH1F,
Expand Down Expand Up @@ -598,7 +600,7 @@
const std::vector<float> decVtx = {v0.x(), v0.y(), v0.z()};

float observable = 0.;
for (auto& sel : mSelections) {

Check failure on line 603 in PWGCF/FemtoDream/Core/femtoDreamV0Selection.h

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.
const auto selVariable = sel.getSelectionVariable();
if (selVariable == femtoDreamV0Selection::kV0DecVtxMax) {
for (size_t i = 0; i < decVtx.size(); ++i) {
Expand Down
Loading