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
20 changes: 16 additions & 4 deletions PWGHF/D2H/DataModel/ReducedDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,10 @@ DECLARE_SOA_TABLE(HfMcGenRedB0s, "AOD", "HFMCGENREDB0", //! Generation-level MC
hf_b0_mc::EtaProng0,
hf_b0_mc::PtProng1,
hf_b0_mc::YProng1,
hf_b0_mc::EtaProng1);
hf_b0_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the B0 part
Expand Down Expand Up @@ -923,7 +926,10 @@ DECLARE_SOA_TABLE(HfMcGenRedBps, "AOD", "HFMCGENREDBP", //! Generation-level MC
hf_bplus_mc::EtaProng0,
hf_bplus_mc::PtProng1,
hf_bplus_mc::YProng1,
hf_bplus_mc::EtaProng1);
hf_bplus_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the Bplus part
Expand Down Expand Up @@ -1025,7 +1031,10 @@ DECLARE_SOA_TABLE(HfMcGenRedBss, "AOD", "HFMCGENREDBS", //! Generation-level MC
hf_bs_mc::EtaProng0,
hf_bs_mc::PtProng1,
hf_bs_mc::YProng1,
hf_bs_mc::EtaProng1);
hf_bs_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the Bs part
Expand Down Expand Up @@ -1109,7 +1118,10 @@ DECLARE_SOA_TABLE(HfMcGenRedLbs, "AOD", "HFMCGENREDLB", //! Generation-level MC
hf_lb_mc::EtaProng0,
hf_lb_mc::PtProng1,
hf_lb_mc::YProng1,
hf_lb_mc::EtaProng1);
hf_lb_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the B0 part
Expand Down
217 changes: 139 additions & 78 deletions PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx

Large diffs are not rendered by default.

72 changes: 56 additions & 16 deletions PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "Common/DataModel/PIDResponseTPC.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "Framework/RunningWorkflowInfo.h"
#include <CCDB/BasicCCDBManager.h>
#include <CommonConstants/PhysicsConstants.h>
#include <DCAFitter/DCAFitterN.h>
Expand Down Expand Up @@ -122,6 +123,7 @@ struct HfDataCreatorJpsiHadReduced {
Produces<aod::HfCfgBpToJpsi> rowCandidateConfigBplus;
Produces<aod::HfCfgBsToJpsis> rowCandidateConfigBs;

Configurable<bool> skipRejectedCollisions{"skipRejectedCollisions", true, "skips collisions rejected by the event selection, instead of flagging only"};
Configurable<bool> propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"};
Configurable<bool> useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"};
Configurable<bool> useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"};
Expand Down Expand Up @@ -162,10 +164,12 @@ struct HfDataCreatorJpsiHadReduced {
using TracksSel = soa::Join<aod::TracksWDcaExtra, aod::TracksPidPi, aod::PidTpcTofFullPi, aod::TracksPidKa, aod::PidTpcTofFullKa>;
using TracksPidWithSelAndMc = soa::Join<TracksPidWithSel, aod::McTrackLabels>;
using CollisionsWCMcLabels = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
using BCsInfo = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;

Preslice<aod::HfCand2ProngWPid> candsJpsiPerCollision = aod::track_association::collisionId;
Preslice<aod::TrackAssoc> trackIndicesPerCollision = aod::track_association::collisionId;
PresliceUnsorted<CollisionsWCMcLabels> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
Preslice<aod::McParticles> mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId;

o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
int runNumber;
Expand All @@ -174,13 +178,15 @@ struct HfDataCreatorJpsiHadReduced {
bool isHfCandBhadConfigFilled = false;

o2::hf_evsel::HfEventSelection hfEvSel;
o2::hf_evsel::HfEventSelectionMc hfEvSelMc;

o2::vertexing::DCAFitterN<2> df2;
o2::vertexing::DCAFitterN<3> df3;
o2::vertexing::DCAFitterN<4> df4;

HistogramRegistry registry{"registry"};

void init(InitContext const&)
void init(InitContext& initContext)
{
std::array<int, 4> doProcess = {doprocessJpsiKData, doprocessJpsiKMc, doprocessJpsiPhiData, doprocessJpsiPhiMc};
if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) {
Expand Down Expand Up @@ -270,6 +276,19 @@ struct HfDataCreatorJpsiHadReduced {
invMass2JpsiHadMin = (MassBS - invMassWindowJpsiHad) * (MassBS - invMassWindowJpsiHad);
invMass2JpsiHadMax = (MassBS + invMassWindowJpsiHad) * (MassBS + invMassWindowJpsiHad);
}

// init HF event selection helper
hfEvSel.init(registry);
if (doprocessJpsiKMc || doprocessJpsiPhiMc) {
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-data-creator-jpsi-had-reduced") == 0) {
// init HF event selection helper
hfEvSelMc.init(device, registry);
break;
}
}
}
}

/// Topological cuts
Expand Down Expand Up @@ -512,10 +531,23 @@ struct HfDataCreatorJpsiHadReduced {
}

template <uint8_t decChannel>
void runMcGen(aod::McParticles const& particlesMc)
void runMcGen(aod::McCollision const& mcCollision,
aod::McParticles const& particlesMc,
CollisionsWCMcLabels const& collisions,
BCsInfo const&)
{
// Check event selection
float centDummy{-1.f}, centFT0C{-1.f}, centFT0M{-1.f};
const auto collSlice = collisions.sliceBy(colPerMcCollision, mcCollision.globalIndex());
auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centDummy);
if (skipRejectedCollisions && hfRejMap != 0) {
return;
}

const auto mcParticlesPerMcColl = particlesMc.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());

