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
240 changes: 120 additions & 120 deletions PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2232,154 +2232,154 @@ struct FemtoUniverseProducerTask {
}

template <bool isMC, typename TrackType, typename CollisionType>
void fillLikeSignPhi(CollisionType const& col, TrackType const& tracks)
{
std::vector<int> childIDs = {0, 0};
std::vector<int> tmpIDtrack;

// Loop over all track combinations using FullIndexPolicy
for (const auto& [p1, p2] : combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) {

// 1. Check minimal track quality cuts for both tracks
if (!trackCuts.isSelectedMinimal(p1) || !trackCuts.isSelectedMinimal(p2)) {
continue;
}

if (p1.sign() != p2.sign()) { //K+K- pairs are already handled in fillPhi, so we skip them here, only K+K+ and K-K-
continue;
}
void fillLikeSignPhi(CollisionType const& col, TrackType const& tracks)
{
std::vector<int> childIDs = {0, 0};
std::vector<int> tmpIDtrack;

// avoid double counting and self-pairing when using FullIndexPolicy
if (p1.globalIndex() >= p2.globalIndex()) {
continue;
}
// Loop over all track combinations using FullIndexPolicy
for (const auto& [p1, p2] : combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) {

// cuts for daughters
if (ConfPhiSelection.confPhiDoLFPID4Kaons) {
if (!p1.isGlobalTrackWoDCA() || !p2.isGlobalTrackWoDCA() || !p1.isPVContributor() || !p2.isPVContributor()) {
// 1. Check minimal track quality cuts for both tracks
if (!trackCuts.isSelectedMinimal(p1) || !trackCuts.isSelectedMinimal(p2)) {
continue;
}
if (!(isKaonNSigmaLF(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), p1.hasTOF()))) {

if (p1.sign() != p2.sign()) { // K+K- pairs are already handled in fillPhi, so we skip them here, only K+K+ and K-K-
continue;
}
if (!(isKaonNSigmaLF(p2.pt(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), p2.hasTOF()))) {

// avoid double counting and self-pairing when using FullIndexPolicy
if (p1.globalIndex() >= p2.globalIndex()) {
continue;
}
} else {
if (!(isKaonNSigma(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon)))) {

// cuts for daughters
if (ConfPhiSelection.confPhiDoLFPID4Kaons) {
if (!p1.isGlobalTrackWoDCA() || !p2.isGlobalTrackWoDCA() || !p1.isPVContributor() || !p2.isPVContributor()) {
continue;
}
if (!(isKaonNSigmaLF(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), p1.hasTOF()))) {
continue;
}
if (!(isKaonNSigmaLF(p2.pt(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), p2.hasTOF()))) {
continue;
}
} else {
if (!(isKaonNSigma(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon)))) {
continue;
}
if (!(isKaonNSigma(p2.pt(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon)))) {
continue;
}
}

// Reject protons and pions contamination
if (isKaonRejected(p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion))) {
continue;
}
if (!(isKaonNSigma(p2.pt(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon)))) {
if (isKaonRejected(p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion))) {
continue;
}
}

// Reject protons and pions contamination
if (isKaonRejected(p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion))) {
continue;
}
if (isKaonRejected(p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion))) {
continue;
}
const auto mMassOne = o2::constants::physics::MassKPlus;
const auto mMassTwo = o2::constants::physics::MassKPlus;

const auto mMassOne = o2::constants::physics::MassKPlus;
const auto mMassTwo = o2::constants::physics::MassKPlus;
ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> part1Vec(p1.pt(), p1.eta(), p1.phi(), mMassOne);
ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> part2Vec(p2.pt(), p2.eta(), p2.phi(), mMassTwo);

ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> part1Vec(p1.pt(), p1.eta(), p1.phi(), mMassOne);
ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> part2Vec(p2.pt(), p2.eta(), p2.phi(), mMassTwo);
ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> sumVec(part1Vec);
sumVec += part2Vec;

ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> sumVec(part1Vec);
sumVec += part2Vec;
// kinematic cuts for phi candidate
float phiEta = sumVec.Eta();
if (std::abs(phiEta) > ConfPhiSelection.confPhiEtaHighLimit.value) {
continue;
}

// kinematic cuts for phi candidate
float phiEta = sumVec.Eta();
if (std::abs(phiEta) > ConfPhiSelection.confPhiEtaHighLimit.value) {
continue;
}
float phiPt = sumVec.Pt();
if ((phiPt < ConfPhiSelection.confPhiPtLowLimit.value) || (phiPt > ConfPhiSelection.confPhiPtHighLimit.value)) {
continue;
}

float phiPt = sumVec.Pt();
if ((phiPt < ConfPhiSelection.confPhiPtLowLimit.value) || (phiPt > ConfPhiSelection.confPhiPtHighLimit.value)) {
continue;
}
float phiPhi = RecoDecay::constrainAngle(sumVec.Phi(), 0);
float phiM = sumVec.M();

float phiPhi = RecoDecay::constrainAngle(sumVec.Phi(), 0);
float phiM = sumVec.M();
if ((phiM < ConfPhiSelection.confPhiInvMassLowLimit) || (phiM > ConfPhiSelection.confPhiInvMassUpLimit)) {
continue;
}

if ((phiM < ConfPhiSelection.confPhiInvMassLowLimit) || (phiM > ConfPhiSelection.confPhiInvMassUpLimit)) {
continue;
}
phiCuts.fillQA<aod::femtouniverseparticle::ParticleType::kPhi, aod::femtouniverseparticle::ParticleType::kPhiChild>(col, p1, p1, p2, 321, 321);

phiCuts.fillQA<aod::femtouniverseparticle::ParticleType::kPhi, aod::femtouniverseparticle::ParticleType::kPhiChild>(col, p1, p1, p2, 321, 321);
int postrackID = p1.globalIndex();
int rowInPrimaryTrackTablePos = -1;
rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack);
childIDs[0] = rowInPrimaryTrackTablePos;
childIDs[1] = 0;

