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
73 changes: 59 additions & 14 deletions PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ struct femtoUniverseProducerTask {
Configurable<bool> ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"};
Configurable<int> ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"};
Configurable<bool> ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"};
Configurable<bool> ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtouniverse tables"};
Configurable<bool> ConfIsActivateV0{"ConfIsActivateV0", false, "Activate filling of V0 into femtouniverse tables"};
Configurable<bool> ConfActivateSecondaries{"ConfActivateSecondaries", false, "Fill secondary MC gen particles that were reconstructed"};
Configurable<bool> ConfIsActivateCascade{"ConfIsActivateCascade", true, "Activate filling of Cascade into femtouniverse tables"};
Configurable<bool> ConfIsActivatePhi{"ConfIsActivatePhi", false, "Activate filling of Phi into femtouniverse tables"};
Configurable<bool> ConfMCTruthAnalysisWithPID{"ConfMCTruthAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles (for MC Truth)"};
Expand Down Expand Up @@ -205,13 +206,12 @@ struct femtoUniverseProducerTask {
} ConfFilterCuts;

Filter GlobalCutFilter = requireGlobalTrackWoDCAInFilter();

Filter CustomTrackFilter = (aod::track::pt > ConfFilterCuts.ConfPtLowFilterCut) &&
(aod::track::pt < ConfFilterCuts.ConfPtHighFilterCut) &&
(nabs(aod::track::eta) < ConfFilterCuts.ConfEtaFilterCut) &&
(!ConfFilterCuts.ConfDxaXYCustom0Cut || (aod::track::dcaXY < ConfFilterCuts.ConfDcaXYFilterCut)) &&
(!ConfFilterCuts.ConfDxaXYCustom0Cut || (aod::track::dcaXY < ConfFilterCuts.ConfDcaXYFilterCut)) && // true if configurable set to false or if configurable is true and it passes the selection
(aod::track::dcaZ < ConfFilterCuts.ConfDcaZFilterCut) &&
(!ConfFilterCuts.ConfDcaXYCustom1Cut || (nabs(aod::track::dcaXY) < ConfFilterCuts.ConfDcaXYCustom11FilterCut + ConfFilterCuts.ConfDcaXYCustom12FilterCut / aod::track::pt));
(!ConfFilterCuts.ConfDcaXYCustom1Cut || (nabs(aod::track::dcaXY) < ConfFilterCuts.ConfDcaXYCustom11FilterCut + ConfFilterCuts.ConfDcaXYCustom12FilterCut / aod::track::pt)); // same logic here

// CASCADE
FemtoUniverseCascadeSelection cascadeCuts;
Expand Down Expand Up @@ -262,10 +262,11 @@ struct femtoUniverseProducerTask {
Configurable<float> ConfLooseTOFNSigmaValue{"ConfLooseTOFNSigmaValue", 10, "Value for the loose TOF N Sigma for Kaon PID."};
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<int> ConfPDGCodePartOne{"ConfPDGCodePartOne", 321, "Particle 1 - PDG code"};
Configurable<int> ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 321, "Particle 2 - PDG code"};
} ConfPhiSelection;

Configurable<int> ConfPDGCodePartOne{"ConfPDGCodePartOne", 321, "Particle 1 - PDG code"};
Configurable<int> ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 321, "Particle 2 - PDG code"};

