diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx index dda1fa86320..08d196c651a 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx @@ -17,6 +17,8 @@ #include "PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "Common/CCDB/EventSelectionParams.h" #include "Common/CCDB/RCTSelectionFlags.h" @@ -87,19 +89,16 @@ struct FemtoUniverseProducerMCTruthTask { // Tables being produced Produces outputCollision; Produces outputParts; - // Produces outputPartsMCLabels; - // Produces outputPartsMC; RCTFlagsChecker rctChecker; - static constexpr int kHadElasticScatt = 20; // kPHElastic - hadronic elastic scattering - static constexpr int kHadInelasticScatt = 23; // kPHInhelastic - hadronic inelastic scattering + static constexpr int HadElasticScatt = 20; // kPHElastic - hadronic elastic scattering + static constexpr int HadInelasticScatt = 23; // kPHInhelastic - hadronic inelastic scattering // Analysis configs Configurable confIsRun3{"confIsRun3", false, "Running on Run3 or pilot"}; Configurable> confPDGCodes{"confPDGCodes", std::vector{211, -211, 2212, -2212, 333}, "PDG of particles to be stored"}; Configurable confAnalysisWithPID{"confAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles"}; - Configurable confStoreMotherPDG{"confStoreMotherPDG", false, "Store mother's PDG in tempFitVar."}; /// Event cuts Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; @@ -110,6 +109,9 @@ struct FemtoUniverseProducerMCTruthTask { Configurable confCentFT0Max{"confCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; Configurable confDoSpher{"confDoSpher", false, "Calculate sphericity. If false sphericity will take value of 2."}; Configurable confIsCheckRCTFlags{"confIsCheckRCTFlags", true, "Use RCTFlags"}; + Configurable confUseIsGoodZvtxFT0vsPV{"confUseIsGoodZvtxFT0vsPV", false, "Check consistency between PVz from central barrel with that from FT0 timing"}; + Configurable confUseIsVertexITSTPC{"confUseIsVertexITSTPC", false, "At least one ITS-TPC track (reject vertices built from ITS-only tracks)"}; + Configurable confUseNoSameBunchPileup{"confUseNoSameBunchPileup", false, "Exclude collisions in bunches with more than 1 reco. PV"}; // Track cuts struct : o2::framework::ConfigurableGroup { @@ -129,8 +131,8 @@ struct FemtoUniverseProducerMCTruthTask { void init(InitContext&) { - if (!doprocessTrackMC && !doprocessTrackMcOnlyRecoColl) { - LOGF(fatal, "Neither processTrackMC nor processTrackMcOnlyRecoColl enabled. Please choose one."); + if (!doprocessTrackMc && !doprocessTrackMcWithHf && !doprocessTrackMcOnlyRecoColl && !doprocessTrackMcOnlyRecoCollWithHf) { + LOGF(fatal, "No process enabled. Please choose one."); } rctChecker.init("CBT_hadronPID", false, true); // MC Truth collisions @@ -179,18 +181,23 @@ struct FemtoUniverseProducerMCTruthTask { if (confIsCheckRCTFlags && !rctChecker(col)) { return false; } - // check whether the basic event selection criteria are fulfilled // if the basic selection is NOT fulfilled MC Truth collision is rejected if (!recoCollCuts.isSelected(col)) { return false; } // additional checks on the reconstructed collisions - if (col.selection_bit(aod::evsel::kNoSameBunchPileup) && col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && col.selection_bit(aod::evsel::kIsVertexITSTPC)) { - recoCollCuts.fillQA(col); - return true; + if (confUseNoSameBunchPileup && !col.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (confUseIsGoodZvtxFT0vsPV && !col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; } - return false; + if (confUseIsVertexITSTPC && !col.selection_bit(aod::evsel::kIsVertexITSTPC)) { + return false; + } + recoCollCuts.fillQA(col); + return true; } template @@ -200,7 +207,7 @@ struct FemtoUniverseProducerMCTruthTask { return 0; } if (particle.has_mothers()) { - if (particle.getProcess() == kHadElasticScatt || particle.getProcess() == kHadInelasticScatt) { // treat particles from hadronic scattering (20, 23) as primary + if (particle.getProcess() == HadElasticScatt || particle.getProcess() == HadInelasticScatt) { // treat particles from hadronic scattering (20, 23) as primary return 0; } auto motherparticlesMC = particle.template mothers_as(); @@ -241,33 +248,30 @@ struct FemtoUniverseProducerMCTruthTask { continue; } } - // check if D0/D0bar mesons pass the rapidity cut // if pass then saving the orgin of D0/D0bar // check if tracks (besides D0/D0bar) pass pseudorapidity cut int8_t origin = -99; + int8_t sign = 0; if (std::abs(particle.pdgCode()) == Pdg::kD0) { - if (std::abs(particle.y()) > yD0CandGenMax) { + if (yD0CandGenMax >= 0. && std::abs(particle.y()) > yD0CandGenMax) { + continue; + } + /// check if we end-up with the correct final state using MC info + if (!RecoDecay::isMatchedMCGen(tracks, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign, 2)) { + /// check if we have D0(bar) → π± K∓ continue; } origin = RecoDecay::getCharmHadronOrigin(tracks, particle); } else if (std::abs(particle.eta()) > ConfFilteringTracks.confEtaFilterCut) { continue; } - - /// check if we end-up with the correct final state using MC info - int8_t sign = 0; - if (std::abs(pdgCode) == Pdg::kD0 && !RecoDecay::isMatchedMCGen(tracks, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) { - /// check if we have D0(bar) → π± K∓ - continue; - } // Getting the PDG code of the mother particle - int motherPDG = confStoreMotherPDG ? getMotherPDG(particle) : particle.pdgCode(); + int motherPDG = getMotherPDG(particle); // we cannot use isSelectedMinimal since it takes Ncls // if (!trackCuts.isSelectedMinimal(track)) { // continue; // } - // trackCuts.fillQA(track); // the bit-wise container of the systematic variations is obtained @@ -289,7 +293,73 @@ struct FemtoUniverseProducerMCTruthTask { } } - void processTrackMC(aod::McCollision const&, + template + void fillParticlesWithHf(TrackType const& tracks) + { + std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + + for (const auto& particle : tracks) { + // check the pT range + if (particle.pt() < ConfFilteringTracks.confPtLowFilterCut || particle.pt() > ConfFilteringTracks.confPtHighFilterCut) { + continue; + } + // get the PDG code + int pdgCode = particle.pdgCode(); + + if (confAnalysisWithPID) { + bool pass = false; + std::vector tmpPDGCodes = confPDGCodes; // necessary due to some features of the Configurable + for (auto const& pdg : tmpPDGCodes) { + if (pdgCode == Pdg::kPhi || // phi meson + std::abs(pdgCode) == Pdg::kD0 || // D0(bar) meson + pdgCode == Pdg::kDPlus || // D+ meson + (pdg == pdgCode && particle.isPhysicalPrimary())) { + pass = true; + break; // Exit early once a match is found + } + } + if (!pass) { + continue; + } + } + // check if D0/D0bar mesons pass the rapidity cut + // if pass then saving the orgin of D0/D0bar + // check if tracks (besides D0/D0bar) pass pseudorapidity cut + int8_t origin = -99; + const bool isD0 = std::abs(particle.pdgCode()) == Pdg::kD0; + const int decayChannel = static_cast(hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK); + + if (isD0) { + if (particle.flagMcMatchGen() != (particle.pdgCode() == Pdg::kD0 ? decayChannel : -decayChannel)) { + continue; + } + if (yD0CandGenMax >= 0.0 && std::abs(RecoDecay::y(particle.pVector(), MassD0)) > yD0CandGenMax) { + continue; + } + origin = particle.originMcGen(); + } else if (std::abs(particle.eta()) > ConfFilteringTracks.confEtaFilterCut) { + continue; + } + // Getting the PDG code of the mother particle + auto motherparticlesMC = particle.template mothers_as>(); + const auto& mcMotherPart = motherparticlesMC.front(); + + // filling the table with the selected paricles + outputParts(outputCollision.lastIndex(), + particle.pt(), + particle.eta(), + particle.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + 0, + pdgCode, + pdgCode, + childIDs, + origin, + mcMotherPart.pdgCode()); + } + } + + void processTrackMc(aod::McCollision const&, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) @@ -299,9 +369,22 @@ struct FemtoUniverseProducerMCTruthTask { fillCollisions(collisions, mcParticles); fillParticles(mcParticles); } - PROCESS_SWITCH(FemtoUniverseProducerMCTruthTask, processTrackMC, "Provide MC data for track analysis", true); + PROCESS_SWITCH(FemtoUniverseProducerMCTruthTask, processTrackMc, "Provide MC data for track analysis", false); + + void processTrackMcWithHf(aod::McCollision const&, + soa::SmallGroups> const& collisions, + soa::Join const& mcParticles, + aod::BCsWithTimestamps const&) + { + // magnetic field for run not needed for mc truth + // fill the tables + fillCollisions(collisions, mcParticles); + fillParticlesWithHf(mcParticles); + } + PROCESS_SWITCH(FemtoUniverseProducerMCTruthTask, processTrackMcWithHf, "Provide MC data for track-HF analysis", true); Preslice perMCCollision = aod::mcparticle::mcCollisionId; + Preslice> perMcCollHf = aod::mcparticle::mcCollisionId; PresliceUnsorted> recoCollsPerMCColl = aod::mcparticle::mcCollisionId; void processTrackMcOnlyRecoColl(aod::McCollisions const& mccols, @@ -333,6 +416,36 @@ struct FemtoUniverseProducerMCTruthTask { } } PROCESS_SWITCH(FemtoUniverseProducerMCTruthTask, processTrackMcOnlyRecoColl, "Provide MC data for track analysis from truth coll which were recontructed ", false); + + void processTrackMcOnlyRecoCollWithHf(aod::McCollisions const& mccols, + soa::Join const& collisions, + soa::Join const& mcParticles, + aod::BCsWithTimestamps const&) + { + // check on the reco collisions + static std::set mcColIds; + mcColIds.clear(); + + for (const auto& col : collisions) { + const auto colcheck = checkMcRecoCollisions(col); + if (colcheck) { + mcColIds.insert(col.mcCollisionId()); + } + } + // filling truth collisions and particles + for (const auto& mccol : mccols) { + if (!mcColIds.contains(mccol.globalIndex())) { + continue; + } + auto groupedMCParticles = mcParticles.sliceBy(perMcCollHf, mccol.globalIndex()); + auto groupedCollisions = collisions.sliceBy(recoCollsPerMCColl, mccol.globalIndex()); + // magnetic field for run not needed for mc truth + // fill the tables + fillCollisions(groupedCollisions, groupedMCParticles); + fillParticlesWithHf(groupedMCParticles); + } + } + PROCESS_SWITCH(FemtoUniverseProducerMCTruthTask, processTrackMcOnlyRecoCollWithHf, "Provide MC data for track-HF particle analysis from only reconstucted MC Truth collisions", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx index f6ecfa0f6b4..0690fab6163 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx @@ -37,6 +37,7 @@ #include #include +#include #include using namespace o2; @@ -50,21 +51,19 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { SliceCache cache; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; - /// Particle selection part - /// Configurables for both particles Configurable confUse3D{"confUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; - Configurable confEtaMax{"confEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; /// Particle 1 Configurable confPDGCodePartOne{"confPDGCodePartOne", 2212, "Particle 1 - PDG code"}; Configurable confNoPDGPartOne{"confNoPDGPartOne", false, "0: selecting part by PDG, 1: no PID selection"}; Configurable confPtLowPart1{"confPtLowPart1", 0.2, "Lower limit for Pt for the first particle"}; Configurable confPtHighPart1{"confPtHighPart1", 2.5, "Higher limit for Pt for the first particle"}; + Configurable confEtaMaxPart1{"confEtaMaxPart1", 0.8, "Maximum eta range - particle 1"}; /// Partition for particle 1 Partition partsOne = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && - (aod::femtouniverseparticle::pt < confPtHighPart1) && (aod::femtouniverseparticle::pt > confPtLowPart1) && (nabs(aod::femtouniverseparticle::eta) < confEtaMax); + (aod::femtouniverseparticle::pt < confPtHighPart1) && (aod::femtouniverseparticle::pt > confPtLowPart1) && (nabs(aod::femtouniverseparticle::eta) < confEtaMaxPart1); /// Histogramming for particle 1 FemtoUniverseParticleHisto trackHistoPartOne; @@ -75,10 +74,11 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { Configurable confNoPDGPartTwo{"confNoPDGPartTwo", false, "0: selecting part by PDG, 1: no PID selection"}; Configurable confPtLowPart2{"confPtLowPart2", 0.2, "Lower limit for Pt for the second particle"}; Configurable confPtHighPart2{"confPtHighPart2", 2.5, "Higher limit for Pt for the second particle"}; + Configurable confEtaMaxPart2{"confEtaMaxPart2", 0.8, "Maximum eta range - particle 2"}; /// Partition for particle 2 Partition partsTwo = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && - (aod::femtouniverseparticle::pt < confPtHighPart2) && (aod::femtouniverseparticle::pt > confPtLowPart2) && (nabs(aod::femtouniverseparticle::eta) < confEtaMax); + (aod::femtouniverseparticle::pt < confPtHighPart2) && (aod::femtouniverseparticle::pt > confPtLowPart2) && (nabs(aod::femtouniverseparticle::eta) < confEtaMaxPart2); /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -86,21 +86,20 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { /// Histogramming for Event FemtoUniverseEventHisto eventHisto; - /// The configurables need to be passed to an std::vector - int vPIDPartOne, vPIDPartTwo; - std::vector kNsigma; - // D0/D0bar options Configurable confActiveD0OriginCheck{"confActiveD0OriginCheck", false, "If true - calculate correlation for D0/D0bar mesons with a given origin"}; Configurable confD0OriginFlag{"confD0OriginFlag", 1, "D0/D0bar origin: 0 - none, 1 - prompt, 2 - non-prompt"}; - + // Check on mother PDG of the particle + Configurable confCheckMotherPDGPart1{"confCheckMotherPDGPart1", false, "If true do mother PDG check of the particle 1"}; + Configurable confCheckMotherPDGPart2{"confCheckMotherPDGPart2", false, "If true do mother PDG check of the particle 2"}; + Configurable confMotherPdgPart1{"confMotherPdgPart1", 421, "Provide mother PDG to be checked for particle 1"}; + Configurable confMotherPdgPart2{"confMotherPdgPart2", 421, "Provide mother PDG to be checked for particle 2"}; /// particle part ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; ConfigurableAxis confTempFitVarPDGBins{"confTempFitVarPDGBins", {6000, -2300, 2300}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; /// Correlation part ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task - // ConfigurableAxis confMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; ConfigurableAxis confmTBins3D{"confmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; @@ -112,8 +111,6 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { ConfigurableAxis confkTBins{"confkTBins", {150, 0., 9.}, "binning kT"}; ConfigurableAxis confmTBins{"confmTBins", {225, 0., 7.5}, "binning mT"}; Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; - Configurable confIsCPR{"confIsCPR", true, "Close Pair Rejection"}; - Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; Configurable confPhiBins{"confPhiBins", 29, "Number of phi bins in deta dphi"}; Configurable confEtaBins{"confEtaBins", 29, "Number of eta bins in deta dphi"}; @@ -132,16 +129,16 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { { eventHisto.init(&qaRegistry); - trackHistoPartOne.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, 0, confPDGCodePartOne, false); + trackHistoPartOne.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, false, confPDGCodePartOne, false); if (!confIsSame) { - trackHistoPartTwo.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, 0, confPDGCodePartTwo, false); + trackHistoPartTwo.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, false, confPDGCodePartTwo, false); } mixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, 0, confUse3D); - mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, 0, confUse3D); + sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, false, confUse3D); + mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, false, confUse3D); sameEventCont.setPDGCodes(confPDGCodePartOne, confPDGCodePartTwo); mixedEventCont.setPDGCodes(confPDGCodePartOne, confPDGCodePartTwo); pairCleaner.init(&qaRegistry); @@ -154,6 +151,21 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { eventHisto.fillQA(col); } + template + bool passesParticleSelection(const Particle& part, bool noPDG, int partPdgCode, bool checkMotherPdg, int motherPDG) + { + if (!noPDG && static_cast(part.tempFitVar()) != partPdgCode) { + return false; + } + if (std::abs(partPdgCode) == static_cast(Pdg::kD0) && confActiveD0OriginCheck && static_cast(part.mLambda()) != confD0OriginFlag) { + return false; + } + if (checkMotherPdg && static_cast(part.mAntiLambda()) == motherPDG) { + return false; + } + return true; + } + /// This function processes the same event and takes care of all the histogramming /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... /// @tparam PartitionType @@ -165,17 +177,14 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { /// @param magFieldTesla magnetic field of the collision /// @param multCol multiplicity of the collision template - void doSameEvent(const PartitionType& groupPartsOne, const PartitionType& groupPartsTwo, const PartType& parts, float /*magFieldTesla*/, int multCol) + void doSameEvent(const PartitionType& groupPartsOne, const PartitionType& groupPartsTwo, const PartType& parts, int multCol) { bool swpart = fNeventsProcessed % 2; fNeventsProcessed++; /// Histogramming same event for (auto const& part : groupPartsOne) { - if (!confNoPDGPartOne && part.tempFitVar() != confPDGCodePartOne) { - continue; - } - if (static_cast(part.tempFitVar()) == static_cast(Pdg::kD0) && confActiveD0OriginCheck && part.mLambda() != confD0OriginFlag) { + if (!passesParticleSelection(part, confNoPDGPartOne, confPDGCodePartOne, confCheckMotherPDGPart1, confMotherPdgPart1)) { continue; } trackHistoPartOne.fillQA(part); @@ -183,10 +192,7 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { if (!confIsSame) { for (auto const& part : groupPartsTwo) { - if (!confNoPDGPartTwo && part.tempFitVar() != confPDGCodePartTwo) { - continue; - } - if (static_cast(part.tempFitVar()) == static_cast(Pdg::kD0) && confActiveD0OriginCheck && part.mLambda() != confD0OriginFlag) { + if (!passesParticleSelection(part, confNoPDGPartTwo, confPDGCodePartTwo, confCheckMotherPDGPart2, confMotherPdgPart2)) { continue; } trackHistoPartTwo.fillQA(part); @@ -200,10 +206,12 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - if ((!confNoPDGPartOne && static_cast(p1.tempFitVar()) != confPDGCodePartOne) || (!confNoPDGPartTwo && static_cast(p2.tempFitVar()) != confPDGCodePartTwo)) { + if (!passesParticleSelection(p1, confNoPDGPartOne, confPDGCodePartOne, confCheckMotherPDGPart1, confMotherPdgPart1)) { + continue; + } + if (!passesParticleSelection(p2, confNoPDGPartTwo, confPDGCodePartTwo, confCheckMotherPDGPart2, confMotherPdgPart2)) { continue; } - if (swpart) { sameEventCont.setPair(p1, p2, multCol, confUse3D); } else { @@ -219,14 +227,17 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - if ((!confNoPDGPartOne && p2.tempFitVar() != confPDGCodePartOne) || (!confNoPDGPartTwo && p1.tempFitVar() != confPDGCodePartTwo)) { + if (!passesParticleSelection(p1, confNoPDGPartOne, confPDGCodePartOne, confCheckMotherPDGPart1, confMotherPdgPart1)) { + continue; + } + if (!passesParticleSelection(p2, confNoPDGPartTwo, confPDGCodePartTwo, confCheckMotherPDGPart2, confMotherPdgPart2)) { continue; } - if (swpart) + if (swpart) { sameEventCont.setPair(p1, p2, multCol, confUse3D); - else + } else { sameEventCont.setPair(p2, p1, multCol, confUse3D); - + } swpart = !swpart; } } @@ -242,7 +253,7 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { auto thegroupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto thegroupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr()); + doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.multNtr()); } PROCESS_SWITCH(FemtoUniversePairTaskTrackTrackMcTruth, processSameEvent, "Enable processing same event", true); @@ -266,11 +277,11 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { if ((!confNoPDGPartOne && static_cast(p1.tempFitVar()) != confPDGCodePartOne) || (!confNoPDGPartTwo && static_cast(p2.tempFitVar()) != confPDGCodePartTwo)) { continue; } - if (swpart) + if (swpart) { mixedEventCont.setPair(p1, p2, multCol, confUse3D); - else + } else { mixedEventCont.setPair(p2, p1, multCol, confUse3D); - + } swpart = !swpart; } } @@ -281,7 +292,7 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { void processMixedEvent(o2::aod::FdCollisions const& cols, o2::aod::FDParticles const& parts) { - for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols)) { const int multiplicityCol = collision1.multNtr(); mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol}));