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
88 changes: 58 additions & 30 deletions PWGLF/Tasks/Strangeness/sigmaminustask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::pidTPCPi>;
using CollisionsFull = soa::Join<aod::Collisions, aod::EvSel>;
using CollisionsFullMC = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
using CollisionsFullMC = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSel>;

struct sigmaminustask {

Check failure on line 33 in PWGLF/Tasks/Strangeness/sigmaminustask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
// Histograms are defined with HistogramRegistry
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
HistogramRegistry rSigmaMinus{"sigmaminus", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
Expand All @@ -39,6 +39,8 @@
Configurable<float> cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"};
Configurable<float> cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"};

Preslice<aod::KinkCands> mPerCol = aod::track::collisionId;

void init(InitContext const&)
{
// Axes
Expand All @@ -58,7 +60,8 @@

if (doprocessMC) {
// Add MC histograms if needed
rSigmaMinus.add("h2MassSigmaMinusPtMC", "h2MassSigmaMinusPtMC", {HistType::kTH2F, {ptAxis, sigmaMassAxis}});
rSigmaMinus.add("h2MassPtMCRec", "h2MassPtMCRec", {HistType::kTH2F, {ptAxis, sigmaMassAxis}});
rSigmaMinus.add("h2MassPtMCGen", "h2MassPtMCGen", {HistType::kTH2F, {ptAxis, sigmaMassAxis}});
}
}

Expand All @@ -70,7 +73,7 @@
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
for (const auto& kinkCand : KinkCands) {
auto dauTrack = kinkCand.trackDaug_as<TracksFull>();
if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) {

Check failure on line 76 in PWGLF/Tasks/Strangeness/sigmaminustask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
continue;
}
rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus());
Expand All @@ -80,46 +83,71 @@
}
PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true);

void processMC(CollisionsFullMC::iterator const& collision, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const&, TracksFull const&)
void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, TracksFull const&)
{
if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) {
return;
}
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
for (const auto& kinkCand : KinkCands) {
auto dauTrack = kinkCand.trackDaug_as<TracksFull>();
auto mothTrack = kinkCand.trackMoth_as<TracksFull>();
if (dauTrack.sign() != mothTrack.sign()) {
LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex();
continue; // Skip if the daughter has the opposite sign as the mother
}
if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) {
for (const auto& collision : collisions) {
if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) {
continue;
}

rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus());
rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus());
rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi());
// do MC association
auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex());
auto mcLabPiDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex());
if (mcLabSigma.has_mcParticle() && mcLabPiDau.has_mcParticle()) {
auto mcTrackSigma = mcLabSigma.mcParticle_as<aod::McParticles>();
auto mcTrackPiDau = mcLabPiDau.mcParticle_as<aod::McParticles>();
if (!mcTrackPiDau.has_mothers()) {
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
auto kinkCandPerColl = KinkCands.sliceBy(mPerCol, collision.globalIndex());
for (const auto& kinkCand : kinkCandPerColl) {
auto dauTrack = kinkCand.trackDaug_as<TracksFull>();
auto mothTrack = kinkCand.trackMoth_as<TracksFull>();
if (dauTrack.sign() != mothTrack.sign()) {
LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex();
continue; // Skip if the daughter has the opposite sign as the mother
}
if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) {

Check failure on line 102 in PWGLF/Tasks/Strangeness/sigmaminustask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
continue;
}
for (auto& piMother : mcTrackPiDau.mothers_as<aod::McParticles>()) {
if (piMother.globalIndex() != mcTrackSigma.globalIndex()) {

rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus());
rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus());
rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi());
// do MC association
auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex());
auto mcLabPiDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex());
if (mcLabSigma.has_mcParticle() && mcLabPiDau.has_mcParticle()) {
auto mcTrackSigma = mcLabSigma.mcParticle_as<aod::McParticles>();
auto mcTrackPiDau = mcLabPiDau.mcParticle_as<aod::McParticles>();
if (!mcTrackPiDau.has_mothers()) {
continue;
}
if (std::abs(mcTrackSigma.pdgCode()) != 3112 || std::abs(mcTrackPiDau.pdgCode()) != 211) {
continue;
for (auto& piMother : mcTrackPiDau.mothers_as<aod::McParticles>()) {

Check failure on line 118 in PWGLF/Tasks/Strangeness/sigmaminustask.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.
if (piMother.globalIndex() != mcTrackSigma.globalIndex()) {
continue;
}
if (std::abs(mcTrackSigma.pdgCode()) != 3112 || std::abs(mcTrackPiDau.pdgCode()) != 211) {

Check failure on line 122 in PWGLF/Tasks/Strangeness/sigmaminustask.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.

Check failure on line 122 in PWGLF/Tasks/Strangeness/sigmaminustask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
continue;
}
rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus());
}
rSigmaMinus.fill(HIST("h2MassSigmaMinusPtMC"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus());
}
}
}
for (const auto& mcPart : particlesMC) {
if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > 0.5) {

Check failure on line 131 in PWGLF/Tasks/Strangeness/sigmaminustask.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.

Check failure on line 131 in PWGLF/Tasks/Strangeness/sigmaminustask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
continue;
}
if (!mcPart.has_daughters()) {
continue; // Skip if no daughters
}
bool hasSigmaDaughter = false;
for (const auto& daughter : mcPart.daughters_as<aod::McParticles>()) {
if (std::abs(daughter.pdgCode()) == 211) { // Sigma PDG code

Check failure on line 139 in PWGLF/Tasks/Strangeness/sigmaminustask.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.

Check failure on line 139 in PWGLF/Tasks/Strangeness/sigmaminustask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
hasSigmaDaughter = true;
break; // Found a pi daughter, exit loop
}
}
if (!hasSigmaDaughter) {
continue; // Skip if no pi daughter found
}
float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p());
int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma
rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass);
}
}
PROCESS_SWITCH(sigmaminustask, processMC, "MC processing", false);
};
Expand Down
Loading