// D0/D0bar mesons
struct : o2::framework::ConfigurableGroup {
Configurable<float> ConfD0D0barCandMaxY{"ConfD0D0barCandMaxY", -1., "max. cand. rapidity"};
Expand Down Expand Up @@ -640,7 +641,7 @@ struct femtoUniverseProducerTask {
int particleOrigin = 99;
auto motherparticlesMC = particleMC.template mothers_as<aod::McParticles>();

if (abs(pdgCode) == abs(ConfPhiSelection.ConfPDGCodePartOne.value) || abs(pdgCode) == abs(ConfPhiSelection.ConfPDGCodePartTwo.value)) {
if (abs(pdgCode) == abs(ConfPDGCodePartOne.value) || abs(pdgCode) == abs(ConfPDGCodePartTwo.value)) {
if (particleMC.isPhysicalPrimary()) {
particleOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kPrimary;
} else if (!motherparticlesMC.empty()) {
Expand Down Expand Up @@ -1155,6 +1156,9 @@ struct femtoUniverseProducerTask {
std::vector<int> tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index
// lorentz vectors and filling the tables
for (auto& [p1, p2] : combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) {
if (!trackCuts.isSelectedMinimal(p1) || !trackCuts.isSelectedMinimal(p1)) {
continue;
}
// implementing PID cuts for phi children
if (ConfPhiSelection.ConfLooseTPCNSigma) {
if (!(IsKaonNSigmaTPCLoose(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon)))) {
Expand Down Expand Up @@ -1186,8 +1190,8 @@ struct femtoUniverseProducerTask {
TLorentzVector part1Vec;
TLorentzVector part2Vec;

float mMassOne = TDatabasePDG::Instance()->GetParticle(ConfPhiSelection.ConfPDGCodePartOne)->Mass(); // FIXME: Get from the PDG service of the common header
float mMassTwo = TDatabasePDG::Instance()->GetParticle(ConfPhiSelection.ConfPDGCodePartTwo)->Mass(); // FIXME: Get from the PDG service of the common header
float mMassOne = TDatabasePDG::Instance()->GetParticle(321)->Mass(); // FIXME: Get from the PDG service of the common header
float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header

part1Vec.SetPtEtaPhiM(p1.pt(), p1.eta(), p1.phi(), mMassOne);
part2Vec.SetPtEtaPhiM(p2.pt(), p2.eta(), p2.phi(), mMassTwo);
Expand Down Expand Up @@ -1217,7 +1221,7 @@ struct femtoUniverseProducerTask {
continue;
}

phiCuts.fillQA<aod::femtouniverseparticle::ParticleType::kPhi, aod::femtouniverseparticle::ParticleType::kPhiChild>(col, p1, p1, p2, ConfPhiSelection.ConfPDGCodePartOne, ConfPhiSelection.ConfPDGCodePartTwo); ///\todo fill QA also for daughters
phiCuts.fillQA<aod::femtouniverseparticle::ParticleType::kPhi, aod::femtouniverseparticle::ParticleType::kPhiChild>(col, p1, p1, p2, 321, -321); ///\todo fill QA also for daughters

int postrackID = p1.globalIndex();
int rowInPrimaryTrackTablePos = -1; // does it do anything?
Expand Down Expand Up @@ -1283,10 +1287,11 @@ struct femtoUniverseProducerTask {
}
}

template <typename TrackType, bool transientLabels = false>
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)
{
std::vector<int> childIDs = {0, 0}; // these IDs are necessary to keep track of the children
std::vector<int> tmpIDtrack;

for (auto& particle : tracks) {
/// if the most open selection criteria are not fulfilled there is no
Expand All @@ -1307,7 +1312,7 @@ struct femtoUniverseProducerTask {
if (pdgCode == 333) { // ATTENTION: workaround for now, because all Phi mesons are NOT primary particles for now.
pass = true;
} else {
if (particle.isPhysicalPrimary() || (recoMcIds && recoMcIds->get().contains(particle.globalIndex())))
if (particle.isPhysicalPrimary() || (ConfActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex())))
pass = true;
}
}
Expand All @@ -1328,6 +1333,10 @@ struct femtoUniverseProducerTask {
// instead of the bitmask, the PDG of the particle is stored as uint32_t

// now the table is filled
if constexpr (resolveDaughs) {
tmpIDtrack.push_back(particle.globalIndex());
continue;
}
outputParts(outputCollision.lastIndex(),
particle.pt(),
particle.eta(),
Expand All @@ -1349,6 +1358,42 @@ struct femtoUniverseProducerTask {
outputPartsMCLabels(-1);
}
}
if constexpr (resolveDaughs) {
childIDs[0] = 0;
childIDs[1] = 0;
for (int i = 0; i < tmpIDtrack.size(); i++) {
const auto& particle = tracks.iteratorAt(tmpIDtrack[i] - tracks.begin().globalIndex());
for (int daughIndex = 0, n = std::min(2ul, particle.daughtersIds().size()); daughIndex < n; daughIndex++) {
// loop to find the corresponding index of the daughters
for (int j = 0; j < tmpIDtrack.size(); j++) {
if (tmpIDtrack[j] == particle.daughtersIds()[daughIndex]) {
childIDs[daughIndex] = i - j;
break;
}
}
}
outputParts(outputCollision.lastIndex(),
particle.pt(),
particle.eta(),
particle.phi(),
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
0,
static_cast<uint32_t>(particle.pdgCode()),
particle.pdgCode(),
childIDs,
0,
0);
if (ConfIsDebug) {
fillDebugParticle<false, true, false>(particle);
}

// Workaround to keep the FDParticles and MC label tables
// aligned, so that they can be joined in the task.
if constexpr (transientLabels) {
outputPartsMCLabels(-1);
}
}
}
}

template <bool isMC, typename V0Type, typename TrackType,
Expand Down Expand Up @@ -1562,8 +1607,8 @@ struct femtoUniverseProducerTask {
for (auto& mccol : mccols) {
auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex());
auto groupedCollisions = collisions.sliceBy(recoCollsPerMCColl, mccol.globalIndex());
fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision
fillParticles<decltype(groupedMCParticles), true>(groupedMCParticles, recoMcIds); // fills mc particles
fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision
fillParticles<decltype(groupedMCParticles), true, true>(groupedMCParticles, recoMcIds); // fills mc particles
}
}
PROCESS_SWITCH(femtoUniverseProducerTask, processTruthAndFullMC, "Provide both MC truth and reco for tracks and V0s", false);
Expand Down
73 changes: 17 additions & 56 deletions PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ struct femtoUniversePairTaskTrackPhi {

bool IsProtonRejected(float mom, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.5) {
return true;
}
if (mom > 0.5) {
if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) {
return true;
Expand Down Expand Up @@ -236,6 +239,13 @@ struct femtoUniversePairTaskTrackPhi {

bool IsKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi)
{
if (mom < 0.5) {
if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) {
return true;
} else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) {
return true;
}
}
if (mom > 0.5) {
if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) {
return true;
Expand Down Expand Up @@ -271,6 +281,13 @@ struct femtoUniversePairTaskTrackPhi {

bool IsPionRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.5) {
if (TMath::Abs(nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) {
return true;
} else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) {
return true;
}
}
if (mom > 0.5) {
if (TMath::Hypot(nsigmaTOFK, nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) {
return true;
Expand Down Expand Up @@ -430,20 +447,6 @@ struct femtoUniversePairTaskTrackPhi {
float tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa;
if (!ConfTrack.ConfIsSame) {
for (auto& track : groupPartsTrack) {
// if (track.p() > ConfBothTracks.ConfCutTable->get("Track", "MaxP") || track.pt() > ConfBothTracks.ConfCutTable->get("Track", "MaxPt")) {
// continue;
// }
// if (!isFullPIDSelected(track.pidcut(),
// track.p(),
// ConfBothTracks.ConfCutTable->get("Track", "PIDthr"),
// vPIDTrack,
// ConfBothTracks.ConfNspecies,
// kNsigma,
// ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPC"),
// ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPCTOF"))) {
// continue;
// }

tpcNSigmaPi = trackCuts.getNsigmaTPC(track, o2::track::PID::Pion);
tofNSigmaPi = trackCuts.getNsigmaTOF(track, o2::track::PID::Pion);
tpcNSigmaKa = trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon);
Expand Down Expand Up @@ -475,27 +478,6 @@ struct femtoUniversePairTaskTrackPhi {
}
/// Now build the combinations
for (auto& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) {
// if (track.p() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxP") || track.pt() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxPt") || phicandidate.p() > ConfBothTracks.ConfCutTable->get("Track", "MaxP") || phicandidate.pt() > ConfBothTracks.ConfCutTable->get("Track", "MaxPt")) {
// continue;
// }
// if (!isFullPIDSelected(track.pidcut(),
// track.p(),
// ConfBothTracks.ConfCutTable->get("PhiCandidate", "PIDthr"),
// vPIDPhiCandidate,
// ConfBothTracks.ConfNspecies,
// kNsigma,
// ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPC"),
// ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPCTOF")) ||
// !isFullPIDSelected(phicandidate.pidcut(),
// phicandidate.p(),
// ConfBothTracks.ConfCutTable->get("Track", "PIDthr"),
// vPIDTrack,
// ConfBothTracks.ConfNspecies,
// kNsigma,
// ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPC"),
// ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPCTOF"))) {
// continue;
// }
if (ConfTrack.ConfIsTrackIdentified) {
if (!IsParticleNSigmaAccepted(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) {
continue;
Expand Down Expand Up @@ -573,27 +555,6 @@ struct femtoUniversePairTaskTrackPhi {
{

for (auto& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) {
// if (track.p() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxP") || track.pt() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxPt") || phicandidate.p() > ConfBothTracks.ConfCutTable->get("Track", "MaxP") || phicandidate.pt() > ConfBothTracks.ConfCutTable->get("Track", "MaxPt")) {
// continue;
// }
// if (!isFullPIDSelected(track.pidcut(),
// track.p(),
// ConfBothTracks.ConfCutTable->get("PhiCandidate", "PIDthr"),
// vPIDPhiCandidate,
// ConfBothTracks.ConfNspecies,
// kNsigma,
// ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPC"),
// ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPCTOF")) ||
// !isFullPIDSelected(phicandidate.pidcut(),
// phicandidate.p(),
// ConfBothTracks.ConfCutTable->get("Track", "PIDthr"),
// vPIDTrack,
// ConfBothTracks.ConfNspecies,
// kNsigma,
// ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPC"),
// ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPCTOF"))) {
// continue;
// }
if (ConfTrack.ConfIsTrackIdentified) {
if (!IsParticleNSigmaAccepted(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) {
continue;
Expand Down