int postrackID = p1.globalIndex();
int rowInPrimaryTrackTablePos = -1;
rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack);
childIDs[0] = rowInPrimaryTrackTablePos;
childIDs[1] = 0;
// first daughter track
outputParts(outputCollision.lastIndex(), p1.pt(),
p1.eta(), p1.phi(),
aod::femtouniverseparticle::ParticleType::kPhiChild,
-999,
-999,
p1.dcaXY(),
childIDs,
0,
p1.sign());
const int rowOfPosTrack = outputParts.lastIndex();
if constexpr (isMC) {
fillMCParticle(p1, o2::aod::femtouniverseparticle::ParticleType::kPhiChild);
}

// first daughter track
outputParts(outputCollision.lastIndex(), p1.pt(),
p1.eta(), p1.phi(),
aod::femtouniverseparticle::ParticleType::kPhiChild,
-999,
-999,
p1.dcaXY(),
childIDs,
0,
p1.sign());
const int rowOfPosTrack = outputParts.lastIndex();
if constexpr (isMC) {
fillMCParticle(p1, o2::aod::femtouniverseparticle::ParticleType::kPhiChild);
}
int negtrackID = p2.globalIndex();
int rowInPrimaryTrackTableNeg = -1;
rowInPrimaryTrackTableNeg = getRowDaughters(negtrackID, tmpIDtrack);
childIDs[0] = 0;
childIDs[1] = rowInPrimaryTrackTableNeg;

int negtrackID = p2.globalIndex();
int rowInPrimaryTrackTableNeg = -1;
rowInPrimaryTrackTableNeg = getRowDaughters(negtrackID, tmpIDtrack);
childIDs[0] = 0;
childIDs[1] = rowInPrimaryTrackTableNeg;

