diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index e80fbf366d4..af230c3628d 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -33,6 +33,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/DCA.h" #include "Common/Core/trackUtilities.h" @@ -665,11 +666,29 @@ struct HfCandidateCreator2ProngExpressions { Produces rowMcMatchRec; Produces rowMcMatchGen; - void init(InitContext const&) {} + float zPvPosMax{1000.f}; + + // inspect for which zPvPosMax cut was set for reconstructed + void init(InitContext& initContext) + { + const auto& workflows = initContext.services().get(); + for (const DeviceSpec& device : workflows.devices) { + if (device.name.compare("hf-candidate-creator-2prong") == 0) { + for (const auto& option : device.options) { + if (option.name.compare("zPvPosMax") == 0) { + zPvPosMax = option.defaultValue.get(); + break; + } + } + break; + } + } + } /// Performs MC matching. void processMc(aod::TracksWMc const& tracks, - aod::McParticles const& mcParticles) + aod::McParticles const& mcParticles, + aod::McCollisions const&) { rowCandidateProng2->bindExternalIndices(&tracks); @@ -681,6 +700,7 @@ struct HfCandidateCreator2ProngExpressions { // Match reconstructed candidates. // Spawned table can be used directly for (const auto& candidate : *rowCandidateProng2) { + flag = 0; origin = 0; auto arrayDaughters = std::array{candidate.prong0_as(), candidate.prong1_as()}; @@ -721,6 +741,13 @@ struct HfCandidateCreator2ProngExpressions { flag = 0; origin = 0; + auto mcCollision = particle.mcCollision(); + float zPv = mcCollision.posZ(); + if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them + rowMcMatchGen(flag, origin); + continue; + } + // D0(bar) → π± K∓ if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) { flag = sign * (1 << DecayType::D0ToPiK); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index d14b3a8f46f..e451eea36b3 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -470,12 +470,13 @@ struct HfCandidateCreator3ProngExpressions { bool createDs{false}; bool createLc{false}; bool createXic{false}; + float zPvPosMax{1000.f}; void init(InitContext& initContext) { - // inspect for which particle species the candidates were created - auto& workflows = initContext.services().get(); + // inspect for which particle species the candidates were created and which zPvPosMax cut was set for reconstructed + const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { if (device.name.compare("hf-candidate-creator-3prong") == 0) { for (const auto& option : device.options) { @@ -487,8 +488,11 @@ struct HfCandidateCreator3ProngExpressions { createLc = option.defaultValue.get(); } else if (option.name.compare("createXic") == 0) { createXic = option.defaultValue.get(); + } else if (option.name.compare("zPvPosMax") == 0) { + zPvPosMax = option.defaultValue.get(); } } + break; } } @@ -501,7 +505,8 @@ struct HfCandidateCreator3ProngExpressions { /// Performs MC matching. void processMc(aod::TracksWMc const& tracks, - aod::McParticles const& mcParticles) + aod::McParticles const& mcParticles, + aod::McCollisions const&) { rowCandidateProng3->bindExternalIndices(&tracks); @@ -618,6 +623,13 @@ struct HfCandidateCreator3ProngExpressions { channel = 0; arrDaughIndex.clear(); + auto mcCollision = particle.mcCollision(); + float zPv = mcCollision.posZ(); + if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them + rowMcMatchGen(flag, origin, channel); + continue; + } + // D± → π± K∓ π± if (createDplus) { if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) { diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index f3bb5526750..9992aa7a7a9 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -22,6 +22,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" @@ -445,8 +446,28 @@ struct HfCandidateCreatorCascadeMc { using MyTracksWMc = soa::Join; + float zPvPosMax{1000.f}; + + // inspect for which zPvPosMax cut was set for reconstructed + void init(InitContext& initContext) + { + const auto& workflows = initContext.services().get(); + for (const DeviceSpec& device : workflows.devices) { + if (device.name.compare("hf-candidate-creator-cascade") == 0) { + for (const auto& option : device.options) { + if (option.name.compare("zPvPosMax") == 0) { + zPvPosMax = option.defaultValue.get(); + break; + } + } + break; + } + } + } + void processMc(MyTracksWMc const& tracks, - aod::McParticles const& mcParticles) + aod::McParticles const& mcParticles, + aod::McCollisions const&) { int8_t sign = 0; int8_t origin = 0; @@ -493,6 +514,14 @@ struct HfCandidateCreatorCascadeMc { // Match generated particles. for (const auto& particle : mcParticles) { origin = 0; + + auto mcCollision = particle.mcCollision(); + float zPv = mcCollision.posZ(); + if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them + rowMcMatchGen(sign, origin); + continue; + } + // checking if I have a Lc --> K0S + p RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kLambdaCPlus, std::array{+kProton, +kK0Short}, false, &sign, 2); if (sign == 0) { // now check for anti-Lc diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 524d7982884..dd0d5b7b227 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -24,6 +24,7 @@ #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" // O2Physics #include "Common/Core/trackUtilities.h" // PWGHF @@ -516,11 +517,29 @@ struct HfCandidateCreatorDstarExpressions { Produces rowsMcMatchRecDstar; Produces rowsMcMatchGenDstar; - void init(InitContext const&) {} + float zPvPosMax{1000.f}; + + // inspect for which zPvPosMax cut was set for reconstructed + void init(InitContext& initContext) + { + const auto& workflows = initContext.services().get(); + for (const DeviceSpec& device : workflows.devices) { + if (device.name.compare("hf-candidate-creator-dstar") == 0) { + for (const auto& option : device.options) { + if (option.name.compare("zPvPosMax") == 0) { + zPvPosMax = option.defaultValue.get(); + break; + } + } + break; + } + } + } /// Perform MC Matching. void processMc(aod::TracksWMc const& tracks, - aod::McParticles const& mcParticles) + aod::McParticles const& mcParticles, + aod::McCollisions const&) { rowsCandidateD0->bindExternalIndices(&tracks); rowsCandidateDstar->bindExternalIndices(&tracks); @@ -576,6 +595,14 @@ struct HfCandidateCreatorDstarExpressions { originDstar = 0; originD0 = 0; + auto mcCollision = particle.mcCollision(); + float zPv = mcCollision.posZ(); + if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them + rowsMcMatchGenDstar(flagDstar, originDstar); + rowsMcMatchGenD0(flagD0, originD0); + continue; + } + // D*± → D0(bar) π± if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2)) { flagDstar = signDstar * (BIT(aod::hf_cand_dstar::DecayType::DstarToD0Pi)); diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx index e9957d61886..1b0231bf0e8 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx @@ -24,6 +24,7 @@ #include "DetectorsVertexing/PVertexer.h" // for dca recalculation #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" @@ -385,8 +386,24 @@ struct HfCandidateSigmac0plusplusMc { using LambdacMc = soa::Join; // using LambdacMcGen = soa::Join; + float zPvPosMax{1000.f}; + /// @brief init function - void init(InitContext const&) {} + void init(InitContext& initContext) + { + const auto& workflows = initContext.services().get(); + for (const DeviceSpec& device : workflows.devices) { + if (device.name.compare("hf-candidate-creator-3prong") == 0) { // here we assume that the hf-candidate-creator-3prong is in the workflow + for (const auto& option : device.options) { + if (option.name.compare("zPvPosMax") == 0) { + zPvPosMax = option.defaultValue.get(); + break; + } + } + break; + } + } + } /// @brief dummy process function, to be run on data /// @param @@ -397,7 +414,8 @@ struct HfCandidateSigmac0plusplusMc { /// @param mcParticles table of generated particles void processMc(aod::McParticles const& mcParticles, aod::TracksWMc const& tracks, - LambdacMc const& candsLc /*, const LambdacMcGen&*/) + LambdacMc const& candsLc /*, const LambdacMcGen&*/, + aod::McCollisions const&) { // Match reconstructed candidates. @@ -469,6 +487,13 @@ struct HfCandidateSigmac0plusplusMc { flag = 0; origin = 0; + auto mcCollision = particle.mcCollision(); + float zPv = mcCollision.posZ(); + if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them + rowMCMatchScGen(flag, origin); + continue; + } + /// 3 levels: /// 1. Σc0 → Λc+ π-,+ /// 2. Λc+ → pK-π+ direct (i) or Λc+ → resonant channel Λc± → p± K*, Λc± → Δ(1232)±± K∓ or Λc± → Λ(1520) π± (ii)