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
53 changes: 49 additions & 4 deletions PWGCF/Tasks/correlations.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 PWGCF/Tasks/correlations.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 @@ -96,6 +96,7 @@
O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 1, "Verbosity level (0 = major, 1 = per collision)")

O2_DEFINE_CONFIGURABLE(cfgDecayParticleMask, int, 0, "Selection bitmask for the decay particles: 0 = no selection")
O2_DEFINE_CONFIGURABLE(cfgV0RapidityMax, float, 0.8, "Maximum rapidity for the decay particles (0 = no selection)")
O2_DEFINE_CONFIGURABLE(cfgMassAxis, int, 0, "Use invariant mass axis (0 = OFF, 1 = ON)")
O2_DEFINE_CONFIGURABLE(cfgMcTriggerPDGs, std::vector<int>, {}, "MC PDG codes to use exclusively as trigger particles and exclude from associated particles. Empty = no selection.")

Expand Down Expand Up @@ -175,6 +176,7 @@
}
}
registry.add("multiplicity", "event multiplicity", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}});
registry.add("yvspt", "y vs pT", {HistType::kTH2F, {{100, -1, 1, "y"}, {100, 0, 20, "p_{T}"}}}); // y vs pT for all tracks (control histogram)

const int maxMixBin = AxisSpec(axisMultiplicity).getNbins() * AxisSpec(axisVertex).getNbins();
// The bin numbers for the control histograms (eventcount_*) come from getBin(...) and are the following: #mult_bin * #number_of_z_bins + #zbin
Expand Down Expand Up @@ -335,10 +337,10 @@

if (cfgCorrelationMethod == 1 && track1.decay() != track2.decay())
continue;
if (cfgCorrelationMethod == 2 && track1.decay() == track2.decay())

Check failure on line 340 in PWGCF/Tasks/correlations.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;
registry.fill(HIST("invMassTwoPart"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), multiplicity);
registry.fill(HIST("invMassTwoPartDPhi"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), TVector2::Phi_0_2pi(track1.phi() - track2.phi() + TMath::Pi() / 2.0) - TMath::Pi() / 2.0);

Check failure on line 343 in PWGCF/Tasks/correlations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

Check failure on line 343 in PWGCF/Tasks/correlations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
}
}
}
Expand Down Expand Up @@ -398,6 +400,40 @@
template <class T>
using HasPartDaugh1Id = decltype(std::declval<T&>().cfParticleDaugh1Id());

template <typename T>
float getV0Rapidity(const T& track)
{
const float pt = track.pt();
const float eta = track.eta();
const float phi = track.phi();

const float px = pt * std::cos(phi);
const float py = pt * std::sin(phi);
const float pz = pt * std::sinh(eta);

const float p2 = px * px + py * py + pz * pz;

if constexpr (std::experimental::is_detected<HasDecay, T>::value) {
const auto decayType = track.decay();
float mass = 0.f;

if (decayType == aod::cf2prongtrack::K0stoPiPi) {
mass = o2::constants::physics::MassK0Short;
} else if (decayType == aod::cf2prongtrack::LambdatoPPi || decayType == aod::cf2prongtrack::AntiLambdatoPiP) {
mass = o2::constants::physics::MassLambda;
} else if (decayType == aod::cf2prongtrack::PhiToKK) {
mass = o2::constants::physics::MassPhi;
} else {
return -999.f; // unsupported decay type, return dummy rapidity
}

const float E = std::sqrt(p2 + mass * mass);

Check failure on line 430 in PWGCF/Tasks/correlations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
return 0.5f * std::log((E + pz) / (E - pz));
}

return -999.f; // no decay type, return dummy rapidity
}

template <CorrelationContainer::CFStep step, typename TTarget, typename TTracks1, typename TTracks2>
void fillCorrelations(TTarget target, TTracks1& tracks1, TTracks2& tracks2, float multiplicity, float posZ, int magField, float eventWeight)
{
Expand Down Expand Up @@ -445,8 +481,13 @@
if (((track1.mcDecay() != aod::cf2prongtrack::D0ToPiK) && (track1.mcDecay() != aod::cf2prongtrack::D0barToKPi)) || (track1.decay() & aod::cf2prongmcpart::Prompt) == 0)
continue;
} else if constexpr (std::experimental::is_detected<HasDecay, typename TTracks1::iterator>::value) {
if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast<uint32_t>(track1.decay()))) == 0u)
continue;
if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast<uint32_t>(track1.decay()))) == 0u) {
continue; // skip particles that do not match the decay mask
}
if (cfgV0RapidityMax > 0 && std::abs(getV0Rapidity(track1)) > cfgV0RapidityMax) {
Copy link
Collaborator

@jaelpark jaelpark Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @stefanopolitano, I think this line is buggy, because for unidentified types it returns -999, but your abs makes it always larger than your default cfgV0RapidityMax, which is 0.8 by default. This rejects all D0s, for example. Perhaps the default should be negative?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jaelpark! Indeed, this cut was not ment for D0s since the rapidity cut is typically applied at the skimming/task level, but only for LF V0s. I can change the default value to avoid misunderstanding, although one can always set the configuration value to 0 to switch the selection off

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think we shouldn't let new users of the D0 code be confused why everything is rejected. Another option is to return two values (std::tuple<float, bool>) from getV0Rapidity to indicate with a bool whether the selection applies.

continue; // V0s are not allowed to be outside the rapidity range
}
registry.fill(HIST("yvspt"), getV0Rapidity(track1), track1.pt());
}

if constexpr (std::experimental::is_detected<HasPartDaugh0Id, typename TTracks1::iterator>::value) {
Expand Down Expand Up @@ -521,14 +562,18 @@
if ((((track2.mcDecay()) != aod::cf2prongtrack::D0ToPiK) && ((track2.mcDecay()) != aod::cf2prongtrack::D0barToKPi)) || (track2.decay() & aod::cf2prongmcpart::Prompt) == 0)
continue;
} else if constexpr (std::experimental::is_detected<HasDecay, typename TTracks2::iterator>::value) {
if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast<uint32_t>(track2.decay()))) == 0u)
continue;
if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast<uint32_t>(track2.decay()))) == 0u) {
continue; // skip particles that do not match the decay mask
}
if (cfgV0RapidityMax > 0 && std::abs(getV0Rapidity(track1)) > cfgV0RapidityMax) {
continue; // V0s are not allowed to be outside the rapidity range
}
}

if constexpr (std::experimental::is_detected<HasDecay, typename TTracks1::iterator>::value && std::experimental::is_detected<HasDecay, typename TTracks2::iterator>::value) {
if (cfgCorrelationMethod == 1 && track1.decay() != track2.decay())
continue;
if (cfgCorrelationMethod == 2 && track1.decay() == track2.decay())

Check failure on line 576 in PWGCF/Tasks/correlations.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
Loading