// second daughter track
outputParts(outputCollision.lastIndex(),
p2.pt(),
p2.eta(),
p2.phi(),
aod::femtouniverseparticle::ParticleType::kPhiChild,
-999,
-999,
p2.dcaXY(),
childIDs,
0,
p2.sign());
const int rowOfNegTrack = outputParts.lastIndex();
if constexpr (isMC) {
fillMCParticle(p2, o2::aod::femtouniverseparticle::ParticleType::kPhiChild);
}
// second daughter track
outputParts(outputCollision.lastIndex(),
p2.pt(),
p2.eta(),
p2.phi(),
aod::femtouniverseparticle::ParticleType::kPhiChild,
-999,
-999,
p2.dcaXY(),
childIDs,
0,
p2.sign());
const int rowOfNegTrack = outputParts.lastIndex();
if constexpr (isMC) {
fillMCParticle(p2, o2::aod::femtouniverseparticle::ParticleType::kPhiChild);
}

std::vector<int> indexChildID = {rowOfPosTrack, rowOfNegTrack};
std::vector<int> indexChildID = {rowOfPosTrack, rowOfNegTrack};

// Define like-sign flag: +1 for (K+K+), -1 for (K-K-)
int likeSignFlag = p1.sign();
// Define like-sign flag: +1 for (K+K+), -1 for (K-K-)
int likeSignFlag = p1.sign();

// Save the Fake Phi candidate from K+K+ or K-K- combination
outputParts(outputCollision.lastIndex(),
phiPt,
phiEta,
phiPhi,
aod::femtouniverseparticle::ParticleType::kPhi,
likeSignFlag, // Flag: +1 for K+K+, -1 for K-K-, before it was empty slot for cutcontainer
0,
phiM, // Invariant mass of the fake Phi candidate
indexChildID,
phiM,
0);
// Save the Fake Phi candidate from K+K+ or K-K- combination
outputParts(outputCollision.lastIndex(),
phiPt,
phiEta,
phiPhi,
aod::femtouniverseparticle::ParticleType::kPhi,
likeSignFlag, // Flag: +1 for K+K+, -1 for K-K-, before it was empty slot for cutcontainer
0,
phiM, // Invariant mass of the fake Phi candidate
indexChildID,
phiM,
0);

if (confIsDebug) {
fillDebugParticle<true, false, false>(p1); // QA for first daughter
fillDebugParticle<true, false, false>(p2); // QA for second daughter
fillDebugParticle<false, true, false>(p1); // QA for fake Phi mother
if (confIsDebug) {
fillDebugParticle<true, false, false>(p1); // QA for first daughter
fillDebugParticle<true, false, false>(p2); // QA for second daughter
fillDebugParticle<false, true, false>(p1); // QA for fake Phi mother
}
}
}
}

template <typename TrackType, bool transientLabels = false, bool resolveDaughs = false>
void fillParticles(TrackType const& tracks, std::optional<std::reference_wrapper<const std::set<int>>> recoMcIds = std::nullopt)
Expand Down Expand Up @@ -2604,7 +2604,7 @@ void fillLikeSignPhi(CollisionType const& col, TrackType const& tracks)
}
if (ConfGeneral.confIsActivatePhi) {
fillPhi<isMC>(col, tracks);
if (ConfPhiSelection.confDoLikeSign){
if (ConfPhiSelection.confDoLikeSign) {
fillLikeSignPhi<isMC>(col, tracks);
}
}
Expand Down Expand Up @@ -2784,7 +2784,7 @@ void fillLikeSignPhi(CollisionType const& col, TrackType const& tracks)
fillTracks<false>(tracks);
fillPhi<false>(col, tracks);
if (ConfPhiSelection.confDoLikeSign) {
fillLikeSignPhi<false>(col, tracks);
fillLikeSignPhi<false>(col, tracks);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct FemtoUniversePairTaskTrackPhi {
Configurable<float> confInvMassLowLimitPhi{"confInvMassLowLimitPhi", 1.011, "Lower limit of the Phi invariant mass"}; // change that to do invariant mass cut
Configurable<float> confInvMassUpLimitPhi{"confInvMassUpLimitPhi", 1.027, "Upper limit of the Phi invariant mass"};
Configurable<bool> confFillMinvBackground{"confFillMinvBackground", false, "Fill background histograms for Phi invariant mass."};

/// Partitions for the Phi meson (particle 2)
Partition<FilteredFemtoFullParticles> partsPhi = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kPhi)) &&
(aod::femtouniverseparticle::pt > confPhiPtLow) &&
Expand Down
Loading