// Match generated particles.
for (const auto& particle : particlesMc) {
for (const auto& particle : mcParticlesPerMcColl) {
int8_t sign{0}, flag{0}, channel{0};
if constexpr (decChannel == DecayChannel::BplusToJpsiK) {
// B+ → J/Psi K+ → (µ+µ-) K+
Expand Down Expand Up @@ -556,7 +588,7 @@ struct HfDataCreatorJpsiHadReduced {
}
rowHfBpMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle,
ptProngs[0], yProngs[0], etaProngs[0],
ptProngs[1], yProngs[1], etaProngs[1]);
ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M);
} else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) {
// Bs → J/Psi phi → (µ+µ-) (K+K-)
if (RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kBS, std::array{static_cast<int>(Pdg::kJPsi), +kKPlus, -kKPlus}, true, &sign, 2)) {
Expand Down Expand Up @@ -596,22 +628,29 @@ struct HfDataCreatorJpsiHadReduced {
}
rowHfBsMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle,
ptProngs[0], yProngs[0], etaProngs[0],
ptProngs[1], yProngs[1], etaProngs[1]);
ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M);
}
} // gen
}

// Jpsi candidate selection
template <bool doMc, uint8_t decChannel, typename Coll, typename JpsiCands, typename TTracks, typename PParticles>
template <bool doMc, uint8_t decChannel, typename Coll, typename JpsiCands, typename TTracks, typename PParticles, typename BBCs>
void runDataCreation(Coll const& collision,
JpsiCands const& candsJpsi,
aod::TrackAssoc const& trackIndices,
TTracks const&,
PParticles const& particlesMc,
uint64_t const& indexCollisionMaxNumContrib,
aod::BCsWithTimestamps const&)
BBCs const&)
{

registry.fill(HIST("hEvents"), 1 + Event::Processed);
float centrality = -1.f;
auto hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
if (skipRejectedCollisions && hfRejMap != 0) {
return;
}

// helpers for ReducedTables filling
int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1;
// std::map where the key is the track.globalIndex() and
Expand Down Expand Up @@ -959,14 +998,11 @@ struct HfDataCreatorJpsiHadReduced {
}
} // candsJpsi loop

registry.fill(HIST("hEvents"), 1 + Event::Processed);
if (!fillHfReducedCollision) {
registry.fill(HIST("hEvents"), 1 + Event::NoCharmHadPiSelected);
return;
}
registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected);
float centrality = -1.f;
uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
// fill collision table if it contains a J/Psi K pair at minimum
hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz);
hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(),
Expand Down Expand Up @@ -1047,8 +1083,8 @@ struct HfDataCreatorJpsiHadReduced {
aod::TrackAssoc const& trackIndices,
TracksPidWithSelAndMc const& tracks,
aod::McParticles const& particlesMc,
aod::BCsWithTimestamps const& bcs,
McCollisions const&)
BCsInfo const& bcs,
McCollisions const& mcCollisions)
{
// store configurables needed for B+ workflow
if (!isHfCandBhadConfigFilled) {
Expand All @@ -1073,7 +1109,9 @@ struct HfDataCreatorJpsiHadReduced {
}
// handle normalization by the right number of collisions
hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl);
runMcGen<DecayChannel::BplusToJpsiK>(particlesMc);
for (const auto& mcCollision : mcCollisions) {
runMcGen<DecayChannel::BplusToJpsiK>(mcCollision, particlesMc, collisions, bcs);
}
}
PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiKMc, "Process J/Psi K with MC info", false);

Expand All @@ -1082,8 +1120,8 @@ struct HfDataCreatorJpsiHadReduced {
aod::TrackAssoc const& trackIndices,
TracksPidWithSelAndMc const& tracks,
aod::McParticles const& particlesMc,
aod::BCsWithTimestamps const& bcs,
McCollisions const&)
BCsInfo const& bcs,
McCollisions const& mcCollisions)
{
// store configurables needed for B+ workflow
if (!isHfCandBhadConfigFilled) {
Expand All @@ -1108,7 +1146,9 @@ struct HfDataCreatorJpsiHadReduced {
}
// handle normalization by the right number of collisions
hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl);
runMcGen<DecayChannel::BsToJpsiPhi>(particlesMc);
for (const auto& mcCollision : mcCollisions) {
runMcGen<DecayChannel::BsToJpsiPhi>(mcCollision, particlesMc, collisions, bcs);
}
}
PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiPhiMc, "Process J/Psi phi with MC info", false);
};
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ struct HfCandidateCreator2ProngExpressions {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ struct HfCandidateCreator3ProngExpressions {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreatorCascade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ struct HfCandidateCreatorCascadeMc {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreatorDstar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ struct HfCandidateCreatorDstarExpressions {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
3 changes: 1 addition & 2 deletions PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,8 @@ struct HfCandidateSigmac0plusplusMc {
/// In case of need, readapt the code templetizing the function
auto mcCollision = particle.mcCollision();
float centrality{-1.f};
uint16_t rejectionMask{0};
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centrality);
auto rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centrality);
hfEvSelMc.fillHistograms<o2::hf_centrality::CentralityEstimator::None>(mcCollision, rejectionMask, 0);
if (rejectionMask != 0) {
// at least one event selection not satisfied --> reject gen particles from this collision
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/Tasks/taskMcValidation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ struct HfTaskMcValidationGen {
if (storeOccupancy) {
occupancy = getOccupancyGenColl(recoCollisions, OccupancyEstimator::Its);
}
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
if constexpr (centEstimator == CentralityEstimator::FT0C) {
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, recoCollisions, centrality);
} else if constexpr (centEstimator == CentralityEstimator::FT0M) {
Expand Down